Skip to content

Commit

Permalink
Fix subsequent renders of scene darkness adjuster
Browse files Browse the repository at this point in the history
  • Loading branch information
stwlam committed Dec 4, 2024
1 parent bfbb630 commit 23e2088
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/module/apps/scene-darkness-adjuster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,11 @@ export class SceneDarknessAdjuster extends Application {
const element = $element[0];
element.style.left = `${bounds.right + 6}px`;
element.style.top = `${(options.top = bounds.top - 3)}px`;
if (!wasRendered) $element.fadeIn().promise();
}

/** Fade out before closing */
override async close(options?: { force?: boolean } & Record<string, unknown>): Promise<void> {
if (!this.rendered) return super.close(options);
await this.element.fadeOut().promise();
return super.close(options);
if (wasRendered) {
element.style.display = "block";
} else {
$element.fadeIn().promise();
}
}

override activateListeners($html: JQuery): void {
Expand Down Expand Up @@ -148,4 +145,11 @@ export class SceneDarknessAdjuster extends Application {
}
}
}

/** Fade out before closing */
override async close(options?: { force?: boolean } & Record<string, unknown>): Promise<void> {
if (this.rendered) await this.element.fadeOut().promise();
await super.close(options);
this.#slider?.destroy();
}
}

0 comments on commit 23e2088

Please sign in to comment.