mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
[Feature] Extended Scene Range Measurements (#1255)
* Extended the capabilities of scene rangemeasurement settings * Corrected darkmode tab title
This commit is contained in:
parent
7055591a76
commit
052b6baefe
13 changed files with 182 additions and 21 deletions
|
|
@ -1,11 +1,17 @@
|
|||
export default class DhSceneConfigSettings extends foundry.applications.sheets.SceneConfig {
|
||||
constructor(options, ...args) {
|
||||
super(options, ...args);
|
||||
}
|
||||
// static DEFAULT_OPTIONS = {
|
||||
// ...super.DEFAULT_OPTIONS,
|
||||
// form: {
|
||||
// handler: this.updateData,
|
||||
// closeOnSubmit: true
|
||||
// }
|
||||
// };
|
||||
|
||||
static buildParts() {
|
||||
const { footer, ...parts } = super.PARTS;
|
||||
const { footer, tabs, ...parts } = super.PARTS;
|
||||
const tmpParts = {
|
||||
// tabs,
|
||||
tabs: { template: 'systems/daggerheart/templates/scene/tabs.hbs' },
|
||||
...parts,
|
||||
dh: { template: 'systems/daggerheart/templates/scene/dh-config.hbs' },
|
||||
footer
|
||||
|
|
@ -16,9 +22,42 @@ export default class DhSceneConfigSettings extends foundry.applications.sheets.S
|
|||
static PARTS = DhSceneConfigSettings.buildParts();
|
||||
|
||||
static buildTabs() {
|
||||
super.TABS.sheet.tabs.push({ id: 'dh', icon: 'fa-solid' });
|
||||
super.TABS.sheet.tabs.push({ id: 'dh', src: 'systems/daggerheart/assets/logos/FoundryBorneLogoWhite.svg' });
|
||||
return super.TABS;
|
||||
}
|
||||
|
||||
static TABS = DhSceneConfigSettings.buildTabs();
|
||||
|
||||
_attachPartListeners(partId, htmlElement, options) {
|
||||
super._attachPartListeners(partId, htmlElement, options);
|
||||
switch (partId) {
|
||||
case 'dh':
|
||||
htmlElement.querySelector('#rangeMeasurementSetting')?.addEventListener('change', async event => {
|
||||
const flagData = foundry.utils.mergeObject(this.document.flags.daggerheart, {
|
||||
rangeMeasurement: { setting: event.target.value }
|
||||
});
|
||||
this.document.flags.daggerheart = flagData;
|
||||
this.render();
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
async _preparePartContext(partId, context, options) {
|
||||
context = await super._preparePartContext(partId, context, options);
|
||||
switch (partId) {
|
||||
case 'dh':
|
||||
context.data = new game.system.api.data.scenes.DHScene(canvas.scene.flags.daggerheart);
|
||||
context.variantRules = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.variantRules);
|
||||
break;
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
// static async updateData(event, _, formData) {
|
||||
// const data = foundry.utils.expandObject(formData.object);
|
||||
// this.close(data);
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue