diff --git a/module/applications/ui/countdowns.mjs b/module/applications/ui/countdowns.mjs index 25cf0a72..55df92b9 100644 --- a/module/applications/ui/countdowns.mjs +++ b/module/applications/ui/countdowns.mjs @@ -81,22 +81,15 @@ 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); - } - /** Returns countdown data filtered by ownership */ #getCountdowns() { const setting = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns); - const values = Object.entries(setting.countdowns).map(([key, countdown]) => ({ - key, - countdown, - ownership: DhCountdowns.#getPlayerOwnership(game.user, setting, countdown) + const values = Object.entries(setting.countdowns).map(([key, countdown]) => ({ + key, + countdown, + ownership: DhCountdowns.#getPlayerOwnership(game.user, setting, countdown) })); - return values.filter((v) => v.ownership !== CONST.DOCUMENT_OWNERSHIP_LEVELS.NONE); + return values.filter(v => v.ownership !== CONST.DOCUMENT_OWNERSHIP_LEVELS.NONE); } /** @override */ @@ -137,14 +130,6 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application : playerOwnership; } - toggleCollapsedPosition = async (_, collapsed) => { - if (!this.element) return; - - this.sidebarCollapsed = collapsed; - if (!collapsed) this.element.classList.add('expanded'); - else this.element.classList.remove('expanded'); - }; - cooldownRefresh = ({ refreshType }) => { if (refreshType === RefreshType.Countdown) this.render(); }; @@ -200,7 +185,6 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application } setupHooks() { - Hooks.on('collapseSidebar', this.toggleCollapsedPosition.bind()); Hooks.on(socketEvent.Refresh, this.cooldownRefresh.bind()); } @@ -208,7 +192,6 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application /* 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); return super.close(options); } @@ -249,5 +232,8 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application async _onRender(context, options) { await super._onRender(context, options); this.element.hidden = !game.user.isGM && this.#getCountdowns().length === 0; + if (options?.force) { + document.getElementById('ui-right-column-1')?.appendChild(this.element); + } } } diff --git a/styles/less/ui/countdown/countdown-edit.less b/styles/less/ui/countdown/countdown-edit.less index 9051cccb..c8092403 100644 --- a/styles/less/ui/countdown/countdown-edit.less +++ b/styles/less/ui/countdown/countdown-edit.less @@ -65,7 +65,7 @@ .countdown-edit-container { display: grid; - grid-template-columns: 48px 1fr 64px; + grid-template-columns: 48px 1fr 68px; align-items: center; gap: 8px; diff --git a/styles/less/ui/countdown/countdown.less b/styles/less/ui/countdown/countdown.less index 0f91bad4..4adeff87 100644 --- a/styles/less/ui/countdown/countdown.less +++ b/styles/less/ui/countdown/countdown.less @@ -12,26 +12,18 @@ } .daggerheart.dh-style.countdowns { - z-index: var(--z-index-ui) !important; + position: initial; border: 0; border-radius: 4px; box-shadow: none; width: 300px; - top: 16px; - right: calc(64px * var(--ui-scale)); - transition: - right ease 250ms, - opacity var(--ui-fade-duration) ease, - opacity var(--ui-fade-duration); + pointer-events: all; + align-self: flex-end; .window-title { font-family: @font-body; } - &.expanded { - right: calc(364px * var(--ui-scale)); - } - &.icon-only { width: 180px; min-width: 180px;