Merge branch 'master' of gitea.iwm-tuebingen.de:IWMBrowser/iwmlib

This commit is contained in:
2019-08-01 19:34:49 +02:00
73 changed files with 249 additions and 157 deletions
+6 -3
View File
@@ -5237,6 +5237,8 @@
Poppable.registrations = new Map();
/* eslint-disable no-console */
/** A Popup that shows text labels, images, or html
*/
class Popup$1 extends Poppable {
@@ -5417,6 +5419,7 @@
}
for (let key in content) {
console.log('using', key, this.loaded);
switch (key) {
case 'selector':
break
@@ -5525,7 +5528,7 @@
handleClose(e) {
let closing = this.closingEvent(e);
if (closing) {
this.close();
this.close(e);
} else {
this.setupCloseHandler();
}
@@ -5653,11 +5656,11 @@
/** Close and remove the Popup from the DOM tree.
*/
close() {
close(event) {
//console.log("Popup.close", this.closeCommand)
this.unregister(this.context);
if (this.closeCommand) {
this.closeCommand(this, () => this.remove());
this.closeCommand(this, () => this.remove(), event);
} else {
this.remove();
}
+53 -29
View File
@@ -2482,13 +2482,11 @@
this.capture(e);
});
this.button.on('pointerout', e => {
this.capture(e);
TweenLite.to([this.button, this.content], this.theme.fast, {
alpha: 1,
overwrite: 'none'
});
});
this.button.on('pointerout', this.onEnd.bind(this));
this.button.on('pointercancel', this.onEnd.bind(this));
this.button.on('pointerupoutside', this.onEnd.bind(this));
this.button.on('pointertap', this.onEnd.bind(this));
this.button.on('scroll', this.onEnd.bind(this));
// eslint-disable-next-line no-unused-vars
this.button.on('pointerdown', e => {
@@ -2921,6 +2919,14 @@
this.icon.tint = value;
}
}
onEnd(event) {
this.capture(event);
TweenLite.to([this.button, this.content], this.theme.fast, {
alpha: 1,
overwrite: 'none'
});
}
}
/* globals ThrowPropsPlugin, Strong */
@@ -3477,7 +3483,7 @@
this.buttons.forEach((it, index) => {
const leftCorner = it.__originalPosition.x + this.container.x;
const rightCorner = it.__originalPosition.x + it.width;
const rightCorner = it.__originalPosition.x + it.button.width;
const paddingLeft = index * this.opts.stackPadding;
const paddingRight = reverseCounter * this.opts.stackPadding;
if (leftCorner < paddingLeft) {
@@ -3485,7 +3491,7 @@
it.x = -this.container.x + paddingLeft;
} else if (rightCorner > -this.container.x + this.opts.maxWidth - paddingRight) {
// right border
it.x = -this.container.x + this.opts.maxWidth - it.width - paddingRight;
it.x = -this.container.x + this.opts.maxWidth - it.button.width - paddingRight;
} else {
it.x = it.__originalPosition.x;
}
@@ -3496,21 +3502,30 @@
});
const min = Math.min(...sorted.map(it => it.x));
const max = Math.max(...sorted.map(it => it.x));
const max = Math.max(...sorted.map(it => it.x + it.button.width));
const center = (min + max) / 2;
// z-index
sorted
.sort((a, b) => {
const distanceA = Math.abs(a.x - center);
const distanceB = Math.abs(b.x - center);
if (distanceA < distanceB) {
return 1
} else if (distanceA > distanceB) {
return -1
} else {
return 0
const centerA = a.x + a.button.width / 2;
const centerB = b.x + b.button.width / 2;
if (centerA < center && centerB < center) {
if (a.x < b.x) {
return -1
} else if (b.x < a.x) {
return 1
}
} else if (centerA > center && centerB > center) {
if (a.x + a.button.width > b.x + b.button.width) {
return -1
} else if (b.x + b.button.width < a.x + a.button.x) {
return 1
}
}
return 0
})
.forEach(it => it.parent.addChild(it));
}
@@ -3525,7 +3540,7 @@
this.buttons.forEach((it, index) => {
const topCorner = it.__originalPosition.y + this.container.y;
const bottomCorner = it.__originalPosition.y + it.height;
const bottomCorner = it.__originalPosition.y + it.button.height;
const paddingTop = index * this.opts.stackPadding;
const paddingBottom = reverseCounter * this.opts.stackPadding;
if (topCorner < paddingTop) {
@@ -3533,7 +3548,7 @@
it.y = -this.container.y + paddingTop;
} else if (bottomCorner > -this.container.y + this.opts.maxHeight - paddingBottom) {
// bottom border
it.y = -this.container.y + this.opts.maxHeight - it.height - paddingBottom;
it.y = -this.container.y + this.opts.maxHeight - it.button.height - paddingBottom;
} else {
it.y = it.__originalPosition.y;
}
@@ -3544,21 +3559,30 @@
});
const min = Math.min(...sorted.map(it => it.y));
const max = Math.max(...sorted.map(it => it.y));
const max = Math.max(...sorted.map(it => it.y + it.button.height));
const center = (min + max) / 2;
// z-index
sorted
.sort((a, b) => {
const distanceA = Math.abs(a.y - center);
const distanceB = Math.abs(b.y - center);
if (distanceA < distanceB) {
return 1
} else if (distanceA > distanceB) {
return -1
} else {
return 0
const centerA = a.y + a.button.height / 2;
const centerB = b.y + b.button.height / 2;
if (centerA < center && centerB < center) {
if (a.y < b.y) {
return -1
} else if (b.y < a.y) {
return 1
}
} else if (centerA > center && centerB > center) {
if (a.y + a.button.height > b.y + b.button.height) {
return -1
} else if (b.y + b.button.height < a.y + a.button.y) {
return 1
}
}
return 0
})
.forEach(it => it.parent.addChild(it));
}