diff --git a/module/applications/ui/countdowns.mjs b/module/applications/ui/countdowns.mjs index 3d0b32ae..b7d19ede 100644 --- a/module/applications/ui/countdowns.mjs +++ b/module/applications/ui/countdowns.mjs @@ -81,6 +81,13 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application return frame; } + /**@inheritdoc */ + async _onFirstRender(context, options) { + await super._onFirstRender(context, options); + + this.toggleCollapsedPosition(undefined, !ui.sidebar.expanded); + } + /** @override */ async _prepareContext(options) { const context = await super._prepareContext(options); @@ -124,6 +131,8 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application } toggleCollapsedPosition = async (_, collapsed) => { + if (!this.element) return; + this.sidebarCollapsed = collapsed; if (!collapsed) this.element.classList.add('expanded'); else this.element.classList.remove('expanded'); @@ -188,10 +197,13 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application Hooks.on(socketEvent.Refresh, this.cooldownRefresh.bind()); } - close(options) { + async close(options) { + /* Opt out of Foundry's standard behavior of closing all application windows marked as UI when Escape is pressed */ + if (options.closeKey) return; + Hooks.off('collapseSidebar', this.toggleCollapsedPosition); Hooks.off(socketEvent.Refresh, this.cooldownRefresh); - super.close(options); + return super.close(options); } static async updateCountdowns(progressType) { diff --git a/styles/less/ui/countdown/countdown.less b/styles/less/ui/countdown/countdown.less index 9fa42ec7..0f91bad4 100644 --- a/styles/less/ui/countdown/countdown.less +++ b/styles/less/ui/countdown/countdown.less @@ -18,7 +18,7 @@ box-shadow: none; width: 300px; top: 16px; - right: 64px; + right: calc(64px * var(--ui-scale)); transition: right ease 250ms, opacity var(--ui-fade-duration) ease, @@ -29,7 +29,7 @@ } &.expanded { - right: 364px; + right: calc(364px * var(--ui-scale)); } &.icon-only { diff --git a/system.json b/system.json index a16b3562..a7c79226 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "id": "daggerheart", "title": "Daggerheart", "description": "An unofficial implementation of the Daggerheart system", - "version": "1.2.0", + "version": "1.2.1", "compatibility": { "minimum": "13", "verified": "13.350",