fix purge blocks for second non-belt orientation

This commit is contained in:
Stewart Allen 2021-11-17 19:05:52 -05:00
commit 520d0d806a
2 changed files with 14 additions and 7 deletions

View file

@ -563,7 +563,7 @@ console.log/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
KIRI.work.png({}, data => {
png = data.png;
});
// console.log({meta,palette});
console.log({meta,palette});
downloadPalette.onclick = function() {
KIRI.client.zip([
{name:"meta.json", data:JSON.stringify(meta,undefined,4)},

View file

@ -250,7 +250,14 @@
function mkblok(w,h) {
let stepw = w + nozzle / 2;
if (bounds.min.x < bounds.min.y && !isBelt) {
if (isBelt) {
let my = (bounds.max.y + bounds.min.y) / 2;
let mp = (extcount * w) / 2 + (w / 2);
let py = my - mp;
blokpos = { x:bounds.max.x + 2 + h / 2, y:isBelt ? -mp : py};
walkpos = { x:0, y:stepw };
blok = { x:h, y:w };
} else if (bounds.min.x < bounds.min.y) {
let mx = (bounds.max.x + bounds.min.x) / 2;
let px = mx - (extcount * w) / 2 + (w / 2);
let dx = ((bounds.max.x - bounds.min.x) - (extcount * w)) / 2;
@ -259,11 +266,11 @@
blok = { x:w, y:h };
} else {
let my = (bounds.max.y + bounds.min.y) / 2;
let mp = (extcount * w) / 2 + (w / 2);
let py = my - mp;
blokpos = { x:bounds.max.x + 2 + h / 2, y:isBelt ? -mp : py};
walkpos = { x:0, y:stepw };
blok = { x:h, y:w };
let py = my - (extcount * w) / 2 + (w / 2);
let dy = ((bounds.max.y - bounds.min.y) - (extcount * w)) / 2;
blokpos = { y:py, x: bounds.max.x + 2 + h / 2};
walkpos = { y:stepw, x:0 };
blok = { x:w, y:h };
}
}