Skip to content

Commit

Permalink
1.0.42 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ironmonk88 committed Jul 7, 2022
1 parent 624db9d commit 27c5fdd
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 33 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 0 additions & 1 deletion classes/terrainlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
21 changes: 6 additions & 15 deletions js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion templates/terrain-hud.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<form id="{{id}}" class="{{classes}}" data-appid="{{appId}}" autocomplete="off" onsubmit="event.preventDefault();">
<div class="col left" style="justify-content: center;">
<div class="attribute control-icon" style="font-size: 18px;flex: 0 0 30px;height: 30px;line-height: 30px;">
<i class="fas fa-mountain"></i>
<i class="fas fa-mountain" style="font-size: var(--font-size-12);"></i>
<span class="terrain-cost" title="{{localize "EnhancedTerrainLayer.TerrainCost"}}">{{{cost}}}</span>
</div>

Expand Down
33 changes: 19 additions & 14 deletions terrain-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,18 +432,20 @@ Hooks.on('init', async () => {
});

Hooks.on("ready", () => {
canvas.terrain._setting["opacity"] = setting("opacity");
canvas.terrain._setting["draw-border"] = setting("draw-border");
canvas.terrain._setting["terrain-image"] = setting("terrain-image");
canvas.terrain._setting["show-text"] = setting("show-text");
canvas.terrain._setting["show-icon"] = setting("show-icon");
canvas.terrain._setting["show-on-drag"] = setting("show-on-drag");
canvas.terrain._setting["only-show-active"] = setting("only-show-active");
canvas.terrain._setting["tokens-cause-difficult"] = setting("tokens-cause-difficult");
canvas.terrain._setting["dead-cause-difficult"] = setting("dead-cause-difficult");
canvas.terrain._setting["use-obstacles"] = setting("use-obstacles");
canvas.terrain._setting["minimum-cost"] = setting("minimum-cost");
canvas.terrain._setting["maximum-cost"] = setting("maximum-cost");
if (canvas.terrain) {
canvas.terrain._setting["opacity"] = setting("opacity");
canvas.terrain._setting["draw-border"] = setting("draw-border");
canvas.terrain._setting["terrain-image"] = setting("terrain-image");
canvas.terrain._setting["show-text"] = setting("show-text");
canvas.terrain._setting["show-icon"] = setting("show-icon");
canvas.terrain._setting["show-on-drag"] = setting("show-on-drag");
canvas.terrain._setting["only-show-active"] = setting("only-show-active");
canvas.terrain._setting["tokens-cause-difficult"] = setting("tokens-cause-difficult");
canvas.terrain._setting["dead-cause-difficult"] = setting("dead-cause-difficult");
canvas.terrain._setting["use-obstacles"] = setting("use-obstacles");
canvas.terrain._setting["minimum-cost"] = setting("minimum-cost");
canvas.terrain._setting["maximum-cost"] = setting("maximum-cost");
}
});

Hooks.on('renderMeasuredTemplateConfig', (app, html, data) => {
Expand All @@ -453,13 +455,16 @@ Hooks.on('renderMeasuredTemplateConfig', (app, html, data) => {
$('.sheet-tabs', html).append($('<a>').addClass("item").attr("data-tab", "terrain").html('<i class="fas fa-mountiain"></i> Terrain'));
tab = $('<div>').addClass("tab action-sheet").attr('data-tab', 'terrain').insertAfter($('.tab:last', html));
} else {
let root = $('form', html);
if (root.length == 0)
root = html;
let basictab = $('<div>').addClass("tab").attr('data-tab', 'basic');
$('form > *:not(button)', html).each(function () {
$('> *:not(button)', root).each(function () {
basictab.append(this);
});

tab = $('<div>').addClass("tab action-sheet").attr('data-tab', 'terrain');
$('form', html).prepend(tab).prepend(basictab).prepend(
$(root).prepend(tab).prepend(basictab).prepend(
$('<nav>')
.addClass("sheet-tabs tabs")
.append($('<a>').addClass("item active").attr("data-tab", "basic").html('<i class="fas fa-university"></i> Basic'))
Expand Down

0 comments on commit 27c5fdd

Please sign in to comment.