From 0a406686f1465a936934756969e56fb653330590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gergely=20M=C3=A9sz=C3=A1ros=2C=20Ph=2ED?= Date: Mon, 18 Apr 2022 21:41:02 +0200 Subject: [PATCH 1/3] Redraw emblems after resample & remove aspect change. (#773) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Redraw emblems after resample. * Remove aspect change feature on submaps to support more useful crop operation. Co-authored-by: Mészáros Gergely --- modules/submap.js | 2 ++ modules/ui/submap.js | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/submap.js b/modules/submap.js index fed9fbc6..09853f97 100644 --- a/modules/submap.js +++ b/modules/submap.js @@ -310,6 +310,8 @@ window.Submap = (function () { } drawMarkers(); + stage("Redraw emblems."); + drawEmblems(); stage("Regenerating Zones."); addZones(); Names.getMapName(); diff --git a/modules/ui/submap.js b/modules/ui/submap.js index ff3fe16f..74ef44e6 100644 --- a/modules/ui/submap.js +++ b/modules/ui/submap.js @@ -76,6 +76,7 @@ const generateSubmap = debounce(function () { const checked = id => Boolean(document.getElementById(id).checked); // Create projection func from current zoom extents const [[x0, y0], [x1, y1]] = getViewBoxExtent(); + const origScale = scale; const options = { lockMarkers: checked("submapLockMarkers"), @@ -85,8 +86,8 @@ const generateSubmap = debounce(function () { addLakesInDepressions: checked("submapAddLakeInDepression"), promoteTowns: checked("submapPromoteTowns"), smoothHeightMap: scale > 2, - inverse: (x, y) => [(x * (x1 - x0)) / graphWidth + x0, (y * (y1 - y0)) / graphHeight + y0], - projection: (x, y) => [((x - x0) * graphWidth) / (x1 - x0), ((y - y0) * graphHeight) / (y1 - y0)] + inverse: (x, y) => [x / origScale + x0, y / origScale + y0], + projection: (x, y) => [(x - x0) * origScale, (y - y0) * origScale], }; // converting map position on the planet From 4447826c00eac663dbb41b19819156cfa4900ca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gergely=20M=C3=A9sz=C3=A1ros=2C=20Ph=2ED?= Date: Mon, 18 Apr 2022 21:41:39 +0200 Subject: [PATCH 2/3] Apostrophe in custom style name freeze FMG (#775) * fix concurency issue at load * Fix async concurrency error. * Fix frozen startup if aposthrope used in style name Co-authored-by: GoteGuru --- modules/ui/general.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ui/general.js b/modules/ui/general.js index b7a6255d..91605161 100644 --- a/modules/ui/general.js +++ b/modules/ui/general.js @@ -405,7 +405,7 @@ document.querySelectorAll("[data-locked]").forEach(function (e) { // lock option function lock(id) { - const input = document.querySelector("[data-stored='" + id + "']"); + const input = document.querySelector("[data-stored=\"" + id + "\"]"); if (input) localStorage.setItem(id, input.value); const el = document.getElementById("lock_" + id); if (!el) return; From 73434f5bb717a8261e57ed9728cb8569ec3b1974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gergely=20M=C3=A9sz=C3=A1ros=2C=20Ph=2ED?= Date: Mon, 18 Apr 2022 21:43:25 +0200 Subject: [PATCH 3/3] fix exact multiple error for spacing (#776) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mészáros Gergely --- main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index f9146b6f..fc424222 100644 --- a/main.js +++ b/main.js @@ -760,8 +760,8 @@ function placePoints() { const spacing = (grid.spacing = rn(Math.sqrt((graphWidth * graphHeight) / cellsDesired), 2)); // spacing between points before jirrering grid.boundary = getBoundaryPoints(graphWidth, graphHeight, spacing); grid.points = getJitteredGrid(graphWidth, graphHeight, spacing); // jittered square grid - grid.cellsX = Math.floor((graphWidth + 0.5 * spacing) / spacing); - grid.cellsY = Math.floor((graphHeight + 0.5 * spacing) / spacing); + grid.cellsX = Math.floor((graphWidth + 0.5 * spacing - 1e-10) / spacing); + grid.cellsY = Math.floor((graphHeight + 0.5 * spacing - 1e-10) / spacing); TIME && console.timeEnd("placePoints"); }