Prevent dragging of button group if buttons are not wider than maxWidth.
This commit is contained in:
parent
56910a8c58
commit
cdc6461064
6
dist/iwmlib.pixi.js
vendored
6
dist/iwmlib.pixi.js
vendored
@ -3378,6 +3378,8 @@
|
|||||||
* @param {*} event
|
* @param {*} event
|
||||||
*/
|
*/
|
||||||
onStart(event) {
|
onStart(event) {
|
||||||
|
|
||||||
|
if ((this.opts.maxWidth != null && this.__initWidth > this.opts.maxWidth) || (this.opts.maxHeight != null && this.__initHeight > this.opts.maxHeight)) {
|
||||||
this.__dragging = true;
|
this.__dragging = true;
|
||||||
|
|
||||||
this.capture(event);
|
this.capture(event);
|
||||||
@ -3392,6 +3394,7 @@
|
|||||||
ThrowPropsPlugin.track(this.container.position, 'x,y');
|
ThrowPropsPlugin.track(this.container.position, 'x,y');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -3484,6 +3487,8 @@
|
|||||||
* @param {*} event
|
* @param {*} event
|
||||||
*/
|
*/
|
||||||
onScroll(event) {
|
onScroll(event) {
|
||||||
|
|
||||||
|
if ((this.opts.maxWidth != null && this.__initWidth > this.opts.maxWidth) || (this.opts.maxHeight != null && this.__initHeight > this.opts.maxHeight)) {
|
||||||
this.capture(event);
|
this.capture(event);
|
||||||
|
|
||||||
if (this.opts.orientation === 'horizontal') {
|
if (this.opts.orientation === 'horizontal') {
|
||||||
@ -3504,6 +3509,7 @@
|
|||||||
|
|
||||||
this.stack();
|
this.stack();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Captures an event to inform InteractionMapper about processed events.
|
* Captures an event to inform InteractionMapper about processed events.
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
const app = new PIXIApp({
|
const app = new PIXIApp({
|
||||||
view: canvas,
|
view: canvas,
|
||||||
width: 1000,
|
width: 1000,
|
||||||
height: 1400
|
height: 1700
|
||||||
}).setup().run()
|
}).setup().run()
|
||||||
|
|
||||||
const buttonGroup1 = new ButtonGroup({
|
const buttonGroup1 = new ButtonGroup({
|
||||||
@ -324,12 +324,24 @@ const buttonGroup18 = new ButtonGroup({
|
|||||||
app
|
app
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const buttonGroup19 = new ButtonGroup({
|
||||||
|
x: 10,
|
||||||
|
y: 1420,
|
||||||
|
buttons: [
|
||||||
|
{label: 'move'},
|
||||||
|
{label: 'explanation dried'},
|
||||||
|
{label: 'out catch'}
|
||||||
|
],
|
||||||
|
maxWidth: 500,
|
||||||
|
app
|
||||||
|
})
|
||||||
|
|
||||||
app.scene.addChild(buttonGroup1, buttonGroup2, buttonGroup3)
|
app.scene.addChild(buttonGroup1, buttonGroup2, buttonGroup3)
|
||||||
app.scene.addChild(buttonGroup4)
|
app.scene.addChild(buttonGroup4)
|
||||||
app.scene.addChild(buttonGroup5, buttonGroup6)
|
app.scene.addChild(buttonGroup5, buttonGroup6)
|
||||||
app.scene.addChild(buttonGroup7, buttonGroup8)
|
app.scene.addChild(buttonGroup7, buttonGroup8)
|
||||||
app.scene.addChild(buttonGroup9, buttonGroup10, buttonGroup11, buttonGroup12, buttonGroup13)
|
app.scene.addChild(buttonGroup9, buttonGroup10, buttonGroup11, buttonGroup12, buttonGroup13)
|
||||||
app.scene.addChild(buttonGroup14, buttonGroup15, buttonGroup16, buttonGroup17, buttonGroup18)
|
app.scene.addChild(buttonGroup14, buttonGroup15, buttonGroup16, buttonGroup17, buttonGroup18, buttonGroup19)
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -440,6 +440,8 @@ export default class ButtonGroup extends PIXI.Container {
|
|||||||
* @param {*} event
|
* @param {*} event
|
||||||
*/
|
*/
|
||||||
onStart(event) {
|
onStart(event) {
|
||||||
|
|
||||||
|
if ((this.opts.maxWidth != null && this.__initWidth > this.opts.maxWidth) || (this.opts.maxHeight != null && this.__initHeight > this.opts.maxHeight)) {
|
||||||
this.__dragging = true
|
this.__dragging = true
|
||||||
|
|
||||||
this.capture(event)
|
this.capture(event)
|
||||||
@ -454,6 +456,7 @@ export default class ButtonGroup extends PIXI.Container {
|
|||||||
ThrowPropsPlugin.track(this.container.position, 'x,y')
|
ThrowPropsPlugin.track(this.container.position, 'x,y')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -546,6 +549,8 @@ export default class ButtonGroup extends PIXI.Container {
|
|||||||
* @param {*} event
|
* @param {*} event
|
||||||
*/
|
*/
|
||||||
onScroll(event) {
|
onScroll(event) {
|
||||||
|
|
||||||
|
if ((this.opts.maxWidth != null && this.__initWidth > this.opts.maxWidth) || (this.opts.maxHeight != null && this.__initHeight > this.opts.maxHeight)) {
|
||||||
this.capture(event)
|
this.capture(event)
|
||||||
|
|
||||||
if (this.opts.orientation === 'horizontal') {
|
if (this.opts.orientation === 'horizontal') {
|
||||||
@ -566,6 +571,7 @@ export default class ButtonGroup extends PIXI.Container {
|
|||||||
|
|
||||||
this.stack()
|
this.stack()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Captures an event to inform InteractionMapper about processed events.
|
* Captures an event to inform InteractionMapper about processed events.
|
||||||
|
Loading…
Reference in New Issue
Block a user