Better state handling for buttons, etc.

This commit is contained in:
Chris Ryan 2025-11-14 11:54:02 +10:00
parent 8978721e63
commit 6e70f14ca7
2 changed files with 24 additions and 41 deletions

View file

@ -95,6 +95,8 @@ export default class DhTemplateManager {
canvas.stage.off('mousedown', mousedown);
canvas.app.view.removeEventListener('contextmenu', contextmenu);
canvas.app.view.removeEventListener('wheel', wheel);
this.#activePreview = undefined;
}
/**
@ -103,9 +105,9 @@ export default class DhTemplateManager {
*/
#confirmTemplate(event) {
event.stopPropagation();
const docObject = this.#activePreview.document.toObject();
canvas.scene.createEmbeddedDocuments('MeasuredTemplate', [docObject]);
this.#cancelTemplate(event);
canvas.scene.createEmbeddedDocuments('MeasuredTemplate', [this.#activePreview.document.toObject()]);
this.#activePreview = undefined;
}