Skip to content

Commit

Permalink
Use label instead of name
Browse files Browse the repository at this point in the history
  • Loading branch information
Zikoat committed Aug 13, 2024
1 parent d7c147b commit 72d10ca
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/CellSprite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export class CellSprite {
this.lorez.tint = cellTexture.lorezTint;
this.lorez.x = x;
this.lorez.y = y;
const lorezLayer = parent.getChildByName("lorez") as PIXI.Container;
const foregroundLayer = parent.getChildByName("fg") as PIXI.Container;
const lorezLayer = parent.getChildByLabel("lorez") as PIXI.Container;
const foregroundLayer = parent.getChildByLabel("fg") as PIXI.Container;
foregroundLayer.addChild(this.front, this.back);
lorezLayer.addChild(this.lorez);

Expand Down
12 changes: 6 additions & 6 deletions src/Controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class Controls {
Controls.fieldStorage = fieldStorage;

Controls.cursor = new Cursor();
const foreground = rootObject.getChildByName("container");
const foreground = rootObject.getChildByLabel("container");
assert(foreground);
foreground.addChild(Controls.cursor);

Expand All @@ -44,9 +44,9 @@ export class Controls {
const zoomHandler = zoom().on("zoom", (rawEvent) => {
const event = eventSchema.parse(rawEvent);

const container = rootObject.getChildByName("container") as PIXI.Sprite;
const foreground = container.getChildByName("fg") as PIXI.Sprite;
const background = rootObject.getChildByName("bg") as PIXI.TilingSprite;
const container = rootObject.getChildByLabel("container") as PIXI.Sprite;
const foreground = container.getChildByLabel("fg") as PIXI.Sprite;
const background = rootObject.getChildByLabel("bg") as PIXI.TilingSprite;

const x = event.transform.x;
const y = event.transform.y;
Expand Down Expand Up @@ -89,7 +89,7 @@ export class Controls {
// todo dedup between mousemove.
assert(typeof touchPosition.clientX === "number");
assert(typeof touchPosition.clientY === "number");
const foreground = rootObject.getChildByName("container");
const foreground = rootObject.getChildByLabel("container");
assert(foreground);
const worldPos = foreground.toLocal({
x: touchPosition.clientX,
Expand Down Expand Up @@ -117,7 +117,7 @@ export class Controls {
.on("mousemove", (event: PointerEvent & ScreenPos) => {
assert(typeof event.x === "number");
assert(typeof event.y === "number");
const foreground = rootObject.getChildByName("container");
const foreground = rootObject.getChildByLabel("container");
assert(foreground);
const worldPos = foreground.toLocal(event) as WorldPos;

Expand Down
8 changes: 4 additions & 4 deletions src/FieldRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ export class FieldRenderer extends PIXI.Application {
background.height = height;
});

background.name = "bg";
background.label = "bg";
const lorezLayer = new PIXI.Container({ interactiveChildren: false });
const foregroundLayer = new PIXI.Container({ interactiveChildren: false });
foregroundLayer.name = "fg";
lorezLayer.name = "lorez";
foregroundLayer.label = "fg";
lorezLayer.label = "lorez";
this.fieldContainer.addChild(lorezLayer);
this.fieldContainer.addChild(foregroundLayer);
this.fieldContainer.name = "container";
this.fieldContainer.label = "container";

this.clickHandler.addChildAt(background, 0);
this.clickHandler.addChildAt(this.fieldContainer, 1);
Expand Down

0 comments on commit 72d10ca

Please sign in to comment.