-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
V12 compatability. Added Grid Settings for combat
- Loading branch information
Showing
9 changed files
with
113 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { useTemplatesPath } from '../scripts/combat-hp-display-helpers.js'; | ||
|
||
export default class GridSettingsMenu extends FormApplication { | ||
constructor() { | ||
super({}, {title: game.i18n.localize('combat-hp-display.gridSettings.title')}); | ||
const settings = game.settings.get('combat-hp-display', 'grid-display'); | ||
this.gridSettings = { | ||
...settings, | ||
}; | ||
} | ||
|
||
static get defaultOptions() { | ||
const defaults = super.defaultOptions; | ||
const overrides = { | ||
height: 'auto', | ||
width: 300, | ||
id: 'resource-display-menu', | ||
template: useTemplatesPath('gridMenu.hbs'), | ||
closeOnSubmit: false, | ||
submitOnChange: true, | ||
classes: ["combat-hp-display", "grid-menu"], | ||
}; | ||
|
||
const mergedOptions = foundry.utils.mergeObject(defaults, overrides); | ||
|
||
return mergedOptions; | ||
} | ||
|
||
getData() { | ||
return { | ||
grid: this.gridSettings, | ||
} | ||
} | ||
|
||
async _updateObject(event, formData) { | ||
this.gridSettings = foundry.utils.expandObject(formData).grid; | ||
|
||
this.render(); | ||
} | ||
|
||
activateListeners(html) { | ||
super.activateListeners(html); | ||
|
||
$(html).find('#save').click(event => { | ||
game.settings.set('combat-hp-display', 'grid-display', this.gridSettings); | ||
this.close(); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<form class={{cssClass}} autocomplete="off" onsubmit="event.preventDefault();"> | ||
<div class="flexcol"> | ||
<div class="form-group"> | ||
<label><strong>{{localize "Enabled"}}</strong></label> | ||
<div class="form-fields"> | ||
<input type="checkbox" name="grid.enabled" {{checked grid.enabled}} /> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label><strong>{{localize "Opacity"}}</strong></label> | ||
<div class="form-fields"> | ||
<label>{{grid.opacity}}</label> | ||
<input type="range" name="grid.opacity" value="{{grid.opacity}}" min="0" max="1" step="0.1" /> | ||
</div> | ||
</div> | ||
</div> | ||
<footer class="sheet-footer flexrow"> | ||
<button id="save"><i class="far fa-save"></i>Save Changes</button> | ||
</footer> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters