Merge branch 'master' of https://github.com/Azgaar/Fantasy-Map-Generator into burg-groups

This commit is contained in:
Azgaar 2024-12-14 15:16:27 +01:00
commit 34ad8015f7
5 changed files with 20 additions and 13 deletions

View file

@ -138,7 +138,7 @@
} }
</style> </style>
<link rel="preload" href="index.css?v=1.105.7" as="style" onload="this.onload=null; this.rel='stylesheet'" /> <link rel="preload" href="index.css?v=1.106.3" as="style" onload="this.onload=null; this.rel='stylesheet'" />
<link rel="preload" href="icons.css" as="style" onload="this.onload=null; this.rel='stylesheet'" /> <link rel="preload" href="icons.css" as="style" onload="this.onload=null; this.rel='stylesheet'" />
<link rel="preload" href="libs/jquery-ui.css" as="style" onload="this.onload=null; this.rel='stylesheet'" /> <link rel="preload" href="libs/jquery-ui.css" as="style" onload="this.onload=null; this.rel='stylesheet'" />
</head> </head>
@ -8117,7 +8117,7 @@
<script src="modules/markers-generator.js?v=1.104.0"></script> <script src="modules/markers-generator.js?v=1.104.0"></script>
<script src="modules/zones-generator.js?v=1.106.0"></script> <script src="modules/zones-generator.js?v=1.106.0"></script>
<script src="modules/coa-generator.js?v=1.99.00"></script> <script src="modules/coa-generator.js?v=1.99.00"></script>
<script src="modules/resample.js?v=1.105.13"></script> <script src="modules/resample.js?v=1.106.4"></script>
<script src="libs/alea.min.js?v1.105.0"></script> <script src="libs/alea.min.js?v1.105.0"></script>
<script src="libs/polylabel.min.js?v1.105.0"></script> <script src="libs/polylabel.min.js?v1.105.0"></script>
<script src="libs/lineclip.min.js?v1.105.0"></script> <script src="libs/lineclip.min.js?v1.105.0"></script>
@ -8127,7 +8127,7 @@
<script src="modules/ui/measurers.js?v=1.99.00"></script> <script src="modules/ui/measurers.js?v=1.99.00"></script>
<script src="modules/ui/style-presets.js?v=1.100.00"></script> <script src="modules/ui/style-presets.js?v=1.100.00"></script>
<script src="modules/ui/general.js?v=1.100.00"></script> <script src="modules/ui/general.js?v=1.100.00"></script>
<script src="modules/ui/options.js?v=1.106.0"></script> <script src="modules/ui/options.js?v=1.106.2"></script>
<script src="main.js?v=1.106.0"></script> <script src="main.js?v=1.106.0"></script>
<script defer src="modules/relief-icons.js?v=1.99.05"></script> <script defer src="modules/relief-icons.js?v=1.99.05"></script>
@ -8169,8 +8169,8 @@
<script defer src="modules/ui/emblems-editor.js?v=1.99.00"></script> <script defer src="modules/ui/emblems-editor.js?v=1.99.00"></script>
<script defer src="modules/ui/markers-editor.js?v=1.99.00"></script> <script defer src="modules/ui/markers-editor.js?v=1.99.00"></script>
<script defer src="modules/ui/3d.js?v=1.99.00"></script> <script defer src="modules/ui/3d.js?v=1.99.00"></script>
<script defer src="modules/ui/submap-tool.js?v=1.105.13"></script> <script defer src="modules/ui/submap-tool.js?v=1.106.2"></script>
<script defer src="modules/ui/transform-tool.js?v=1.105.13"></script> <script defer src="modules/ui/transform-tool.js?v=1.106.2"></script>
<script defer src="modules/ui/hotkeys.js?v=1.104.0"></script> <script defer src="modules/ui/hotkeys.js?v=1.104.0"></script>
<script defer src="modules/coa-renderer.js?v=1.99.00"></script> <script defer src="modules/coa-renderer.js?v=1.99.00"></script>
<script defer src="libs/rgbquant.min.js"></script> <script defer src="libs/rgbquant.min.js"></script>

View file

@ -254,9 +254,11 @@ window.Resample = (function () {
}); });
if (points.length < 2) return null; if (points.length < 2) return null;
const firstCell = points[0][2]; const bbox = [0, 0, graphWidth, graphHeight];
const clipped = lineclip(points, bbox)[0].map(([x, y]) => [rn(x, 2), rn(y, 2), findCell(x, y)]);
const firstCell = clipped[0][2];
const feature = pack.cells.f[firstCell]; const feature = pack.cells.f[firstCell];
return {...route, feature, points}; return {...route, feature, points: clipped};
}) })
.filter(Boolean); .filter(Boolean);

View file

@ -210,16 +210,16 @@ function fitMapToScreen() {
svgHeight = Math.min(+mapHeightInput.value, window.innerHeight); svgHeight = Math.min(+mapHeightInput.value, window.innerHeight);
svg.attr("width", svgWidth).attr("height", svgHeight); svg.attr("width", svgWidth).attr("height", svgHeight);
const zoomExtent = [
[0, 0],
[graphWidth, graphHeight]
];
const zoomMin = rn(Math.max(svgWidth / graphWidth, svgHeight / graphHeight), 3); const zoomMin = rn(Math.max(svgWidth / graphWidth, svgHeight / graphHeight), 3);
zoomExtentMin.value = zoomMin; zoomExtentMin.value = zoomMin;
const zoomMax = +zoomExtentMax.value; const zoomMax = +zoomExtentMax.value;
zoom.translateExtent(zoomExtent).scaleExtent([zoomMin, zoomMax]).scaleTo(svg, zoomMin); zoom
.translateExtent([
[0, 0],
[graphWidth, graphHeight]
])
.scaleExtent([zoomMin, zoomMax]);
fitScaleBar(scaleBar, svgWidth, svgHeight); fitScaleBar(scaleBar, svgWidth, svgHeight);
if (window.fitLegendBox) fitLegendBox(); if (window.fitLegendBox) fitLegendBox();

View file

@ -49,6 +49,8 @@ function openSubmapTool() {
const projection = (x, y) => [(x - x0) * scale, (y - y0) * scale]; const projection = (x, y) => [(x - x0) * scale, (y - y0) * scale];
const inverse = (x, y) => [x / scale + x0, y / scale + y0]; const inverse = (x, y) => [x / scale + x0, y / scale + y0];
applyGraphSize();
fitMapToScreen();
resetZoom(0); resetZoom(0);
undraw(); undraw();
Resample.process({projection, inverse, scale}); Resample.process({projection, inverse, scale});

View file

@ -132,9 +132,12 @@ async function openTransformTool() {
const [projection, inverse] = getProjection(); const [projection, inverse] = getProjection();
applyGraphSize();
fitMapToScreen();
resetZoom(0); resetZoom(0);
undraw(); undraw();
Resample.process({projection, inverse, scale: 1}); Resample.process({projection, inverse, scale: 1});
drawLayers(); drawLayers();
INFO && console.groupEnd("transformMap"); INFO && console.groupEnd("transformMap");