Fixed bug with stacked buttons in a button group with badges.
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
|
||||
<script src="../3rdparty/highlight/highlight.pack.js"></script>
|
||||
<script src="../../dist/iwmlib.3rdparty.js"></script>
|
||||
<!-- <script src="../3rdparty/gsap/src/uncompressed/plugins/ThrowPropsPlugin.js"></script> -->
|
||||
<script src="../3rdparty/gsap/src/uncompressed/plugins/ThrowPropsPlugin.js"></script>
|
||||
|
||||
<script src="../../dist/iwmlib.js"></script>
|
||||
<script src="../../dist/iwmlib.pixi.js"></script>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user