forked from wsaunders1014/TerrainLayer
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
IronMonk88
committed
Feb 12, 2021
1 parent
91c43c2
commit 51a7b1d
Showing
11 changed files
with
1,019 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
*.zip | ||
.vs/ | ||
screenshots/ | ||
.svn/ |
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,40 @@ | ||
import { TerrainLayer } from './terrainlayer2.js'; | ||
|
||
export class TerrainLayerToolBar extends FormApplication { | ||
constructor() { | ||
super(...arguments); | ||
} | ||
static get defaultOptions() { | ||
const options = { | ||
classes: ['form'], | ||
left: 98, | ||
popOut: false, | ||
template: 'modules/TerrainLayer/templates/terrain-controls.html', | ||
id: 'terrainlayer-config', | ||
title: game.i18n.localize('Default Terrain Cost'), | ||
closeOnSubmit: false, | ||
submitOnChange: false, | ||
submitOnClose: false | ||
}; | ||
options['editable'] = game.user.isGM; | ||
return mergeObject(super.defaultOptions, options); | ||
} | ||
|
||
activateListeners(html) { | ||
super.activateListeners(html); | ||
|
||
$('.control-tool[data-tool]', html).on("click", this._onHandleClick.bind(this)); | ||
} | ||
|
||
getData(options) { | ||
return { multiple: canvas.terrain.defaultmultiple }; | ||
} | ||
|
||
_onHandleClick(event) { | ||
const btn = event.currentTarget; | ||
let idx = TerrainLayer.multipleOptions.indexOf(canvas.terrain.defaultmultiple); | ||
idx = Math.clamped(($(btn).attr('id') == 'tl-inc-cost' ? idx + 1 : idx - 1), 0, TerrainLayer.multipleOptions.length - 1); | ||
canvas.terrain.defaultmultiple = TerrainLayer.multipleOptions[idx]; | ||
$('#tl-defaultcost', this.element).html(TerrainLayer.multipleText(canvas.terrain.defaultmultiple)); | ||
} | ||
} |
Oops, something went wrong.