diff --git a/css/highlight.css b/css/highlight.css index 2a04689..63db9c3 100644 --- a/css/highlight.css +++ b/css/highlight.css @@ -4,8 +4,6 @@ circle { stroke-width: 8px; } - - mask circle { stroke-width: 0; fill: white; diff --git a/dist/iwmlib.js b/dist/iwmlib.js index f4d2426..414e534 100644 --- a/dist/iwmlib.js +++ b/dist/iwmlib.js @@ -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(); } diff --git a/dist/iwmlib.pixi.js b/dist/iwmlib.pixi.js index 787e827..ed5fc52 100644 --- a/dist/iwmlib.pixi.js +++ b/dist/iwmlib.pixi.js @@ -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)); } diff --git a/doc/out/AbstractPopup.html b/doc/out/AbstractPopup.html index 4081236..65a3bce 100644 --- a/doc/out/AbstractPopup.html +++ b/doc/out/AbstractPopup.html @@ -2920,7 +2920,7 @@ a string, a number or a PIXI.Text object.

diff --git a/doc/out/Badge.html b/doc/out/Badge.html index e0f51c8..d82153d 100644 --- a/doc/out/Badge.html +++ b/doc/out/Badge.html @@ -2376,7 +2376,7 @@ a string, a number or a PIXI.Text object.

diff --git a/doc/out/BlurFilter.html b/doc/out/BlurFilter.html index bdffa14..33f3d24 100644 --- a/doc/out/BlurFilter.html +++ b/doc/out/BlurFilter.html @@ -1800,7 +1800,7 @@ app.scene.filters = [blurFilter] diff --git a/doc/out/Button.html b/doc/out/Button.html index 83d137e..a2e0c16 100644 --- a/doc/out/Button.html +++ b/doc/out/Button.html @@ -3818,7 +3818,7 @@ the tint property of the icon sprite.

diff --git a/doc/out/ButtonGroup.html b/doc/out/ButtonGroup.html index fb522b6..7d63851 100644 --- a/doc/out/ButtonGroup.html +++ b/doc/out/ButtonGroup.html @@ -3107,7 +3107,7 @@ app.scene.addChild(buttonGroup)
- buttongroup.js:602 + buttongroup.js:611
@@ -3692,7 +3692,7 @@ app.scene.addChild(buttonGroup) diff --git a/doc/out/DeepZoomImage.html b/doc/out/DeepZoomImage.html index e62cd1a..f56db59 100644 --- a/doc/out/DeepZoomImage.html +++ b/doc/out/DeepZoomImage.html @@ -5098,7 +5098,7 @@ i.e. after loading a single tile

diff --git a/doc/out/DeepZoomInfo.html b/doc/out/DeepZoomInfo.html index eb97fdb..013f3c8 100644 --- a/doc/out/DeepZoomInfo.html +++ b/doc/out/DeepZoomInfo.html @@ -2611,7 +2611,7 @@ on completion.

diff --git a/doc/out/Flippable.html b/doc/out/Flippable.html index 5400a8c..601ecf3 100644 --- a/doc/out/Flippable.html +++ b/doc/out/Flippable.html @@ -2514,7 +2514,7 @@ front.on('click', event => flippable.toggle()) diff --git a/doc/out/FontInfo.html b/doc/out/FontInfo.html index 34b7c78..7b98696 100644 --- a/doc/out/FontInfo.html +++ b/doc/out/FontInfo.html @@ -1561,7 +1561,7 @@ diff --git a/doc/out/Hypenate.html b/doc/out/Hypenate.html index 39ea437..cfeac6c 100644 --- a/doc/out/Hypenate.html +++ b/doc/out/Hypenate.html @@ -1763,7 +1763,7 @@ diff --git a/doc/out/InteractivePopup.html b/doc/out/InteractivePopup.html index bf37e4a..5283cb4 100644 --- a/doc/out/InteractivePopup.html +++ b/doc/out/InteractivePopup.html @@ -2345,7 +2345,7 @@ a string, a number or a PIXI.Text object.

