mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-22 10:29:54 +02:00
requested changes
This commit is contained in:
parent
6f040532aa
commit
e5f01eb0c9
2 changed files with 11 additions and 23 deletions
|
|
@ -95,26 +95,23 @@ export default class FearTracker extends HandlebarsApplicationMixin(ApplicationV
|
|||
if (options.isFirstRender) FearTracker.handleOffSet();
|
||||
if (!options.force) return;
|
||||
|
||||
this.handleStyleElement(fearPosition);
|
||||
|
||||
switch (fearPosition) {
|
||||
case 'topCenter':
|
||||
this.handleStyleElement(fearPosition);
|
||||
document.getElementById('ui-top')?.appendChild(this.element);
|
||||
break;
|
||||
case 'bottomCenter':
|
||||
this.handleStyleElement(fearPosition);
|
||||
document.getElementById('ui-bottom')?.prepend(this.element);
|
||||
break;
|
||||
case 'rightTop':
|
||||
this.handleStyleElement(fearPosition);
|
||||
document.getElementById('ui-right-column-1')?.appendChild(this.element);
|
||||
break;
|
||||
case 'leftBottom':
|
||||
this.handleStyleElement(fearPosition);
|
||||
document.getElementById('ui-left-column-1')?.appendChild(this.element);
|
||||
document.getElementById('ui-left-column-1')?.insertBefore(this.element, document.getElementById('players'));
|
||||
break;
|
||||
|
||||
default:
|
||||
this.handleStyleElement(fearPosition);
|
||||
document.body?.appendChild(this.element);
|
||||
const position =
|
||||
game.user.getFlag(CONFIG.DH.id, 'app.resources.position') ?? FearTracker.DEFAULT_OPTIONS.position;
|
||||
|
|
@ -130,21 +127,11 @@ export default class FearTracker extends HandlebarsApplicationMixin(ApplicationV
|
|||
}
|
||||
|
||||
handleStyleElement(fearPosition) {
|
||||
const positions = {
|
||||
free: 'free',
|
||||
topCenter: 'top-center',
|
||||
bottomCenter: 'bottom-center',
|
||||
rightTop: 'right-top',
|
||||
leftBottom: 'left-bottom'
|
||||
for (const position of Object.values(CONFIG.DH.GENERAL.fearPosition)) {
|
||||
this.element.classList.remove(position.value);
|
||||
}
|
||||
|
||||
const containsStyle = position => this.element.classList.contains(position);
|
||||
|
||||
Object.entries(positions).forEach(([key, value]) => {
|
||||
if (containsStyle(value)) this.element.classList.remove(value);
|
||||
})
|
||||
|
||||
this.element.classList.add(positions[fearPosition]);
|
||||
this.element.classList.add(fearPosition);
|
||||
}
|
||||
|
||||
static handleOffSet() {
|
||||
|
|
@ -186,6 +173,7 @@ export default class FearTracker extends HandlebarsApplicationMixin(ApplicationV
|
|||
);
|
||||
}
|
||||
|
||||
// TODO: Remove methods later to use Foundry's dragger and resize methods
|
||||
/* -------------------------------------------- */
|
||||
/* Dragging handlers */
|
||||
/* -------------------------------------------- */
|
||||
|
|
|
|||
|
|
@ -56,20 +56,20 @@ body.theme-light {
|
|||
position: absolute;
|
||||
}
|
||||
|
||||
&.top-center,
|
||||
&.bottom-center {
|
||||
&.topCenter,
|
||||
&.bottomCenter {
|
||||
margin: 1rem 0;
|
||||
width: 100% !important;
|
||||
transform: translateX(var(--offset));
|
||||
transition: all 250ms ease;
|
||||
}
|
||||
|
||||
&.right-top {
|
||||
&.rightTop {
|
||||
width: 300px;
|
||||
max-width: 300px;
|
||||
}
|
||||
|
||||
&.left-bottom {
|
||||
&.leftBottom {
|
||||
width: 200px;
|
||||
max-width: 200px;
|
||||
background: transparent;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue