Skip to content

Commit

Permalink
new changes
Browse files Browse the repository at this point in the history
  • Loading branch information
IronMonk88 committed Feb 12, 2021
1 parent 91c43c2 commit 51a7b1d
Show file tree
Hide file tree
Showing 11 changed files with 1,019 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*.zip
.vs/
screenshots/
.svn/
40 changes: 40 additions & 0 deletions classes/terraincontrols.js
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));
}
}
Loading

0 comments on commit 51a7b1d

Please sign in to comment.