diff --git a/src/modules/leaflet-control-map-settings.js b/src/modules/leaflet-control-map-settings.js index 9a410b82a..92f163633 100644 --- a/src/modules/leaflet-control-map-settings.js +++ b/src/modules/leaflet-control-map-settings.js @@ -142,6 +142,24 @@ L.Control.MapSettings = L.Control.extend({ const alwaysShowExtractsLabelContent = L.DomUtil.create("span", undefined, alwaysShowExtractsLabel); alwaysShowExtractsLabelContent.textContent = this.options.alwaysShowExtractsLabel; + // always show hazard bounds setting + const alwaysShowHazardBoundsDiv = L.DomUtil.create("div", `${className}-setting-container`, form); + + const alwaysShowHazardBoundsLabel = L.DomUtil.create("label", undefined, alwaysShowHazardBoundsDiv); + alwaysShowHazardBoundsLabel.setAttribute("for", "alwaysShowHazardBounds"); + + const alwaysShowHazardBoundsCheckbox = L.DomUtil.create("input", undefined, alwaysShowHazardBoundsLabel); + alwaysShowHazardBoundsCheckbox.id = "alwaysShowHazardBounds"; + alwaysShowHazardBoundsCheckbox.setAttribute("type", "checkbox"); + if (this.options.alwaysShowHazardBounds) { + alwaysShowHazardBoundsCheckbox.setAttribute("checked", !!this.options.alwaysShowHazardBounds); + alwaysShowHazardBoundsCheckbox.checked = true; + } + L.DomEvent.on(alwaysShowHazardBoundsCheckbox, "click", this._onSettingChanged, this); + + const alwaysShowHazardBoundsLabelContent = L.DomUtil.create("span", undefined, alwaysShowHazardBoundsLabel); + alwaysShowHazardBoundsLabelContent.textContent = this.options.alwaysShowHazardBoundsLabel; + L.DomUtil.create("div", `${className}-separator player-location-help-separator`, form); // show location labels setting diff --git a/src/pages/map/index.css b/src/pages/map/index.css index e9d378da5..f85949ab9 100644 --- a/src/pages/map/index.css +++ b/src/pages/map/index.css @@ -152,6 +152,10 @@ div.leaflet-overlay-pane > svg.leaflet-zoom-animated > g > path.off-level { fill-opacity: 0.02; } +.leaflet-container.always-show-hazard-bounds .hazard-outline.not-shown { + display: block; +} + .not-shown { display: none; } diff --git a/src/pages/map/index.jsx b/src/pages/map/index.jsx index f0e60a2ca..d4824a991 100644 --- a/src/pages/map/index.jsx +++ b/src/pages/map/index.jsx @@ -305,6 +305,7 @@ function Map() { expandSearch: false, alwaysShowSnipers: true, alwaysShowExtracts: false, + alwaysShowHazardBounds: false, hiddenTasks: [], }); @@ -541,6 +542,8 @@ function Map() { alwaysShowSnipersLabel: tMaps("Always show snipers"), alwaysShowExtracts: !!mapSettingsRef.current.alwaysShowExtracts, alwaysShowExtractsLabel: tMaps("Always show extracts"), + alwaysShowHazardBounds: mapSettingsRef.current.alwaysShowHazardBounds ?? false, + alwaysShowHazardBoundsLabel: tMaps("Always show hazard outlines"), collapsed: true, }) .addTo(map); @@ -573,6 +576,13 @@ function Map() { map._container.classList.remove("always-show-extracts"); } } + if (e.settingName === "alwaysShowHazardBounds") { + if (e.settingValue) { + map._container.classList.add("always-show-hazard-bounds"); + } else { + map._container.classList.remove("always-show-hazard-bounds"); + } + } mapSettingsRef.current[e.settingName] = e.settingValue; updateSavedMapSettings(); }); @@ -582,6 +592,9 @@ function Map() { if (mapSettingsRef.current.alwaysShowExtracts ?? false) { map._container.classList.add("always-show-extracts"); } + if (mapSettingsRef.current.alwaysShowHazardBounds ?? false) { + map._container.classList.add("always-show-hazard-bounds"); + } map.raidInfoControl = L.control .raidInfo({ @@ -1666,7 +1679,7 @@ function Map() { const rect = L.polygon(outlineToPoly(hazard.outline), { color: "#ff0000", weight: 1, - className: "not-shown", + className: "hazard-outline not-shown", }); const hazardIcon = L.icon({ iconUrl: `${process.env.PUBLIC_URL}/maps/interactive/hazard.png`, diff --git a/src/translations/de/maps.json b/src/translations/de/maps.json index 558556d0b..c775b7cd6 100644 --- a/src/translations/de/maps.json +++ b/src/translations/de/maps.json @@ -61,5 +61,6 @@ "All": "All", "None": "None", "Search": "Search", - "Always show extracts": "Always show extracts" + "Always show extracts": "Always show extracts", + "Always show hazard outlines": "Always show hazard outlines" } \ No newline at end of file diff --git a/src/translations/en/maps.json b/src/translations/en/maps.json index 1c5fac58c..7197fb15c 100644 --- a/src/translations/en/maps.json +++ b/src/translations/en/maps.json @@ -62,5 +62,6 @@ "All": "All", "None": "None", "Search": "Search", - "Always show extracts": "Always show extracts" + "Always show extracts": "Always show extracts", + "Always show hazard outlines": "Always show hazard outlines" } \ No newline at end of file diff --git a/src/translations/es/maps.json b/src/translations/es/maps.json index de9b832cd..3b65a3ce5 100644 --- a/src/translations/es/maps.json +++ b/src/translations/es/maps.json @@ -62,5 +62,6 @@ "All": "All", "None": "None", "Search": "Search", - "Always show extracts": "Always show extracts" + "Always show extracts": "Always show extracts", + "Always show hazard outlines": "Always show hazard outlines" } \ No newline at end of file diff --git a/src/translations/fr/maps.json b/src/translations/fr/maps.json index 1a8b70250..c1e6c2f87 100644 --- a/src/translations/fr/maps.json +++ b/src/translations/fr/maps.json @@ -62,5 +62,6 @@ "All": "All", "None": "None", "Search": "Search", - "Always show extracts": "Always show extracts" + "Always show extracts": "Always show extracts", + "Always show hazard outlines": "Always show hazard outlines" } diff --git a/src/translations/it/maps.json b/src/translations/it/maps.json index d91659c1b..502df2bc0 100644 --- a/src/translations/it/maps.json +++ b/src/translations/it/maps.json @@ -62,5 +62,6 @@ "All": "All", "None": "None", "Search": "Search", - "Always show extracts": "Always show extracts" + "Always show extracts": "Always show extracts", + "Always show hazard outlines": "Always show hazard outlines" } \ No newline at end of file diff --git a/src/translations/ja/maps.json b/src/translations/ja/maps.json index c7fb439c2..c9ea20b20 100644 --- a/src/translations/ja/maps.json +++ b/src/translations/ja/maps.json @@ -62,5 +62,6 @@ "All": "All", "None": "None", "Search": "Search", - "Always show extracts": "Always show extracts" + "Always show extracts": "Always show extracts", + "Always show hazard outlines": "Always show hazard outlines" } \ No newline at end of file diff --git a/src/translations/pl/maps.json b/src/translations/pl/maps.json index 469980fc5..8ce5a43b3 100644 --- a/src/translations/pl/maps.json +++ b/src/translations/pl/maps.json @@ -62,5 +62,6 @@ "All": "All", "None": "None", "Search": "Search", - "Always show extracts": "Always show extracts" + "Always show extracts": "Always show extracts", + "Always show hazard outlines": "Always show hazard outlines" } \ No newline at end of file diff --git a/src/translations/pt/maps.json b/src/translations/pt/maps.json index 52aaf2cea..07e2acdcf 100644 --- a/src/translations/pt/maps.json +++ b/src/translations/pt/maps.json @@ -62,5 +62,6 @@ "All": "All", "None": "None", "Search": "Search", - "Always show extracts": "Always show extracts" + "Always show extracts": "Always show extracts", + "Always show hazard outlines": "Always show hazard outlines" } \ No newline at end of file diff --git a/src/translations/ru/maps.json b/src/translations/ru/maps.json index cb0425c94..7d3e5ac58 100644 --- a/src/translations/ru/maps.json +++ b/src/translations/ru/maps.json @@ -62,5 +62,6 @@ "All": "All", "None": "None", "Search": "Search", - "Always show extracts": "Always show extracts" + "Always show extracts": "Always show extracts", + "Always show hazard outlines": "Always show hazard outlines" } \ No newline at end of file diff --git a/src/translations/zh/maps.json b/src/translations/zh/maps.json index b63b48091..5e2b7b35b 100644 --- a/src/translations/zh/maps.json +++ b/src/translations/zh/maps.json @@ -63,5 +63,6 @@ "All": "全部", "None": "无", "Search": "搜索", - "Always show extracts": "总是显示撤离点" + "Always show extracts": "总是显示撤离点", + "Always show hazard outlines": "Always show hazard outlines" } \ No newline at end of file