track xpos for belt widgets

This commit is contained in:
Stewart Allen 2021-01-09 12:56:11 -05:00
commit d89674f1d5
2 changed files with 4 additions and 2 deletions

View file

@ -66,6 +66,7 @@ KIRI.worker = {
let widget = cache[data.id],
last = time(),
xpos,
ypos,
now;
@ -74,6 +75,7 @@ KIRI.worker = {
let rotation = (Math.PI/180) * (settings.device.bedBelt ? 45 : 0);
if (rotation) {
let track = widget.track;
xpos = track.pos.x;
ypos = track.pos.y + settings.device.bedDepth / 2 - track.box.h / 2;
widget.mesh = null;
widget.points = null;
@ -106,7 +108,7 @@ KIRI.worker = {
let wbb = widget.getBoundingBox(true);
let dy = (wbb.max.y + wbb.min.y)/2;
let dz = wbb.min.z;
widget.rotinfo = { angle: 45, dy, dz, ypos };
widget.rotinfo = { angle: 45, dy, dz, xpos, ypos };
send.data({ rotinfo: widget.rotinfo });
}
}

View file

@ -301,6 +301,7 @@
let offset = Object.clone(mesh.position || center);
if (isBelt) {
offset = center;
offset.x = widget.rotinfo.xpos;
offset.y = widget.rotinfo.dz;
offset.z = widget.rotinfo.ypos;
} else {
@ -363,7 +364,6 @@
}
layerout.height = layerout.height || closest.slice.height;
slices[minidx] = null;
// if (!isBelt) closest.offset.z = zoff;
// detect extruder change and print purge block
if (!lastOut || lastOut.extruder !== closest.slice.extruder) {
printPoint = purge(closest.slice.extruder, track, layerout, printPoint, closest.slice.z);