fix: rescale water mask on screen size change

This commit is contained in:
Azgaar 2023-11-19 14:43:30 +04:00
parent e4064f249b
commit 09ee0c0769

View file

@ -186,6 +186,7 @@ function changeMapSize() {
const maxWidth = Math.max(+mapWidthInput.value, graphWidth); const maxWidth = Math.max(+mapWidthInput.value, graphWidth);
const maxHeight = Math.max(+mapHeightInput.value, graphHeight); const maxHeight = Math.max(+mapHeightInput.value, graphHeight);
zoom.translateExtent([ zoom.translateExtent([
[0, 0], [0, 0],
[maxWidth, maxHeight] [maxWidth, maxHeight]
@ -196,6 +197,7 @@ function changeMapSize() {
oceanLayers.select("rect").attr("x", 0).attr("y", 0).attr("width", maxWidth).attr("height", maxHeight); oceanLayers.select("rect").attr("x", 0).attr("y", 0).attr("width", maxWidth).attr("height", maxHeight);
fogging.selectAll("rect").attr("x", 0).attr("y", 0).attr("width", maxWidth).attr("height", maxHeight); fogging.selectAll("rect").attr("x", 0).attr("y", 0).attr("width", maxWidth).attr("height", maxHeight);
defs.select("mask#fog > rect").attr("width", maxWidth).attr("height", maxHeight); defs.select("mask#fog > rect").attr("width", maxWidth).attr("height", maxHeight);
defs.select("mask#water > rect").attr("width", maxWidth).attr("height", maxHeight);
fitScaleBar(); fitScaleBar();
if (window.fitLegendBox) fitLegendBox(); if (window.fitLegendBox) fitLegendBox();