This commit is contained in:
Azgaar 2020-04-09 21:03:02 +03:00
parent 5e9bd86069
commit 12a96938d2

View file

@ -153,12 +153,13 @@ function changeMapSize() {
// just apply canvas size that was already set // just apply canvas size that was already set
function applyMapSize() { function applyMapSize() {
const zoomMin = +zoomExtentMin.value, zoomMax = +zoomExtentMax.value;
graphWidth = +mapWidthInput.value; graphWidth = +mapWidthInput.value;
graphHeight = +mapHeightInput.value; graphHeight = +mapHeightInput.value;
svgWidth = Math.min(graphWidth, window.innerWidth) svgWidth = Math.min(graphWidth, window.innerWidth);
svgHeight = Math.min(graphHeight, window.innerHeight) svgHeight = Math.min(graphHeight, window.innerHeight);
svg.attr("width", svgWidth).attr("height", svgHeight); svg.attr("width", svgWidth).attr("height", svgHeight);
zoom.translateExtent([[0, 0],[graphWidth, graphHeight]]).scaleExtent([1, 20]).scaleTo(svg, 1); zoom.translateExtent([[0, 0],[graphWidth, graphHeight]]).scaleExtent([zoomMin, zoomMax]).scaleTo(svg, zoomMin);
//viewbox.attr("transform", null).attr("clip-path", "url(#mapClip)"); //viewbox.attr("transform", null).attr("clip-path", "url(#mapClip)");
//defs.append("clipPath").attr("id", "mapClip").append("rect").attr("x", 0).attr("y", 0).attr("width", graphWidth).attr("height", graphHeight); //defs.append("clipPath").attr("id", "mapClip").append("rect").attr("x", 0).attr("y", 0).attr("width", graphWidth).attr("height", graphHeight);
//zoom.translateExtent([[-svgWidth*.2, -graphHeight*.2], [svgWidth*1.2, graphHeight*1.2]]); //zoom.translateExtent([[-svgWidth*.2, -graphHeight*.2], [svgWidth*1.2, graphHeight*1.2]]);