This commit is contained in:
Azgaar 2024-07-27 14:32:42 +02:00
parent a5a638c439
commit 00abd5213b
3 changed files with 14 additions and 8 deletions

View file

@ -8161,7 +8161,7 @@
<script defer src="modules/io/save.js?v=1.98.01"></script> <script defer src="modules/io/save.js?v=1.98.01"></script>
<script defer src="modules/io/load.js?v=1.98.01"></script> <script defer src="modules/io/load.js?v=1.98.01"></script>
<script defer src="modules/io/cloud.js?v=1.96.00"></script> <script defer src="modules/io/cloud.js?v=1.96.00"></script>
<script defer src="modules/io/export.js?v=1.98.01"></script> <script defer src="modules/io/export.js?v=1.98.05"></script>
<!-- Web Components --> <!-- Web Components -->
<script defer src="components/fill-box.js"></script> <script defer src="components/fill-box.js"></script>

View file

@ -87,7 +87,7 @@ async function exportToPngTiles() {
imgSchema.src = urlSchema; imgSchema.src = urlSchema;
await loadImage(imgSchema); await loadImage(imgSchema);
status.innerHTML = "Drawing schema..."; status.innerHTML = "Rendering schema...";
ctx.drawImage(imgSchema, 0, 0, canvas.width, canvas.height); ctx.drawImage(imgSchema, 0, 0, canvas.width, canvas.height);
const blob = await canvasToBlob(canvas, "image/png"); const blob = await canvasToBlob(canvas, "image/png");
ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.clearRect(0, 0, canvas.width, canvas.height);
@ -95,9 +95,9 @@ async function exportToPngTiles() {
// download tiles // download tiles
const url = await getMapURL("tiles", {fullMap: true}); const url = await getMapURL("tiles", {fullMap: true});
const tilesX = +byId("tileColsInput").value; const tilesX = +byId("tileColsOutput").value || 2;
const tilesY = +byId("tileRowsInput").value; const tilesY = +byId("tileRowsOutput").value || 2;
const scale = +byId("tileScaleInput").value; const scale = +byId("tileScaleOutput").value || 1;
const tolesTotal = tilesX * tilesY; const tolesTotal = tilesX * tilesY;
const tileW = (graphWidth / tilesX) | 0; const tileW = (graphWidth / tilesX) | 0;
@ -113,11 +113,17 @@ async function exportToPngTiles() {
await loadImage(img); await loadImage(img);
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
function getRowLabel(row) {
const first = row >= alphabet.length ? alphabet[Math.floor(row / alphabet.length) - 1] : "";
const last = alphabet[row % alphabet.length];
return first + last;
}
for (let y = 0, row = 0, id = 1; y + tileH <= graphHeight; y += tileH, row++) { for (let y = 0, row = 0, id = 1; y + tileH <= graphHeight; y += tileH, row++) {
const rowName = alphabet[row % alphabet.length]; const rowName = getRowLabel(row);
for (let x = 0, cell = 1; x + tileW <= graphWidth; x += tileW, cell++, id++) { for (let x = 0, cell = 1; x + tileW <= graphWidth; x += tileW, cell++, id++) {
status.innerHTML = `Drawing tile ${rowName}${cell} (${id} of ${tolesTotal})...`; status.innerHTML = `Rendering tile ${rowName}${cell} (${id} of ${tolesTotal})...`;
ctx.drawImage(img, x, y, tileW, tileH, 0, 0, width, height); ctx.drawImage(img, x, y, tileW, tileH, 0, 0, width, height);
const blob = await canvasToBlob(canvas, "image/png"); const blob = await canvasToBlob(canvas, "image/png");
ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.clearRect(0, 0, canvas.width, canvas.height);

View file

@ -1,7 +1,7 @@
"use strict"; "use strict";
// version and caching control // version and caching control
const version = "1.98.04"; // generator version, update each time const version = "1.98.05"; // generator version, update each time
{ {
document.title += " v" + version; document.title += " v" + version;