diff --git a/doc/out/LabeledGraphics.exports.LabeledGraphics.html b/doc/out/LabeledGraphics.exports.LabeledGraphics.html index 0b2515f..e3ada67 100644 --- a/doc/out/LabeledGraphics.exports.LabeledGraphics.html +++ b/doc/out/LabeledGraphics.exports.LabeledGraphics.html @@ -1563,7 +1563,7 @@ diff --git a/doc/out/LabeledGraphics.html b/doc/out/LabeledGraphics.html index b6f53e8..060e318 100644 --- a/doc/out/LabeledGraphics.html +++ b/doc/out/LabeledGraphics.html @@ -2628,7 +2628,7 @@ than wanted

diff --git a/doc/out/List.html b/doc/out/List.html index 0d817d8..67dea74 100644 --- a/doc/out/List.html +++ b/doc/out/List.html @@ -2587,7 +2587,7 @@ app.scene.addChild(list) diff --git a/doc/out/Message.html b/doc/out/Message.html index fc59b49..d1043fc 100644 --- a/doc/out/Message.html +++ b/doc/out/Message.html @@ -2443,7 +2443,7 @@ a string, a number or a PIXI.Text object.

diff --git a/doc/out/MessageInteractivePopup.html b/doc/out/MessageInteractivePopup.html index 57430af..c5c3ee1 100644 --- a/doc/out/MessageInteractivePopup.html +++ b/doc/out/MessageInteractivePopup.html @@ -1791,7 +1791,7 @@ like Popup, Message...

diff --git a/doc/out/MessageMessageInteractivePopup.html b/doc/out/MessageMessageInteractivePopup.html index aa6d5ab..a755058 100644 --- a/doc/out/MessageMessageInteractivePopup.html +++ b/doc/out/MessageMessageInteractivePopup.html @@ -1791,7 +1791,7 @@ like Popup, Message...

diff --git a/doc/out/Modal.html b/doc/out/Modal.html index d5a92fc..302cd6c 100644 --- a/doc/out/Modal.html +++ b/doc/out/Modal.html @@ -2344,7 +2344,7 @@ a string or a PIXI.Text object.

diff --git a/doc/out/ModalInteractivePopup.html b/doc/out/ModalInteractivePopup.html index 1dccd52..e65567c 100644 --- a/doc/out/ModalInteractivePopup.html +++ b/doc/out/ModalInteractivePopup.html @@ -1791,7 +1791,7 @@ like Popup, Message...

diff --git a/doc/out/ModalModalInteractivePopup.html b/doc/out/ModalModalInteractivePopup.html index b72513d..097a079 100644 --- a/doc/out/ModalModalInteractivePopup.html +++ b/doc/out/ModalModalInteractivePopup.html @@ -1791,7 +1791,7 @@ like Popup, Message...

diff --git a/doc/out/PIXIApp.html b/doc/out/PIXIApp.html index 8a58ca2..fcbc3a9 100644 --- a/doc/out/PIXIApp.html +++ b/doc/out/PIXIApp.html @@ -5745,7 +5745,7 @@ rejected with an error. diff --git a/doc/out/Popup.html b/doc/out/Popup.html index be17b52..56f368a 100644 --- a/doc/out/Popup.html +++ b/doc/out/Popup.html @@ -2338,7 +2338,7 @@ a string, a number or a PIXI.Text object.

diff --git a/doc/out/PopupInteractivePopup.html b/doc/out/PopupInteractivePopup.html index 5aebad5..313c7dc 100644 --- a/doc/out/PopupInteractivePopup.html +++ b/doc/out/PopupInteractivePopup.html @@ -1791,7 +1791,7 @@ like Popup, Message...

diff --git a/doc/out/PopupMenu.html b/doc/out/PopupMenu.html index 9e9b315..da8b85b 100644 --- a/doc/out/PopupMenu.html +++ b/doc/out/PopupMenu.html @@ -2392,7 +2392,7 @@ a string, a number or a PIXI.Text object.

diff --git a/doc/out/PopupMenuPopupInteractivePopup.html b/doc/out/PopupMenuPopupInteractivePopup.html index 4f58817..d1bf56f 100644 --- a/doc/out/PopupMenuPopupInteractivePopup.html +++ b/doc/out/PopupMenuPopupInteractivePopup.html @@ -1791,7 +1791,7 @@ like Popup, Message...

diff --git a/doc/out/PopupMenuPopupMenuPopupInteractivePopup.html b/doc/out/PopupMenuPopupMenuPopupInteractivePopup.html index 9133839..7c10884 100644 --- a/doc/out/PopupMenuPopupMenuPopupInteractivePopup.html +++ b/doc/out/PopupMenuPopupMenuPopupInteractivePopup.html @@ -1791,7 +1791,7 @@ like Popup, Message...

