diff --git a/index.css b/index.css index 419bf650..4d1a1f91 100644 --- a/index.css +++ b/index.css @@ -347,6 +347,20 @@ text.drag { user-select: none; } +#optionsTrigger { + padding: 0.6em 0.45em; +} + +@media (max-width: 600px) { + #optionsTrigger { + font-size: 2em; + padding: 0; + width: 1.3em; + height: 1.6em; + border: solid 1px #5e4fa2; + } +} + #options { position: absolute; font-family: Consolas, monospace; diff --git a/index.html b/index.html index a895ac77..d027e45c 100644 --- a/index.html +++ b/index.html @@ -288,17 +288,18 @@ ► - + ◄ Layers @@ -358,7 +366,8 @@ @@ -366,7 +375,8 @@ @@ -374,7 +384,8 @@ @@ -382,7 +393,8 @@ @@ -390,7 +402,8 @@ @@ -398,7 +411,8 @@ @@ -406,7 +420,8 @@ @@ -414,14 +429,16 @@ Rivers @@ -429,7 +446,8 @@ @@ -437,7 +455,8 @@ @@ -445,14 +464,16 @@ States @@ -460,7 +481,8 @@ @@ -468,21 +490,24 @@ Borders Routes @@ -490,7 +515,8 @@ @@ -498,7 +524,8 @@ @@ -506,7 +533,8 @@ @@ -514,7 +542,8 @@ @@ -522,21 +551,24 @@ Labels Icons @@ -544,7 +576,8 @@ @@ -552,7 +585,8 @@ @@ -560,7 +594,8 @@ @@ -1676,27 +1711,27 @@ Click to configure: - Heightmap - Biomes - States - Provinces - Diplomacy - Cultures - Namesbase - Zones - Religions - Emblems - Units - Notes + Heightmap + Biomes + States + Provinces + Diplomacy + Cultures + Namesbase + Zones + Religions + Emblems + Units + Notes Click to overview: - Burgs - Rivers - Military - Markers - Cells + Burgs + Rivers + Military + Markers + Cells Click to regenerate: @@ -1727,11 +1762,11 @@ Click to add: - Burg - Label - River - Route - Marker + Burg + Label + River + Route + Marker Click to create a new map: @@ -1879,11 +1914,11 @@ - New Map + New Map Export Save Load - Reset Zoom + Reset Zoom @@ -2039,7 +2074,7 @@ - + @@ -2098,7 +2133,7 @@ - + @@ -2219,7 +2254,7 @@ - + @@ -2227,7 +2262,7 @@ - + @@ -2414,7 +2449,7 @@ - + @@ -2560,7 +2595,7 @@ - + @@ -2619,7 +2654,7 @@ - + @@ -2648,7 +2683,7 @@ - + @@ -2863,7 +2898,7 @@ - + Radius: - Brush radius: - Brush size: - Brush: - + @@ -3512,7 +3547,7 @@ - Brush size: Save map to - machine - dropbox - browser + machine + dropbox + browser Maps are saved in .map format, that can be loaded back via the Load in menu. There is no way to restore the progress if file is lost. diff --git a/main.js b/main.js index b62b6cfd..cbd67e94 100644 --- a/main.js +++ b/main.js @@ -10,6 +10,9 @@ const TIME = DEBUG || !PRODUCTION; const WARN = true; const ERROR = true; +// detect device +const MOBILE = window.innerWidth < 600 || navigator.userAgentData?.mobile; + if (PRODUCTION && "serviceWorker" in navigator) { window.addEventListener("load", () => { navigator.serviceWorker.register("./sw.js").catch(err => { diff --git a/modules/dynamic/editors/cultures-editor.js b/modules/dynamic/editors/cultures-editor.js index 90aa6f33..b3003584 100644 --- a/modules/dynamic/editors/cultures-editor.js +++ b/modules/dynamic/editors/cultures-editor.js @@ -51,7 +51,7 @@ function insertEditorHtml() { - Brush size: + Brush size: - Brush size: clearMainTip(), time); + if (time) setTimeout(clearMainTip, time); } function showMainTip() { @@ -47,11 +51,16 @@ function clearMainTip() { } // show tip at the bottom of the screen, consider possible translation -function showDataTip(e) { - if (!e.target) return; - let dataTip = e.target.dataset.tip; - if (!dataTip && e.target.parentNode.dataset.tip) dataTip = e.target.parentNode.dataset.tip; +function showDataTip(event) { + if (!event.target) return; + + let dataTip = event.target.dataset.tip; + if (!dataTip && event.target.parentNode.dataset.tip) dataTip = event.target.parentNode.dataset.tip; if (!dataTip) return; + + const shortcut = event.target.dataset.shortcut; + if (shortcut && !MOBILE) dataTip += `. Shortcut: ${shortcut}`; + //const tooltip = lang === "en" ? dataTip : translate(e.target.dataset.t || e.target.parentNode.dataset.t, dataTip); tip(dataTip); } diff --git a/modules/ui/world-configurator.js b/modules/ui/world-configurator.js index 6fbc117a..73a3621e 100644 --- a/modules/ui/world-configurator.js +++ b/modules/ui/world-configurator.js @@ -73,16 +73,16 @@ function editWorld() { const eqD = ((graphHeight / 2) * 100) / size; calculateMapCoordinates(); - const mc = mapCoordinates; // shortcut - const scale = +distanceScaleInput.value, - unit = distanceUnitInput.value; + const mc = mapCoordinates; + const scale = +distanceScaleInput.value; + const unit = distanceUnitInput.value; const meridian = toKilometer(eqD * 2 * scale); - document.getElementById("mapSize").innerHTML = /* html */ `${graphWidth}x${graphHeight}`; - document.getElementById("mapSizeFriendly").innerHTML = /* html */ `${rn(graphWidth * scale)}x${rn(graphHeight * scale)} ${unit}`; + document.getElementById("mapSize").innerHTML = `${graphWidth}x${graphHeight}`; + document.getElementById("mapSizeFriendly").innerHTML = `${rn(graphWidth * scale)}x${rn(graphHeight * scale)} ${unit}`; document.getElementById("meridianLength").innerHTML = rn(eqD * 2); - document.getElementById("meridianLengthFriendly").innerHTML = /* html */ `${rn(eqD * 2 * scale)} ${unit}`; + document.getElementById("meridianLengthFriendly").innerHTML = `${rn(eqD * 2 * scale)} ${unit}`; document.getElementById("meridianLengthEarth").innerHTML = meridian ? " = " + rn(meridian / 200) + "%🌏" : ""; - document.getElementById("mapCoordinates").innerHTML = /* html */ `${lat(mc.latN)} ${Math.abs(rn(mc.lonW))}°W; ${lat(mc.latS)} ${rn(mc.lonE)}°E`; + document.getElementById("mapCoordinates").innerHTML = `${lat(mc.latN)} ${Math.abs(rn(mc.lonW))}°W; ${lat(mc.latS)} ${rn(mc.lonE)}°E`; function toKilometer(v) { if (unit === "km") return v; @@ -92,9 +92,11 @@ function editWorld() { return 0; // 0 if distanceUnitInput is a custom unit } + // parse latitude value function lat(lat) { return lat > 0 ? Math.abs(rn(lat)) + "°N" : Math.abs(rn(lat)) + "°S"; - } // parse latitude value + } + const area = d3.geoGraticule().extent([ [mc.lonW, mc.latN], [mc.lonE, mc.latS]
Click to configure:
Click to overview:
Click to regenerate:
Click to add:
Click to create a new map:
Maps are saved in .map format, that can be loaded back via the Load in menu. There is no way to restore the progress if file is lost. diff --git a/main.js b/main.js index b62b6cfd..cbd67e94 100644 --- a/main.js +++ b/main.js @@ -10,6 +10,9 @@ const TIME = DEBUG || !PRODUCTION; const WARN = true; const ERROR = true; +// detect device +const MOBILE = window.innerWidth < 600 || navigator.userAgentData?.mobile; + if (PRODUCTION && "serviceWorker" in navigator) { window.addEventListener("load", () => { navigator.serviceWorker.register("./sw.js").catch(err => { diff --git a/modules/dynamic/editors/cultures-editor.js b/modules/dynamic/editors/cultures-editor.js index 90aa6f33..b3003584 100644 --- a/modules/dynamic/editors/cultures-editor.js +++ b/modules/dynamic/editors/cultures-editor.js @@ -51,7 +51,7 @@ function insertEditorHtml() {