From 38f2e1fb7b03aed495383de47a822d3aebbf2ed0 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Sun, 26 Mar 2023 15:05:19 +0400 Subject: [PATCH] feat: inform users if canvas size is too big --- index.html | 6 +++--- modules/ui/options.js | 15 +++++++++++++-- versioning.js | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index a818a90b..841a8d5a 100644 --- a/index.html +++ b/index.html @@ -1461,7 +1461,7 @@

@@ -1473,7 +1473,7 @@
Canvas size @@ -7877,7 +7877,7 @@ - + diff --git a/modules/ui/options.js b/modules/ui/options.js index aa3875e2..ea7f596e 100644 --- a/modules/ui/options.js +++ b/modules/ui/options.js @@ -160,9 +160,20 @@ optionsContent.addEventListener("click", function (event) { }); function mapSizeInputChange() { + const $mapWidthInput = byId("mapWidthInput"); + const $mapHeightInput = byId("mapHeightInput"); + changeMapSize(); - localStorage.setItem("mapWidth", mapWidthInput.value); - localStorage.setItem("mapHeight", mapHeightInput.value); + localStorage.setItem("mapWidth", $mapWidthInput.value); + localStorage.setItem("mapHeight", $mapHeightInput.value); + + const tooWide = +$mapWidthInput.value > window.innerWidth; + const tooHigh = +$mapHeightInput.value > window.innerHeight; + + if (tooWide || tooHigh) { + const message = `Canvas size is larger than actual window size (${window.innerWidth} x ${window.innerHeight}). It can affect the performance if you are going to create a new map`; + tip(message, false, "warn", 4000); + } } // change svg size on manual size change or window resize, do not change graph size diff --git a/versioning.js b/versioning.js index b9e12c80..9eb3f33e 100644 --- a/versioning.js +++ b/versioning.js @@ -1,7 +1,7 @@ "use strict"; // version and caching control -const version = "1.89.13"; // generator version, update each time +const version = "1.89.14"; // generator version, update each time { document.title += " v" + version;