From b1f0f173e736a2d33faf3b206dde4bddd180a297 Mon Sep 17 00:00:00 2001 From: Sebastian Kupke Date: Thu, 1 Aug 2019 10:31:05 +0200 Subject: [PATCH 1/4] Fixed bug with stacked buttons in a button group with badges. --- dist/iwmlib.pixi.js | 12 ++++++------ doc/out/AbstractPopup.html | 2 +- doc/out/Badge.html | 2 +- doc/out/BlurFilter.html | 2 +- doc/out/Button.html | 2 +- doc/out/ButtonGroup.html | 2 +- doc/out/DeepZoomImage.html | 2 +- doc/out/DeepZoomInfo.html | 2 +- doc/out/Flippable.html | 2 +- doc/out/FontInfo.html | 2 +- doc/out/Hypenate.html | 2 +- doc/out/InteractivePopup.html | 2 +- .../LabeledGraphics.exports.LabeledGraphics.html | 2 +- doc/out/LabeledGraphics.html | 2 +- doc/out/List.html | 2 +- doc/out/Message.html | 2 +- doc/out/MessageInteractivePopup.html | 2 +- doc/out/MessageMessageInteractivePopup.html | 2 +- doc/out/Modal.html | 2 +- doc/out/ModalInteractivePopup.html | 2 +- doc/out/ModalModalInteractivePopup.html | 2 +- doc/out/PIXIApp.html | 2 +- doc/out/Popup.html | 2 +- doc/out/PopupInteractivePopup.html | 2 +- doc/out/PopupMenu.html | 2 +- doc/out/PopupMenuPopupInteractivePopup.html | 2 +- .../PopupMenuPopupMenuPopupInteractivePopup.html | 2 +- ...pupMenuPopupMenuPopupPopupInteractivePopup.html | 2 +- doc/out/PopupMenuPopupPopupInteractivePopup.html | 2 +- doc/out/PopupPopupInteractivePopup.html | 2 +- doc/out/Progress.html | 2 +- doc/out/Scrollview.html | 2 +- doc/out/Slider.html | 2 +- doc/out/Switch.html | 2 +- doc/out/TextLabel.TextLabel.html | 2 +- doc/out/Theme.html | 2 +- doc/out/ThemeDark.html | 2 +- doc/out/ThemeLight.html | 2 +- doc/out/ThemeRed.html | 2 +- doc/out/TileQuadNode.html | 2 +- doc/out/Tooltip.html | 2 +- doc/out/UITest.html | 2 +- doc/out/Volatile.html | 2 +- doc/out/global.html | 2 +- doc/out/index.html | 2 +- doc/out/pixi_abstractpopup.js.html | 2 +- doc/out/pixi_app.js.html | 2 +- doc/out/pixi_badge.js.html | 2 +- doc/out/pixi_blurfilter.js.html | 2 +- doc/out/pixi_button.js.html | 2 +- doc/out/pixi_buttongroup.js.html | 14 +++++++------- doc/out/pixi_deepzoom_image.js.html | 2 +- doc/out/pixi_flippable.js.html | 2 +- doc/out/pixi_labeledgraphics.js.html | 2 +- doc/out/pixi_list.js.html | 2 +- doc/out/pixi_message.js.html | 2 +- doc/out/pixi_modal.js.html | 2 +- doc/out/pixi_popup.js.html | 2 +- doc/out/pixi_popupmenu.js.html | 2 +- doc/out/pixi_progress.js.html | 2 +- doc/out/pixi_scrollview.js.html | 2 +- doc/out/pixi_slider.js.html | 2 +- doc/out/pixi_switch.js.html | 2 +- doc/out/pixi_theme.js.html | 2 +- doc/out/pixi_tooltip.js.html | 2 +- doc/out/pixi_volatile.js.html | 2 +- doc/out/uitest.js.html | 2 +- lib/pixi/buttongroup.html | 2 +- lib/pixi/buttongroup.js | 12 ++++++------ 69 files changed, 85 insertions(+), 85 deletions(-) diff --git a/dist/iwmlib.pixi.js b/dist/iwmlib.pixi.js index cf723d0..b172daa 100644 --- a/dist/iwmlib.pixi.js +++ b/dist/iwmlib.pixi.js @@ -3477,7 +3477,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 +3485,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,7 +3496,7 @@ }); 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 @@ -3525,7 +3525,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 +3533,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,7 +3544,7 @@ }); 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 diff --git a/doc/out/AbstractPopup.html b/doc/out/AbstractPopup.html index 4081236..36edcba 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..8ebe070 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..97bfd82 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..b0ca13c 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..f051f1a 100644 --- a/doc/out/ButtonGroup.html +++ b/doc/out/ButtonGroup.html @@ -3692,7 +3692,7 @@ app.scene.addChild(buttonGroup) diff --git a/doc/out/DeepZoomImage.html b/doc/out/DeepZoomImage.html index e62cd1a..179e06b 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..2433ff4 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..188504e 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..a1f086b 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..e544a34 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..c310cd5 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..bf71bbc 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..81270b7 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..b561118 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..6387fc2 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..c8c77a5 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..6a9f109 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..cc321ed 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..a45a194 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..b1ca8cb 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..433900e 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..4cbc968 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..4a54afe 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..b4d92dc 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..1c78dff 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..3f2d007 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..8f5a7cf 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..d9f8e47 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..074ae22 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..ebaed92 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..30b9589 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..d9115e2 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..bbdfc6e 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..a3c69d1 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..aa87533 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..3bc0ba5 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..a28f73e 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..7973730 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..f9a246e 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..ee4a325 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..f3cae66 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..499b324 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..cd78fc0 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..c28271b 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..c058bc9 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..1a4def3 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..f26bae8 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..4662a3a 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..774da58 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..ddd859d 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,7 +2023,7 @@ 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 @@ -2052,7 +2052,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 +2060,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,7 +2071,7 @@ 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 @@ -2103,7 +2103,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..cf42d7f 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..2c0699d 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..d8055ad 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..cb1e124 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..b047784 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..a9ef14d 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..f22c6ca 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..739f6be 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..a7b94df 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..508015f 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..8d518b1 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..36e298a 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..d21be7c 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..3017945 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..76b6af3 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..78efbc8 100644 --- a/doc/out/uitest.js.html +++ b/doc/out/uitest.js.html @@ -2468,7 +2468,7 @@ class Event { diff --git a/lib/pixi/buttongroup.html b/lib/pixi/buttongroup.html index cf7808f..233061b 100644 --- a/lib/pixi/buttongroup.html +++ b/lib/pixi/buttongroup.html @@ -10,7 +10,7 @@ - + diff --git a/lib/pixi/buttongroup.js b/lib/pixi/buttongroup.js index cfee7cf..e5a8824 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,7 +575,7 @@ 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 @@ -604,7 +604,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 +612,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,7 +623,7 @@ 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 From 32087608cc1a631d73f458ad705016314c86c2f0 Mon Sep 17 00:00:00 2001 From: Sebastian Kupke Date: Thu, 1 Aug 2019 11:26:22 +0200 Subject: [PATCH 2/4] Improved button group stack sorting. --- dist/iwmlib.pixi.js | 50 ++++++++++++------ doc/out/AbstractPopup.html | 2 +- doc/out/Badge.html | 2 +- doc/out/BlurFilter.html | 2 +- doc/out/Button.html | 2 +- doc/out/ButtonGroup.html | 4 +- doc/out/DeepZoomImage.html | 2 +- doc/out/DeepZoomInfo.html | 2 +- doc/out/Flippable.html | 2 +- doc/out/FontInfo.html | 2 +- doc/out/Hypenate.html | 2 +- doc/out/InteractivePopup.html | 2 +- ...beledGraphics.exports.LabeledGraphics.html | 2 +- doc/out/LabeledGraphics.html | 2 +- doc/out/List.html | 2 +- doc/out/Message.html | 2 +- doc/out/MessageInteractivePopup.html | 2 +- doc/out/MessageMessageInteractivePopup.html | 2 +- doc/out/Modal.html | 2 +- doc/out/ModalInteractivePopup.html | 2 +- doc/out/ModalModalInteractivePopup.html | 2 +- doc/out/PIXIApp.html | 2 +- doc/out/Popup.html | 2 +- doc/out/PopupInteractivePopup.html | 2 +- doc/out/PopupMenu.html | 2 +- doc/out/PopupMenuPopupInteractivePopup.html | 2 +- ...pupMenuPopupMenuPopupInteractivePopup.html | 2 +- ...nuPopupMenuPopupPopupInteractivePopup.html | 2 +- .../PopupMenuPopupPopupInteractivePopup.html | 2 +- doc/out/PopupPopupInteractivePopup.html | 2 +- doc/out/Progress.html | 2 +- doc/out/Scrollview.html | 2 +- doc/out/Slider.html | 2 +- doc/out/Switch.html | 2 +- doc/out/TextLabel.TextLabel.html | 2 +- doc/out/Theme.html | 2 +- doc/out/ThemeDark.html | 2 +- doc/out/ThemeLight.html | 2 +- doc/out/ThemeRed.html | 2 +- doc/out/TileQuadNode.html | 2 +- doc/out/Tooltip.html | 2 +- doc/out/UITest.html | 2 +- doc/out/Volatile.html | 2 +- doc/out/global.html | 2 +- doc/out/index.html | 2 +- doc/out/pixi_abstractpopup.js.html | 2 +- doc/out/pixi_app.js.html | 2 +- doc/out/pixi_badge.js.html | 2 +- doc/out/pixi_blurfilter.js.html | 2 +- doc/out/pixi_button.js.html | 2 +- doc/out/pixi_buttongroup.js.html | 52 +++++++++++++------ doc/out/pixi_deepzoom_image.js.html | 2 +- doc/out/pixi_flippable.js.html | 2 +- doc/out/pixi_labeledgraphics.js.html | 2 +- doc/out/pixi_list.js.html | 2 +- doc/out/pixi_message.js.html | 2 +- doc/out/pixi_modal.js.html | 2 +- doc/out/pixi_popup.js.html | 2 +- doc/out/pixi_popupmenu.js.html | 2 +- doc/out/pixi_progress.js.html | 2 +- doc/out/pixi_scrollview.js.html | 2 +- doc/out/pixi_slider.js.html | 2 +- doc/out/pixi_switch.js.html | 2 +- doc/out/pixi_theme.js.html | 2 +- doc/out/pixi_tooltip.js.html | 2 +- doc/out/pixi_volatile.js.html | 2 +- doc/out/uitest.js.html | 2 +- lib/pixi/buttongroup.html | 23 +++++++- lib/pixi/buttongroup.js | 50 ++++++++++++------ 69 files changed, 191 insertions(+), 116 deletions(-) diff --git a/dist/iwmlib.pixi.js b/dist/iwmlib.pixi.js index b172daa..83f6fdd 100644 --- a/dist/iwmlib.pixi.js +++ b/dist/iwmlib.pixi.js @@ -3502,15 +3502,24 @@ // 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)); } @@ -3550,15 +3559,24 @@ // 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 36edcba..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 8ebe070..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 97bfd82..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 b0ca13c..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 f051f1a..7d63851 100644 --- a/doc/out/ButtonGroup.html +++ b/doc/out/ButtonGroup.html @@ -3107,7 +3107,7 @@ app.scene.addChild(buttonGroup) @@ -3692,7 +3692,7 @@ app.scene.addChild(buttonGroup)
diff --git a/doc/out/DeepZoomImage.html b/doc/out/DeepZoomImage.html index 179e06b..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 2433ff4..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 188504e..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 a1f086b..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 e544a34..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 c310cd5..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 bf71bbc..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 81270b7..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 b561118..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 6387fc2..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 c8c77a5..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 6a9f109..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 cc321ed..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 a45a194..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 b1ca8cb..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 433900e..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 4cbc968..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 4a54afe..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 b4d92dc..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 1c78dff..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 3f2d007..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 8f5a7cf..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 d9f8e47..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 074ae22..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 ebaed92..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 30b9589..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 d9115e2..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 bbdfc6e..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 a3c69d1..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 aa87533..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 3bc0ba5..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 a28f73e..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 7973730..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 f9a246e..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 ee4a325..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 f3cae66..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 499b324..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 cd78fc0..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 c28271b..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 c058bc9..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 1a4def3..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 f26bae8..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 4662a3a..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 774da58..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 ddd859d..945ebeb 100644 --- a/doc/out/pixi_buttongroup.js.html +++ b/doc/out/pixi_buttongroup.js.html @@ -2029,15 +2029,24 @@ export default class ButtonGroup extends PIXI.Container { // 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)) } @@ -2077,15 +2086,24 @@ export default class ButtonGroup extends PIXI.Container { // 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 cf42d7f..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 2c0699d..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 d8055ad..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 cb1e124..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 b047784..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 a9ef14d..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 f22c6ca..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 739f6be..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 a7b94df..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 508015f..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 8d518b1..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 36e298a..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 d21be7c..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 3017945..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 76b6af3..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 78efbc8..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/buttongroup.html b/lib/pixi/buttongroup.html index 233061b..3c5a786 100644 --- a/lib/pixi/buttongroup.html +++ b/lib/pixi/buttongroup.html @@ -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 e5a8824..1c0f728 100644 --- a/lib/pixi/buttongroup.js +++ b/lib/pixi/buttongroup.js @@ -581,15 +581,24 @@ export default class ButtonGroup extends PIXI.Container { // 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)) } @@ -629,15 +638,24 @@ export default class ButtonGroup extends PIXI.Container { // 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)) } From 1e3f66bb195dd2aff3bfbf9ea139f6072a4659e5 Mon Sep 17 00:00:00 2001 From: Sebastian Kupke Date: Thu, 1 Aug 2019 14:27:04 +0200 Subject: [PATCH 3/4] Fixed button hover bug. --- dist/iwmlib.pixi.js | 20 +++++++++++++------- lib/pixi/button.js | 20 +++++++++++++------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/dist/iwmlib.pixi.js b/dist/iwmlib.pixi.js index 83f6fdd..b6dbb3c 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 */ 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' + }) + } } From db2badfc0d45a98b642b1448da82a40cb64b5188 Mon Sep 17 00:00:00 2001 From: Uwe Oestermeier Date: Thu, 1 Aug 2019 19:30:07 +0200 Subject: [PATCH 4/4] Added event parameter, --- css/highlight.css | 2 -- dist/iwmlib.js | 44 ++++++++++++++++++++++++++------------------ dist/iwmlib.pixi.js | 4 ++++ lib/popup.js | 10 +++++++--- 4 files changed, 37 insertions(+), 23 deletions(-) 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 b000db8..8242442 100644 --- a/dist/iwmlib.js +++ b/dist/iwmlib.js @@ -2621,6 +2621,8 @@ onMouseWheel(event) { if (this.capture(event) && this.target.onMouseWheel) { this.target.onMouseWheel(event); + } else { + //console.warn('Target has no onMouseWheel callback') } } @@ -2830,6 +2832,8 @@ } if (this.target.onMouseWheel) { this.target.onMouseWheel(event); + } else { + //console.warn('Target has no onMouseWheel callback', this.target) } } } @@ -5464,6 +5468,8 @@ Poppable.registrations = new Map(); + /* eslint-disable no-console */ + /** A Popup that shows text labels, images, or html */ class Popup$1 extends Poppable { @@ -5645,6 +5651,7 @@ } for (let key in content) { + console.log('using', key, this.loaded); switch (key) { case 'selector': break @@ -5756,7 +5763,7 @@ handleClose(e) { let closing = this.closingEvent(e); if (closing) { - this.close(); + this.close(e); } else { this.setupCloseHandler(); } @@ -5886,11 +5893,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(); } @@ -7984,6 +7991,8 @@ /** To avoid problems with relative URL paths, we use inline data URI to load svg icons. */ + const enableNearestNeighborTaps = false; + /** * A class that collects static methods to maintain the states and parts of * EyeVisit like cards. @@ -9452,6 +9461,16 @@ if (this.dynamicHeight) { article.appendChild(iconClone); } + + if (enableNearestNeighborTaps) { + //look for nearby popups on tap + InteractionMapper.on('tap', indexbox, () => { + console.log('Tap handler called', editable); + if (!editable) { + this.findNearbyPopups(event, card); + } + }); + } // Use the 'tap' event for closing. // Otherwise the subcard cannot be closed, // when another subcard is touched. @@ -10137,7 +10156,6 @@ } /* eslint-disable no-console */ - /* global TweenLite */ let _HighlightEnabled = true; let _CircleIds = 0; @@ -10356,14 +10374,14 @@ return } let image = svgRoot.querySelector('image'); - + // eslint-disable-next-line no-unused-vars let [mask, maskImage] = Highlight$1._getSVGMask(target, { svgRoot, image }); let center = Highlight$1._calculateCenterRelativeTo(target, image); - console.log("_calculateCenterRelativeTo", center); + console.log('_calculateCenterRelativeTo', center); TweenLite.set(maskImage, { transformOrigin: `${center.x} ${center.y}` }); @@ -10379,7 +10397,7 @@ } static toggleHighlight(node) { - console.log("toggleHighlight", Highlight$1._isExpanded(node)); + console.log('toggleHighlight', Highlight$1._isExpanded(node)); if (Highlight$1._isExpanded(node)) { Highlight$1.closeHighlight(node); } else { @@ -10506,18 +10524,8 @@ return target.classList.contains(Highlight$1.expandedClass) } - static _setExpanded(target) { - target.classList.add(Highlight$1.expandedClass); - } - - static _notExpanded(target) { - target.classList.remove(Highlight$1.expandedClass); - } - static closeHighlight(target, { animation = 0.5 } = {}) { - - Highlight$1._notExpanded(target); - + target.classList.remove(Highlight$1.expandedClass); // eslint-disable-next-line no-unused-vars let [mask, maskImage] = Highlight$1._getSVGMask(target); console.log('Close Highlight', maskImage); diff --git a/dist/iwmlib.pixi.js b/dist/iwmlib.pixi.js index 96f3428..6e0ee75 100644 --- a/dist/iwmlib.pixi.js +++ b/dist/iwmlib.pixi.js @@ -6042,6 +6042,8 @@ onMouseWheel(event) { if (this.capture(event) && this.target.onMouseWheel) { this.target.onMouseWheel(event); + } else { + //console.warn('Target has no onMouseWheel callback') } } @@ -6251,6 +6253,8 @@ } if (this.target.onMouseWheel) { this.target.onMouseWheel(event); + } else { + //console.warn('Target has no onMouseWheel callback', this.target) } } } diff --git a/lib/popup.js b/lib/popup.js index b80f04e..1bd6489 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' @@ -182,6 +185,7 @@ export default class Popup extends Poppable { } for (let key in content) { + console.log('using', key, this.loaded) switch (key) { case 'selector': break @@ -293,7 +297,7 @@ export default class Popup extends Poppable { handleClose(e) { let closing = this.closingEvent(e) if (closing) { - this.close() + this.close(e) } else { this.setupCloseHandler() } @@ -423,11 +427,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() }