diff --git a/dist/iwmlib.pixi.js b/dist/iwmlib.pixi.js index bad2580..cf723d0 100644 --- a/dist/iwmlib.pixi.js +++ b/dist/iwmlib.pixi.js @@ -2963,8 +2963,8 @@ * or a Theme object. * @param {number} [opts.minWidth=44] - Button: The minimum width of one button. * @param {number} [opts.minHeight=44] - Button: The minimum height of one button. - * @param {number} [opts.maxWidth] - The maximum width of the button group. If the buttons are wider than the maximum width, the buttons get stacked. Note: The buttons can only be stacked if margin is not zero. - * @param {number} [opts.maxHeight] - The maximum height of the button group. If the buttons are higher than the maximum height, the buttons get stacked. Note: The buttons can only be stacked if margin is not zero. + * @param {number} [opts.maxWidth] - The maximum width of the button group. If the buttons are wider than the maximum width, the buttons get stacked. Note: The buttons can only be stacked if margin is not zero. Note 2: Load the Greensock ThrowPropsPlugin for smoother animations. + * @param {number} [opts.maxHeight] - The maximum height of the button group. If the buttons are higher than the maximum height, the buttons get stacked. Note: The buttons can only be stacked if margin is not zero. Note 2: Load the Greensock ThrowPropsPlugin for smoother animations. * @param {number} [opts.stackPadding=10] - The padding for stacked buttons. * @param {PIXI.Application} [opts.app] - The PixiJS Application. Must be set if you want to use the mousewheel to scroll your button group. Only used when the buttons are stacked (with maxWidth or maxHeight). * @param {number} [opts.padding=Theme.padding] - Button: The inner spacing (distance from icon and/or label) the the border. @@ -3377,27 +3377,27 @@ this.capture(event); - if (typeof ThrowPropsPlugin != 'undefined') { - const throwProps = { x: { velocity: 'auto' }, y: { velocity: 'auto' } }; + const throwProps = { x: { velocity: 'auto' }, y: { velocity: 'auto' } }; - if (this.opts.orientation === 'horizontal') { - const distanceToLeft = this.container.x; - const distanceToRight = this.opts.maxWidth - this.container.x - this.__initWidth; - if (distanceToLeft > 0 && distanceToLeft > distanceToRight) { - throwProps.x.end = 0; - } else if (distanceToRight > 0 && distanceToRight > distanceToLeft) { - throwProps.x.end = this.opts.maxWidth - this.__initWidth; - } - } else { - const distanceToTop = this.container.y; - const distanceToBottom = this.opts.maxHeight - this.container.y - this.container.height; - if (distanceToTop > 0 && distanceToTop > distanceToBottom) { - throwProps.y.end = 0; - } else if (distanceToBottom > 0 && distanceToBottom > distanceToTop) { - throwProps.y.end = this.opts.maxHeight - this.container.height; - } + if (this.opts.orientation === 'horizontal') { + const distanceToLeft = this.container.x; + const distanceToRight = this.opts.maxWidth - this.container.x - this.__initWidth; + if (distanceToLeft > 0 && distanceToLeft > distanceToRight) { + throwProps.x.end = 0; + } else if (distanceToRight > 0 && distanceToRight > distanceToLeft) { + throwProps.x.end = this.opts.maxWidth - this.__initWidth; } + } else { + const distanceToTop = this.container.y; + const distanceToBottom = this.opts.maxHeight - this.container.y - this.container.height; + if (distanceToTop > 0 && distanceToTop > distanceToBottom) { + throwProps.y.end = 0; + } else if (distanceToBottom > 0 && distanceToBottom > distanceToTop) { + throwProps.y.end = this.opts.maxHeight - this.container.height; + } + } + if (typeof ThrowPropsPlugin != 'undefined') { ThrowPropsPlugin.to( this.container.position, { @@ -3409,6 +3409,12 @@ 0.8, 0.4 ); + } else { + if (this.opts.orientation === 'horizontal' && throwProps.x.end != null) { + TweenMax.to(this.container.position, 0.3, { x: throwProps.x.end, onUpdate: this.stack.bind(this) }); + } else if (this.opts.orientation === 'vertical' && throwProps.y.end != null) { + TweenMax.to(this.container.position, 0.3, { y: throwProps.y.end, onUpdate: this.stack.bind(this) }); + } } } } @@ -3462,7 +3468,7 @@ } /** - * + * */ _stackHorizontal() { const sorted = []; @@ -3510,7 +3516,7 @@ } /** - * + * */ _stackVertical() { const sorted = []; diff --git a/doc/out/AbstractPopup.html b/doc/out/AbstractPopup.html index 65bee4c..4081236 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 e06728b..e0f51c8 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 76687e8..bdffa14 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 3e591da..83d137e 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 a814cec..fb522b6 100644 --- a/doc/out/ButtonGroup.html +++ b/doc/out/ButtonGroup.html @@ -1848,7 +1848,7 @@ or a Theme object.

-

The maximum width of the button group. If the buttons are wider than the maximum width, the buttons get stacked. Note: The buttons can only be stacked if margin is not zero.

+

The maximum width of the button group. If the buttons are wider than the maximum width, the buttons get stacked. Note: The buttons can only be stacked if margin is not zero. Note 2: Load the Greensock ThrowPropsPlugin for smoother animations.

@@ -1882,7 +1882,7 @@ or a Theme object.

-

The maximum height of the button group. If the buttons are higher than the maximum height, the buttons get stacked. Note: The buttons can only be stacked if margin is not zero.

+

The maximum height of the button group. If the buttons are higher than the maximum height, the buttons get stacked. Note: The buttons can only be stacked if margin is not zero. Note 2: Load the Greensock ThrowPropsPlugin for smoother animations.

@@ -3035,7 +3035,7 @@ app.scene.addChild(buttonGroup)
- buttongroup.js:548 + buttongroup.js:554
@@ -3107,7 +3107,7 @@ app.scene.addChild(buttonGroup)
- buttongroup.js:596 + buttongroup.js:602
@@ -3179,7 +3179,7 @@ app.scene.addChild(buttonGroup)
- buttongroup.js:529 + buttongroup.js:535
@@ -3618,7 +3618,7 @@ app.scene.addChild(buttonGroup)
- buttongroup.js:537 + buttongroup.js:543
@@ -3692,7 +3692,7 @@ app.scene.addChild(buttonGroup) diff --git a/doc/out/DeepZoomImage.html b/doc/out/DeepZoomImage.html index 1b5bf7f..e62cd1a 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 8069471..eb97fdb 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 567f601..5400a8c 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 3654a21..34b7c78 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 055f47f..39ea437 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 8647183..bf37e4a 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 06ec4f3..0b2515f 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 62bdef4..b6f53e8 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 6628abd..0d817d8 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 6089231..fc59b49 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 d675731..57430af 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 219680f..aa6d5ab 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 c2f5ae7..d5a92fc 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 1adeae9..1dccd52 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 bd02cb8..b72513d 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 4ccdb83..8a58ca2 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 4b894a5..be17b52 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 38d7a7a..5aebad5 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 ddd86d9..9e9b315 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 fa20244..4f58817 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 07631b5..9133839 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 2da9747..3876b05 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 f31c36c..c559f6f 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 94eb07c..cf5e2d4 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 1c7005e..7150cfe 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 6bb8938..6b7dfba 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 7c6be84..2c3d4c5 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 7ee63f1..642d56e 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 0db9526..65df9e9 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 7d63242..28cf6c4 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 3d5dab8..22fed3f 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 e75e62d..c9053f6 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 232acad..3cfcc86 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 c63bcbb..f0df52e 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 27a3357..31043c0 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 670f16a..991d9d9 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 ed3a093..bfa15b9 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 36da43f..b78172c 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 f6166f5..a5b42e3 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 47e828f..39e6760 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 6a368a5..ad17078 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 6f6adef..b58ecac 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 9d8d6d5..7093a67 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 6b75adf..b9207de 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 3fa826b..2a0e6c8 100644 --- a/doc/out/pixi_buttongroup.js.html +++ b/doc/out/pixi_buttongroup.js.html @@ -1490,8 +1490,8 @@ export default class ButtonGroup extends PIXI.Container { * or a Theme object. * @param {number} [opts.minWidth=44] - Button: The minimum width of one button. * @param {number} [opts.minHeight=44] - Button: The minimum height of one button. - * @param {number} [opts.maxWidth] - The maximum width of the button group. If the buttons are wider than the maximum width, the buttons get stacked. Note: The buttons can only be stacked if margin is not zero. - * @param {number} [opts.maxHeight] - The maximum height of the button group. If the buttons are higher than the maximum height, the buttons get stacked. Note: The buttons can only be stacked if margin is not zero. + * @param {number} [opts.maxWidth] - The maximum width of the button group. If the buttons are wider than the maximum width, the buttons get stacked. Note: The buttons can only be stacked if margin is not zero. Note 2: Load the Greensock ThrowPropsPlugin for smoother animations. + * @param {number} [opts.maxHeight] - The maximum height of the button group. If the buttons are higher than the maximum height, the buttons get stacked. Note: The buttons can only be stacked if margin is not zero. Note 2: Load the Greensock ThrowPropsPlugin for smoother animations. * @param {number} [opts.stackPadding=10] - The padding for stacked buttons. * @param {PIXI.Application} [opts.app] - The PixiJS Application. Must be set if you want to use the mousewheel to scroll your button group. Only used when the buttons are stacked (with maxWidth or maxHeight). * @param {number} [opts.padding=Theme.padding] - Button: The inner spacing (distance from icon and/or label) the the border. @@ -1904,27 +1904,27 @@ export default class ButtonGroup extends PIXI.Container { this.capture(event) - if (typeof ThrowPropsPlugin != 'undefined') { - const throwProps = { x: { velocity: 'auto' }, y: { velocity: 'auto' } } + const throwProps = { x: { velocity: 'auto' }, y: { velocity: 'auto' } } - if (this.opts.orientation === 'horizontal') { - const distanceToLeft = this.container.x - const distanceToRight = this.opts.maxWidth - this.container.x - this.__initWidth - if (distanceToLeft > 0 && distanceToLeft > distanceToRight) { - throwProps.x.end = 0 - } else if (distanceToRight > 0 && distanceToRight > distanceToLeft) { - throwProps.x.end = this.opts.maxWidth - this.__initWidth - } - } else { - const distanceToTop = this.container.y - const distanceToBottom = this.opts.maxHeight - this.container.y - this.container.height - if (distanceToTop > 0 && distanceToTop > distanceToBottom) { - throwProps.y.end = 0 - } else if (distanceToBottom > 0 && distanceToBottom > distanceToTop) { - throwProps.y.end = this.opts.maxHeight - this.container.height - } + if (this.opts.orientation === 'horizontal') { + const distanceToLeft = this.container.x + const distanceToRight = this.opts.maxWidth - this.container.x - this.__initWidth + if (distanceToLeft > 0 && distanceToLeft > distanceToRight) { + throwProps.x.end = 0 + } else if (distanceToRight > 0 && distanceToRight > distanceToLeft) { + throwProps.x.end = this.opts.maxWidth - this.__initWidth } + } else { + const distanceToTop = this.container.y + const distanceToBottom = this.opts.maxHeight - this.container.y - this.container.height + if (distanceToTop > 0 && distanceToTop > distanceToBottom) { + throwProps.y.end = 0 + } else if (distanceToBottom > 0 && distanceToBottom > distanceToTop) { + throwProps.y.end = this.opts.maxHeight - this.container.height + } + } + if (typeof ThrowPropsPlugin != 'undefined') { ThrowPropsPlugin.to( this.container.position, { @@ -1936,6 +1936,12 @@ export default class ButtonGroup extends PIXI.Container { 0.8, 0.4 ) + } else { + if (this.opts.orientation === 'horizontal' && throwProps.x.end != null) { + TweenMax.to(this.container.position, 0.3, { x: throwProps.x.end, onUpdate: this.stack.bind(this) }) + } else if (this.opts.orientation === 'vertical' && throwProps.y.end != null) { + TweenMax.to(this.container.position, 0.3, { y: throwProps.y.end, onUpdate: this.stack.bind(this) }) + } } } } @@ -1989,7 +1995,7 @@ export default class ButtonGroup extends PIXI.Container { } /** - * + * */ _stackHorizontal() { const sorted = [] @@ -2037,7 +2043,7 @@ export default class ButtonGroup extends PIXI.Container { } /** - * + * */ _stackVertical() { const sorted = [] @@ -2097,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 7725d62..9ed5198 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 04edcff..d1d6b59 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 876c1b4..28a3a8d 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 6a9da03..0de4e9c 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 85dba6e..4ca04e3 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 e1f9533..9824689 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 b68a814..28ab6a0 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 b9cad48..d081fab 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 c6e4f88..c15fcdd 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 c7ee1a9..cdadd7b 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 a99f25d..d984fc2 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 83f28c5..929cd5b 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 709ff9a..c827ef4 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 7568c05..9fe0462 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 41a1a2c..1d30e2b 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 0cb2ca0..f2aad5b 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..cf7808f 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 0ee8f79..cfee7cf 100644 --- a/lib/pixi/buttongroup.js +++ b/lib/pixi/buttongroup.js @@ -42,8 +42,8 @@ export default class ButtonGroup extends PIXI.Container { * or a Theme object. * @param {number} [opts.minWidth=44] - Button: The minimum width of one button. * @param {number} [opts.minHeight=44] - Button: The minimum height of one button. - * @param {number} [opts.maxWidth] - The maximum width of the button group. If the buttons are wider than the maximum width, the buttons get stacked. Note: The buttons can only be stacked if margin is not zero. - * @param {number} [opts.maxHeight] - The maximum height of the button group. If the buttons are higher than the maximum height, the buttons get stacked. Note: The buttons can only be stacked if margin is not zero. + * @param {number} [opts.maxWidth] - The maximum width of the button group. If the buttons are wider than the maximum width, the buttons get stacked. Note: The buttons can only be stacked if margin is not zero. Note 2: Load the Greensock ThrowPropsPlugin for smoother animations. + * @param {number} [opts.maxHeight] - The maximum height of the button group. If the buttons are higher than the maximum height, the buttons get stacked. Note: The buttons can only be stacked if margin is not zero. Note 2: Load the Greensock ThrowPropsPlugin for smoother animations. * @param {number} [opts.stackPadding=10] - The padding for stacked buttons. * @param {PIXI.Application} [opts.app] - The PixiJS Application. Must be set if you want to use the mousewheel to scroll your button group. Only used when the buttons are stacked (with maxWidth or maxHeight). * @param {number} [opts.padding=Theme.padding] - Button: The inner spacing (distance from icon and/or label) the the border. @@ -456,27 +456,27 @@ export default class ButtonGroup extends PIXI.Container { this.capture(event) - if (typeof ThrowPropsPlugin != 'undefined') { - const throwProps = { x: { velocity: 'auto' }, y: { velocity: 'auto' } } + const throwProps = { x: { velocity: 'auto' }, y: { velocity: 'auto' } } - if (this.opts.orientation === 'horizontal') { - const distanceToLeft = this.container.x - const distanceToRight = this.opts.maxWidth - this.container.x - this.__initWidth - if (distanceToLeft > 0 && distanceToLeft > distanceToRight) { - throwProps.x.end = 0 - } else if (distanceToRight > 0 && distanceToRight > distanceToLeft) { - throwProps.x.end = this.opts.maxWidth - this.__initWidth - } - } else { - const distanceToTop = this.container.y - const distanceToBottom = this.opts.maxHeight - this.container.y - this.container.height - if (distanceToTop > 0 && distanceToTop > distanceToBottom) { - throwProps.y.end = 0 - } else if (distanceToBottom > 0 && distanceToBottom > distanceToTop) { - throwProps.y.end = this.opts.maxHeight - this.container.height - } + if (this.opts.orientation === 'horizontal') { + const distanceToLeft = this.container.x + const distanceToRight = this.opts.maxWidth - this.container.x - this.__initWidth + if (distanceToLeft > 0 && distanceToLeft > distanceToRight) { + throwProps.x.end = 0 + } else if (distanceToRight > 0 && distanceToRight > distanceToLeft) { + throwProps.x.end = this.opts.maxWidth - this.__initWidth } + } else { + const distanceToTop = this.container.y + const distanceToBottom = this.opts.maxHeight - this.container.y - this.container.height + if (distanceToTop > 0 && distanceToTop > distanceToBottom) { + throwProps.y.end = 0 + } else if (distanceToBottom > 0 && distanceToBottom > distanceToTop) { + throwProps.y.end = this.opts.maxHeight - this.container.height + } + } + if (typeof ThrowPropsPlugin != 'undefined') { ThrowPropsPlugin.to( this.container.position, { @@ -488,6 +488,12 @@ export default class ButtonGroup extends PIXI.Container { 0.8, 0.4 ) + } else { + if (this.opts.orientation === 'horizontal' && throwProps.x.end != null) { + TweenMax.to(this.container.position, 0.3, { x: throwProps.x.end, onUpdate: this.stack.bind(this) }) + } else if (this.opts.orientation === 'vertical' && throwProps.y.end != null) { + TweenMax.to(this.container.position, 0.3, { y: throwProps.y.end, onUpdate: this.stack.bind(this) }) + } } } }