Working on stacked buttons.

This commit is contained in:
2019-07-30 16:56:29 +02:00
parent 0bcf931465
commit 5f46b4feae
115 changed files with 3277 additions and 5134 deletions
+10 -34
View File
@@ -79,12 +79,8 @@ export class ScatterContainer extends PIXI.Graphics {
let y = 0
// @container: We need to call the constant values, as the container
// gets resized, when a child moves outside the original boundaries.
let w = this.container
? this.containerDimensions.x
: this.backgroundWidth || this.app.width
let h = this.container
? this.containerDimensions.y
: this.backgroundHeight || this.app.height
let w = this.container ? this.containerDimensions.x : this.backgroundWidth || this.app.width
let h = this.container ? this.containerDimensions.y : this.backgroundHeight || this.app.height
if (this.app.fullscreen && this.app.monkeyPatchMapping) {
let fixed = this.mapPositionToPoint({ x: w, y: 0 })
@@ -167,14 +163,8 @@ export class ScatterContainer extends PIXI.Graphics {
// if (hit) {
// console.log("findHitScatter", displayObject)
// }
if (
hit &&
this.hitScatter === null &&
typeof displayObject != undefined
) {
this.hitScatter = displayObject.scatter
? displayObject.scatter
: null
if (hit && this.hitScatter === null && typeof displayObject != undefined) {
this.hitScatter = displayObject.scatter ? displayObject.scatter : null
}
}
@@ -184,10 +174,7 @@ export class ScatterContainer extends PIXI.Graphics {
let local = new PIXI.Point()
let interactionManager = this.renderer.plugins.interaction
interactionManager.mapPositionToPoint(local, point.x, point.y)
if (
element instanceof DisplayObjectScatter &&
element.displayObject.parent != null
) {
if (element instanceof DisplayObjectScatter && element.displayObject.parent != null) {
return element.displayObject.parent.toLocal(local)
}
return local
@@ -204,12 +191,7 @@ export class ScatterContainer extends PIXI.Graphics {
this.hitScatter = null
let interactionManager = this.renderer.plugins.interaction
let fakeEvent = this.fakeInteractionEvent(local)
interactionManager.processInteractive(
fakeEvent,
this,
this.findHitScatter.bind(this),
true
)
interactionManager.processInteractive(fakeEvent, this, this.findHitScatter.bind(this), true)
if (this.claimEvents) event.claimedByScatter = this.hitScatter
return this.hitScatter
}
@@ -223,8 +205,7 @@ export class ScatterContainer extends PIXI.Graphics {
this.hitScatter = null
let interactionManager = this.renderer.plugins.interaction
let displayObject = interactionManager.hitTest(local, this)
if (displayObject != null && displayObject.scatter != null)
this.hitScatter = displayObject.scatter
if (displayObject != null && displayObject.scatter != null) this.hitScatter = displayObject.scatter
if (this.claimEvents) event.claimedByScatter = this.hitScatter
return this.hitScatter
}
@@ -359,8 +340,7 @@ export class DisplayObjectScatter extends AbstractScatter {
get container() {
// return this.displayObject.parent
let obj = this.displayObject
while (obj.parent != null && !(obj.parent instanceof ScatterContainer))
obj = obj.parent
while (obj.parent != null && !(obj.parent instanceof ScatterContainer)) obj = obj.parent
return obj.parent
}
@@ -469,8 +449,7 @@ export class DisplayObjectScatter extends AbstractScatter {
mapPositionToContainerPoint(point) {
// UO: We need the coordinates related to this scatter in case
// of nested scatters
if (this.container != null)
return this.container.mapPositionToPoint(point, this)
if (this.container != null) return this.container.mapPositionToPoint(point, this)
return point
}
@@ -483,10 +462,7 @@ export class DisplayObjectScatter extends AbstractScatter {
if (this.displayObject.parent instanceof ScatterContainer) {
let scatterContainer = this.displayObject.parent
scatterContainer.bringToFront(this.displayObject)
} else if (
this.displayObject.parent != null &&
this.displayObject.parent.scatter
) {
} else if (this.displayObject.parent != null && this.displayObject.parent.scatter) {
this.displayObject.parent.scatter.toFront(this.displayObject)
}
}