mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-23 02:49:55 +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.isFirstRender) FearTracker.handleOffSet();
|
||||||
if (!options.force) return;
|
if (!options.force) return;
|
||||||
|
|
||||||
|
this.handleStyleElement(fearPosition);
|
||||||
|
|
||||||
switch (fearPosition) {
|
switch (fearPosition) {
|
||||||
case 'topCenter':
|
case 'topCenter':
|
||||||
this.handleStyleElement(fearPosition);
|
|
||||||
document.getElementById('ui-top')?.appendChild(this.element);
|
document.getElementById('ui-top')?.appendChild(this.element);
|
||||||
break;
|
break;
|
||||||
case 'bottomCenter':
|
case 'bottomCenter':
|
||||||
this.handleStyleElement(fearPosition);
|
|
||||||
document.getElementById('ui-bottom')?.prepend(this.element);
|
document.getElementById('ui-bottom')?.prepend(this.element);
|
||||||
break;
|
break;
|
||||||
case 'rightTop':
|
case 'rightTop':
|
||||||
this.handleStyleElement(fearPosition);
|
|
||||||
document.getElementById('ui-right-column-1')?.appendChild(this.element);
|
document.getElementById('ui-right-column-1')?.appendChild(this.element);
|
||||||
break;
|
break;
|
||||||
case 'leftBottom':
|
case 'leftBottom':
|
||||||
this.handleStyleElement(fearPosition);
|
document.getElementById('ui-left-column-1')?.insertBefore(this.element, document.getElementById('players'));
|
||||||
document.getElementById('ui-left-column-1')?.appendChild(this.element);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
this.handleStyleElement(fearPosition);
|
|
||||||
document.body?.appendChild(this.element);
|
document.body?.appendChild(this.element);
|
||||||
const position =
|
const position =
|
||||||
game.user.getFlag(CONFIG.DH.id, 'app.resources.position') ?? FearTracker.DEFAULT_OPTIONS.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) {
|
handleStyleElement(fearPosition) {
|
||||||
const positions = {
|
for (const position of Object.values(CONFIG.DH.GENERAL.fearPosition)) {
|
||||||
free: 'free',
|
this.element.classList.remove(position.value);
|
||||||
topCenter: 'top-center',
|
|
||||||
bottomCenter: 'bottom-center',
|
|
||||||
rightTop: 'right-top',
|
|
||||||
leftBottom: 'left-bottom'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const containsStyle = position => this.element.classList.contains(position);
|
this.element.classList.add(fearPosition);
|
||||||
|
|
||||||
Object.entries(positions).forEach(([key, value]) => {
|
|
||||||
if (containsStyle(value)) this.element.classList.remove(value);
|
|
||||||
})
|
|
||||||
|
|
||||||
this.element.classList.add(positions[fearPosition]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static handleOffSet() {
|
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 */
|
/* Dragging handlers */
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
|
||||||
|
|
@ -56,20 +56,20 @@ body.theme-light {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.top-center,
|
&.topCenter,
|
||||||
&.bottom-center {
|
&.bottomCenter {
|
||||||
margin: 1rem 0;
|
margin: 1rem 0;
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
transform: translateX(var(--offset));
|
transform: translateX(var(--offset));
|
||||||
transition: all 250ms ease;
|
transition: all 250ms ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.right-top {
|
&.rightTop {
|
||||||
width: 300px;
|
width: 300px;
|
||||||
max-width: 300px;
|
max-width: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.left-bottom {
|
&.leftBottom {
|
||||||
width: 200px;
|
width: 200px;
|
||||||
max-width: 200px;
|
max-width: 200px;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue