Prettified all files.

This commit is contained in:
2019-07-18 12:26:39 +02:00
parent 7744b92771
commit 2d400a18ec
125 changed files with 11184 additions and 8154 deletions
+24 -23
View File
@@ -31,12 +31,10 @@ export class CardLoader {
this.maxHeight = maxHeight != null ? maxHeight : window.innerHeight
this.addedNode = null
console.log({
width,
height,
maxWidth,
maxHeight,
maxHeight
})
}
@@ -152,11 +150,13 @@ export class HTMLLoader extends CardLoader {
domNode.innerHTML = xhr.response
this.addedNode = domNode.firstElementChild
let { width, height } = this.size(this.addedNode)
console.log("HTMLLoader.load", { added: this.addedNode, width, height })
if (width)
this.wantedWidth = width || this.wantedWidth
if (height)
this.wantedHeight = height || this.wantedHeight
console.log('HTMLLoader.load', {
added: this.addedNode,
width,
height
})
if (width) this.wantedWidth = width || this.wantedWidth
if (height) this.wantedHeight = height || this.wantedHeight
resolve(this)
}
xhr.onerror = e => {
@@ -169,7 +169,7 @@ export class HTMLLoader extends CardLoader {
/**
* Tries to determine the size of the addedNode.
* Checks for explicit width and height style attributes.
*
*
* Overwrite this method if you want to extract values from other infos.
*
* @returns { width: int, height: int }
@@ -248,7 +248,7 @@ export class DOMFlip {
this.cardWrapper = dom.querySelector('#' + this.id)
let front = this.cardWrapper.querySelector('.front')
this.frontLoader.load(front).then(loader => {
this.frontLoaded(loader).then((obj) => {
this.frontLoaded(loader).then(obj => {
if (this.onLoaded) this.onLoaded()
resolve(this)
})
@@ -275,7 +275,9 @@ export class DOMFlip {
scalable: this.scalable,
rotatable: this.rotatable,
overdoScaling: this.overdoScaling,
tapDelegate: (this.tapDelegateFactory) ? this.tapDelegateFactory(this.cardWrapper) : null
tapDelegate: this.tapDelegateFactory
? this.tapDelegateFactory(this.cardWrapper)
: null
}
)
@@ -284,7 +286,7 @@ export class DOMFlip {
}
if (this.closeOnMinScale) {
const removeOnMinScale = function () {
const removeOnMinScale = function() {
if (scatter.scale <= scatter.minScale) {
this.flippable.close()
@@ -294,7 +296,9 @@ export class DOMFlip {
//Remove callback
if (scatter.onTransform) {
let callbackIdx = scatter.onTransform.indexOf(removeOnMinScale)
let callbackIdx = scatter.onTransform.indexOf(
removeOnMinScale
)
scatter.onTransform.splice(callbackIdx, 1)
}
}
@@ -325,7 +329,7 @@ export class DOMFlip {
}
setupFlippable(flippable, loader) {
console.log("setupFlippable", loader.wantedWidth)
console.log('setupFlippable', loader.wantedWidth)
flippable.wantedWidth = loader.wantedWidth
flippable.wantedHeight = loader.wantedHeight
flippable.wantedScale = loader.scale
@@ -335,12 +339,10 @@ export class DOMFlip {
}
start({ targetCenter = null } = {}) {
console.log("DOMFlip.start", targetCenter)
console.log('DOMFlip.start', targetCenter)
if (this.preloadBack) {
this.flippable.start({ duration: this.flipDuration, targetCenter })
}
else {
} else {
let back = this.cardWrapper.querySelector('.back')
let flippable = this.flippable
this.backLoader.load(back).then(loader => {
@@ -487,7 +489,7 @@ export class DOMFlippable {
clickInfo() {
this.bringToFront()
console.log("clickInfo")
console.log('clickInfo')
this.infoBtn.click()
}
@@ -585,14 +587,14 @@ export class DOMFlippable {
let y = this.flipped ? yy : this.startY
let onUpdate = this.onUpdate !== null ? () => this.onUpdate(this) : null
console.log("start", this.flipDuration)
console.log('start', this.flipDuration)
TweenLite.to(this.card, this.flipDuration, {
rotationY: targetY,
ease: Power1.easeOut,
transformOrigin: '50% 50%',
onUpdate,
onComplete: e => {
console.log("start end", this.flipDuration)
console.log('start end', this.flipDuration)
if (this.flipped) {
//this.hide(this.front)
this.enable(this.backBtn)
@@ -602,7 +604,6 @@ export class DOMFlippable {
this.onFrontFlipped(this)
}
} else {
if (this.onBackFlipped == null) {
this.enable(this.infoBtn, this.fadeDuration)
this.enable(this.closeBtn, this.fadeDuration)
@@ -625,7 +626,7 @@ export class DOMFlippable {
force3D: true
})
console.log("start 2", this.wantedWidth, this.startWidth, {w, h})
console.log('start 2', this.wantedWidth, this.startWidth, { w, h })
// See https://greensock.com/forums/topic/7997-rotate-the-shortest-way/
TweenLite.to(this.element, this.flipDuration / 2, {
scale: targetScale,