From 27c5fdd6a97bcf96004949c2838b88511e97401b Mon Sep 17 00:00:00 2001 From: ironmonk88 <75920956+ironmonk88@users.noreply.github.com> Date: Wed, 6 Jul 2022 23:01:02 -0700 Subject: [PATCH] 1.0.42 changes --- CHANGELOG.md | 8 ++++++++ classes/terrainlayer.js | 1 - js/settings.js | 21 ++++++--------------- module.json | 4 ++-- templates/terrain-hud.html | 2 +- terrain-main.js | 33 +++++++++++++++++++-------------- 6 files changed, 36 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82eef12..7bef632 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# Version 1.0.42 + +Fixed icon sizing for the HUD Terrain cost. + +Fixed issue setting settings when the canvas terrain layer doesn't exist yet. + +Fixed issues with adding the Terrain tab to various config dialogs. + # Version 1.0.41 Fixed issue where editing the colours in the settings was erasing all the colour information. diff --git a/classes/terrainlayer.js b/classes/terrainlayer.js index ee22a3f..56a5e81 100644 --- a/classes/terrainlayer.js +++ b/classes/terrainlayer.js @@ -131,7 +131,6 @@ export class TerrainLayer extends PlaceablesLayer { const hy = (canvas.grid.type == CONST.GRID_TYPES.GRIDLESS || options.ignoreGrid === true ? 0 : canvas.grid.h / 2); for (let pt of pts) { - let cost = null; let [gx, gy] = (canvas.grid.type == CONST.GRID_TYPES.GRIDLESS || options.ignoreGrid === true ? [pt.x, pt.y] : canvas.grid.grid.getPixelsFromGridPosition(pt.y, pt.x)); let tx = (gx + hx); diff --git a/js/settings.js b/js/settings.js index f295f4b..078a126 100644 --- a/js/settings.js +++ b/js/settings.js @@ -4,6 +4,7 @@ export const registerSettings = function () { let modulename = "enhanced-terrain-layer"; const debouncedReload = foundry.utils.debounce(function () { window.location.reload(); }, 100); + const debouncedRefresh = foundry.utils.debounce(function () { canvas.terrain.refresh(); }, 100); let imageoptions = { 'solid': 'Solid', @@ -38,9 +39,7 @@ export const registerSettings = function () { max: 1, step: 0.1 }, - onChange: () => { - canvas.terrain.refresh(); - } + onChange: debouncedRefresh }); game.settings.register(modulename, 'draw-border', { name: "EnhancedTerrainLayer.draw-border.name", @@ -49,9 +48,7 @@ export const registerSettings = function () { config: true, default: true, type: Boolean, - onChange: () => { - canvas.terrain.refresh(); - } + onChange: debouncedRefresh }); game.settings.register(modulename, 'terrain-image', { name: "EnhancedTerrainLayer.terrain-image.name", @@ -70,9 +67,7 @@ export const registerSettings = function () { config: true, default: false, type: Boolean, - onChange: () => { - canvas.terrain.refresh(); - } + onChange: debouncedRefresh }); game.settings.register(modulename, 'show-icon', { name: "EnhancedTerrainLayer.show-icon.name", @@ -81,9 +76,7 @@ export const registerSettings = function () { config: true, default: true, type: Boolean, - onChange: () => { - canvas.terrain.refresh(); - } + onChange: debouncedRefresh }); game.settings.register(modulename, 'show-on-drag', { name: "EnhancedTerrainLayer.show-on-drag.name", @@ -100,9 +93,7 @@ export const registerSettings = function () { config: true, default: false, type: Boolean, - onChange: () => { - canvas.terrain.refresh(); - } + onChange: debouncedRefresh }); game.settings.register(modulename, 'tokens-cause-difficult', { name: "EnhancedTerrainLayer.tokens-cause-difficult.name", diff --git a/module.json b/module.json index d6d1b28..65eb75d 100644 --- a/module.json +++ b/module.json @@ -2,7 +2,7 @@ "name": "enhanced-terrain-layer", "title": "Enhanced Terrain Layer", "description": "A base module that adds a Terrain Layer to Foundry. Used as a library for Rulers and other modules", - "version": "1.0.41", + "version": "1.0.42", "minimumCoreVersion": "9", "compatibleCoreVersion": "9", "author": "IronMonk", @@ -48,7 +48,7 @@ "styles": [ "css/terrainlayer.css" ], "packs": [], "url" : "https://github.com/ironmonk88/enhanced-terrain-layer", - "download" : "https://github.com/ironmonk88/enhanced-terrain-layer/archive/1.0.41.zip", + "download" : "https://github.com/ironmonk88/enhanced-terrain-layer/archive/1.0.42.zip", "manifest" : "https://github.com/ironmonk88/enhanced-terrain-layer/releases/latest/download/module.json", "bugs": "https://github.com/ironmonk88/enhanced-terrain-layer/issues", "allowBugReporter": true diff --git a/templates/terrain-hud.html b/templates/terrain-hud.html index b116a74..808fe80 100644 --- a/templates/terrain-hud.html +++ b/templates/terrain-hud.html @@ -1,7 +1,7 @@