diff --git a/doc/out/PopupMenuPopupMenuPopupPopupInteractivePopup.html b/doc/out/PopupMenuPopupMenuPopupPopupInteractivePopup.html index 3876b05..d7e1f90 100644 --- a/doc/out/PopupMenuPopupMenuPopupPopupInteractivePopup.html +++ b/doc/out/PopupMenuPopupMenuPopupPopupInteractivePopup.html @@ -1791,7 +1791,7 @@ like Popup, Message...

diff --git a/doc/out/PopupMenuPopupPopupInteractivePopup.html b/doc/out/PopupMenuPopupPopupInteractivePopup.html index c559f6f..e52e03a 100644 --- a/doc/out/PopupMenuPopupPopupInteractivePopup.html +++ b/doc/out/PopupMenuPopupPopupInteractivePopup.html @@ -1791,7 +1791,7 @@ like Popup, Message...

diff --git a/doc/out/PopupPopupInteractivePopup.html b/doc/out/PopupPopupInteractivePopup.html index cf5e2d4..59c7c3b 100644 --- a/doc/out/PopupPopupInteractivePopup.html +++ b/doc/out/PopupPopupInteractivePopup.html @@ -1791,7 +1791,7 @@ like Popup, Message...

diff --git a/doc/out/Progress.html b/doc/out/Progress.html index 7150cfe..4761562 100644 --- a/doc/out/Progress.html +++ b/doc/out/Progress.html @@ -2877,7 +2877,7 @@ app.scene.addChild(progress) diff --git a/doc/out/Scrollview.html b/doc/out/Scrollview.html index 6b7dfba..fa58a7a 100644 --- a/doc/out/Scrollview.html +++ b/doc/out/Scrollview.html @@ -1709,7 +1709,7 @@ app.loader diff --git a/doc/out/Slider.html b/doc/out/Slider.html index 2c3d4c5..2bee9df 100644 --- a/doc/out/Slider.html +++ b/doc/out/Slider.html @@ -2968,7 +2968,7 @@ app.scene.addChild(slider) diff --git a/doc/out/Switch.html b/doc/out/Switch.html index 642d56e..cf4e7d6 100644 --- a/doc/out/Switch.html +++ b/doc/out/Switch.html @@ -3398,7 +3398,7 @@ app.scene.addChild(switch1) diff --git a/doc/out/TextLabel.TextLabel.html b/doc/out/TextLabel.TextLabel.html index 65df9e9..6b45046 100644 --- a/doc/out/TextLabel.TextLabel.html +++ b/doc/out/TextLabel.TextLabel.html @@ -1692,7 +1692,7 @@ diff --git a/doc/out/Theme.html b/doc/out/Theme.html index 28cf6c4..cd8b856 100644 --- a/doc/out/Theme.html +++ b/doc/out/Theme.html @@ -3167,7 +3167,7 @@ const app = new PIXIApp({ diff --git a/doc/out/ThemeDark.html b/doc/out/ThemeDark.html index 22fed3f..79fdda2 100644 --- a/doc/out/ThemeDark.html +++ b/doc/out/ThemeDark.html @@ -1588,7 +1588,7 @@ const app = new PIXIApp({ diff --git a/doc/out/ThemeLight.html b/doc/out/ThemeLight.html index c9053f6..f6915cd 100644 --- a/doc/out/ThemeLight.html +++ b/doc/out/ThemeLight.html @@ -1600,7 +1600,7 @@ const app = new PIXIApp({ diff --git a/doc/out/ThemeRed.html b/doc/out/ThemeRed.html index 3cfcc86..f824138 100644 --- a/doc/out/ThemeRed.html +++ b/doc/out/ThemeRed.html @@ -1600,7 +1600,7 @@ const app = new PIXIApp({ diff --git a/doc/out/TileQuadNode.html b/doc/out/TileQuadNode.html index f0df52e..b7b5110 100644 --- a/doc/out/TileQuadNode.html +++ b/doc/out/TileQuadNode.html @@ -2052,7 +2052,7 @@ an indicator of tiles to free.

diff --git a/doc/out/Tooltip.html b/doc/out/Tooltip.html index 31043c0..339ee94 100644 --- a/doc/out/Tooltip.html +++ b/doc/out/Tooltip.html @@ -2514,7 +2514,7 @@ a string, a number or a PIXI.Text object.

diff --git a/doc/out/UITest.html b/doc/out/UITest.html index 991d9d9..5bac7f0 100644 --- a/doc/out/UITest.html +++ b/doc/out/UITest.html @@ -4185,7 +4185,7 @@ test.start() diff --git a/doc/out/Volatile.html b/doc/out/Volatile.html index bfa15b9..241bb19 100644 --- a/doc/out/Volatile.html +++ b/doc/out/Volatile.html @@ -2101,7 +2101,7 @@ app.scene.addChild(button) diff --git a/doc/out/global.html b/doc/out/global.html index b78172c..085c1ee 100644 --- a/doc/out/global.html +++ b/doc/out/global.html @@ -3322,7 +3322,7 @@ diff --git a/doc/out/index.html b/doc/out/index.html index a5b42e3..0cd30e1 100644 --- a/doc/out/index.html +++ b/doc/out/index.html @@ -1487,7 +1487,7 @@ diff --git a/doc/out/pixi_abstractpopup.js.html b/doc/out/pixi_abstractpopup.js.html index 39e6760..14768f3 100644 --- a/doc/out/pixi_abstractpopup.js.html +++ b/doc/out/pixi_abstractpopup.js.html @@ -1810,7 +1810,7 @@ export default class AbstractPopup extends PIXI.Graphics { diff --git a/doc/out/pixi_app.js.html b/doc/out/pixi_app.js.html index ad17078..b7dc801 100644 --- a/doc/out/pixi_app.js.html +++ b/doc/out/pixi_app.js.html @@ -2191,7 +2191,7 @@ class FpsDisplay extends PIXI.Graphics { diff --git a/doc/out/pixi_badge.js.html b/doc/out/pixi_badge.js.html index b58ecac..f4333e6 100644 --- a/doc/out/pixi_badge.js.html +++ b/doc/out/pixi_badge.js.html @@ -1571,7 +1571,7 @@ export default class Badge extends AbstractPopup { diff --git a/doc/out/pixi_blurfilter.js.html b/doc/out/pixi_blurfilter.js.html index 7093a67..d67139b 100644 --- a/doc/out/pixi_blurfilter.js.html +++ b/doc/out/pixi_blurfilter.js.html @@ -1729,7 +1729,7 @@ class TiltShiftYFilter extends TiltShiftAxisFilter { diff --git a/doc/out/pixi_button.js.html b/doc/out/pixi_button.js.html index b9207de..bc9063d 100644 --- a/doc/out/pixi_button.js.html +++ b/doc/out/pixi_button.js.html @@ -2153,7 +2153,7 @@ export default class Button extends PIXI.Container { diff --git a/doc/out/pixi_buttongroup.js.html b/doc/out/pixi_buttongroup.js.html index 2a0e6c8..945ebeb 100644 --- a/doc/out/pixi_buttongroup.js.html +++ b/doc/out/pixi_buttongroup.js.html @@ -2004,7 +2004,7 @@ export default class ButtonGroup extends PIXI.Container { 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) { @@ -2012,7 +2012,7 @@ export default class ButtonGroup extends PIXI.Container { 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 } @@ -2023,21 +2023,30 @@ export default class ButtonGroup extends PIXI.Container { }) 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)) } @@ -2052,7 +2061,7 @@ export default class ButtonGroup extends PIXI.Container { 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) { @@ -2060,7 +2069,7 @@ export default class ButtonGroup extends PIXI.Container { 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 } @@ -2071,21 +2080,30 @@ export default class ButtonGroup extends PIXI.Container { }) 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)) } @@ -2103,7 +2121,7 @@ export default class ButtonGroup extends PIXI.Container { diff --git a/doc/out/pixi_deepzoom_image.js.html b/doc/out/pixi_deepzoom_image.js.html index 9ed5198..2e05ac2 100644 --- a/doc/out/pixi_deepzoom_image.js.html +++ b/doc/out/pixi_deepzoom_image.js.html @@ -2553,7 +2553,7 @@ export class DeepZoomImage extends PIXI.Container { diff --git a/doc/out/pixi_flippable.js.html b/doc/out/pixi_flippable.js.html index d1d6b59..8e00349 100644 --- a/doc/out/pixi_flippable.js.html +++ b/doc/out/pixi_flippable.js.html @@ -1908,7 +1908,7 @@ export default class Flippable extends PIXI.projection.Camera3d { diff --git a/doc/out/pixi_labeledgraphics.js.html b/doc/out/pixi_labeledgraphics.js.html index 28a3a8d..7a30599 100644 --- a/doc/out/pixi_labeledgraphics.js.html +++ b/doc/out/pixi_labeledgraphics.js.html @@ -1857,7 +1857,7 @@ export class BitmapLabeledGraphics extends LabeledGraphics { diff --git a/doc/out/pixi_list.js.html b/doc/out/pixi_list.js.html index 0de4e9c..e73637b 100644 --- a/doc/out/pixi_list.js.html +++ b/doc/out/pixi_list.js.html @@ -1836,7 +1836,7 @@ export default class List extends PIXI.Container { diff --git a/doc/out/pixi_message.js.html b/doc/out/pixi_message.js.html index 4ca04e3..38287a9 100644 --- a/doc/out/pixi_message.js.html +++ b/doc/out/pixi_message.js.html @@ -1585,7 +1585,7 @@ export default class Message extends InteractivePopup { diff --git a/doc/out/pixi_modal.js.html b/doc/out/pixi_modal.js.html index 9824689..0cd78fd 100644 --- a/doc/out/pixi_modal.js.html +++ b/doc/out/pixi_modal.js.html @@ -1666,7 +1666,7 @@ export default class Modal extends PIXI.Container { diff --git a/doc/out/pixi_popup.js.html b/doc/out/pixi_popup.js.html index 28ab6a0..a87b858 100644 --- a/doc/out/pixi_popup.js.html +++ b/doc/out/pixi_popup.js.html @@ -1676,7 +1676,7 @@ export default class Popup extends InteractivePopup { diff --git a/doc/out/pixi_popupmenu.js.html b/doc/out/pixi_popupmenu.js.html index d081fab..386d3a7 100644 --- a/doc/out/pixi_popupmenu.js.html +++ b/doc/out/pixi_popupmenu.js.html @@ -1579,7 +1579,7 @@ export default class PopupMenu extends Popup { diff --git a/doc/out/pixi_progress.js.html b/doc/out/pixi_progress.js.html index c15fcdd..31697e6 100644 --- a/doc/out/pixi_progress.js.html +++ b/doc/out/pixi_progress.js.html @@ -1761,7 +1761,7 @@ export default class Progress extends PIXI.Container { diff --git a/doc/out/pixi_scrollview.js.html b/doc/out/pixi_scrollview.js.html index cdadd7b..f76ebfc 100644 --- a/doc/out/pixi_scrollview.js.html +++ b/doc/out/pixi_scrollview.js.html @@ -1520,7 +1520,7 @@ export default class Scrollview extends Scrollbox { diff --git a/doc/out/pixi_slider.js.html b/doc/out/pixi_slider.js.html index d984fc2..ef438c3 100644 --- a/doc/out/pixi_slider.js.html +++ b/doc/out/pixi_slider.js.html @@ -1925,7 +1925,7 @@ export default class Slider extends PIXI.Container { diff --git a/doc/out/pixi_switch.js.html b/doc/out/pixi_switch.js.html index 929cd5b..9bcbfbc 100644 --- a/doc/out/pixi_switch.js.html +++ b/doc/out/pixi_switch.js.html @@ -1979,7 +1979,7 @@ export default class Switch extends PIXI.Container { diff --git a/doc/out/pixi_theme.js.html b/doc/out/pixi_theme.js.html index c827ef4..446c2ee 100644 --- a/doc/out/pixi_theme.js.html +++ b/doc/out/pixi_theme.js.html @@ -1720,7 +1720,7 @@ export class ThemeRed extends Theme { diff --git a/doc/out/pixi_tooltip.js.html b/doc/out/pixi_tooltip.js.html index 9fe0462..e31ed30 100644 --- a/doc/out/pixi_tooltip.js.html +++ b/doc/out/pixi_tooltip.js.html @@ -1613,7 +1613,7 @@ export default class Tooltip extends AbstractPopup { diff --git a/doc/out/pixi_volatile.js.html b/doc/out/pixi_volatile.js.html index 1d30e2b..879319a 100644 --- a/doc/out/pixi_volatile.js.html +++ b/doc/out/pixi_volatile.js.html @@ -1617,7 +1617,7 @@ export default class Volatile { diff --git a/doc/out/uitest.js.html b/doc/out/uitest.js.html index f2aad5b..e585274 100644 --- a/doc/out/uitest.js.html +++ b/doc/out/uitest.js.html @@ -2468,7 +2468,7 @@ class Event { diff --git a/lib/pixi/button.js b/lib/pixi/button.js index f56a851..e414988 100644 --- a/lib/pixi/button.js +++ b/lib/pixi/button.js @@ -252,13 +252,11 @@ export default class Button extends PIXI.Container { 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 => { @@ -691,4 +689,12 @@ export default class Button extends PIXI.Container { this.icon.tint = value } } + + onEnd(event) { + this.capture(event) + TweenLite.to([this.button, this.content], this.theme.fast, { + alpha: 1, + overwrite: 'none' + }) + } } diff --git a/lib/pixi/buttongroup.html b/lib/pixi/buttongroup.html index cf7808f..3c5a786 100644 --- a/lib/pixi/buttongroup.html +++ b/lib/pixi/buttongroup.html @@ -10,7 +10,7 @@ - + @@ -303,12 +303,33 @@ const buttonGroup17 = new ButtonGroup({ app }) +const buttonGroup18 = new ButtonGroup({ + x: 10, + y: 1340, + buttons: [ + {label: 'move'}, + {label: 'explanation dried'}, + {label: 'out catch'}, + {label: 'late either'}, + {label: 'tell pour'}, + {label: 'willing apart airplane'}, + {label: 'high war'}, + {label: 'future struck'}, + {label: 'sense image'}, + {label: 'never'}, + {label: 'mark cloth'}, + {label: 'everywhere due large'} + ], + maxWidth: 500, + app +}) + app.scene.addChild(buttonGroup1, buttonGroup2, buttonGroup3) app.scene.addChild(buttonGroup4) app.scene.addChild(buttonGroup5, buttonGroup6) app.scene.addChild(buttonGroup7, buttonGroup8) app.scene.addChild(buttonGroup9, buttonGroup10, buttonGroup11, buttonGroup12, buttonGroup13) -app.scene.addChild(buttonGroup14, buttonGroup15, buttonGroup16, buttonGroup17) +app.scene.addChild(buttonGroup14, buttonGroup15, buttonGroup16, buttonGroup17, buttonGroup18) diff --git a/lib/pixi/buttongroup.js b/lib/pixi/buttongroup.js index cfee7cf..1c0f728 100644 --- a/lib/pixi/buttongroup.js +++ b/lib/pixi/buttongroup.js @@ -556,7 +556,7 @@ export default class ButtonGroup extends PIXI.Container { 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) { @@ -564,7 +564,7 @@ export default class ButtonGroup extends PIXI.Container { 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 } @@ -575,21 +575,30 @@ export default class ButtonGroup extends PIXI.Container { }) 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)) } @@ -604,7 +613,7 @@ export default class ButtonGroup extends PIXI.Container { 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) { @@ -612,7 +621,7 @@ export default class ButtonGroup extends PIXI.Container { 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 } @@ -623,21 +632,30 @@ export default class ButtonGroup extends PIXI.Container { }) 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)) } diff --git a/lib/popup.js b/lib/popup.js index e9fcdf3..9152563 100644 --- a/lib/popup.js +++ b/lib/popup.js @@ -1,3 +1,6 @@ +/* eslint-disable no-console */ +/* eslint-disable no-case-declarations */ +/* eslint-disable no-unused-vars */ import { Elements } from './utils.js' import Poppable from './poppable.js' @@ -181,6 +184,7 @@ export default class Popup extends Poppable { } for (let key in content) { + console.log('using', key, this.loaded) switch (key) { case 'selector': break @@ -289,7 +293,7 @@ export default class Popup extends Poppable { handleClose(e) { let closing = this.closingEvent(e) if (closing) { - this.close() + this.close(e) } else { this.setupCloseHandler() } @@ -417,11 +421,11 @@ export default class Popup extends Poppable { /** 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() }