mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
[Fix] RCT Countdown Positioning (#1306)
* Fixed so that the countdown Ui positions itself well when RCT video is enabled * Removed hooks and just placing the Ui Countdowns in the UI-Right-column-1 placement
This commit is contained in:
parent
844c683c7d
commit
0233979a9f
3 changed files with 12 additions and 34 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue