Skip to content

Commit e845d4a

Browse files
committed
allow selection when tilemap panel is not open
1 parent 46122bc commit e845d4a

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

editor/client/panning-and-selection.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ export class CameraPanBehavior extends Behavior {
6868
});
6969
}
7070

71+
#ignoreTilemap(): boolean {
72+
const entity = this.ui?.selectedEntity.entities[0];
73+
if (!entity) return false;
74+
if (!(entity instanceof EditorFacadeTilemap)) return false;
75+
76+
// TODO: need inspector ui root instead of document (prevent crosstalk between edit and play)
77+
return document.querySelector("[data-tab-id=tilemap][data-active]") !== null;
78+
}
79+
7180
#setDrag(value: Vector2 | undefined) {
7281
this.#drag = value;
7382

@@ -103,9 +112,7 @@ export class CameraPanBehavior extends Behavior {
103112
this.#wasGizmo = local.length > 0;
104113

105114
if (!this.#wasGizmo && event.cursor.world) {
106-
if (this.ui?.selectedEntity.entities[0] instanceof EditorFacadeTilemap) {
107-
return;
108-
}
115+
if (this.#ignoreTilemap()) return;
109116

110117
const entities = this.game.entities
111118
.lookupByPosition(event.cursor.world)
@@ -572,9 +579,7 @@ export class CameraPanBehavior extends Behavior {
572579
return;
573580
}
574581

575-
if (this.ui?.selectedEntity.entities[0] instanceof EditorFacadeTilemap) {
576-
return;
577-
}
582+
if (this.#ignoreTilemap()) return;
578583

579584
if (!wasMouseDownOverCanvas) return;
580585
if (!this.#drag && event.button === "left" && event.cursor.world && !this.#wasGizmo) {

0 commit comments

Comments
 (0)