fix belt layout, diff with anchors

This commit is contained in:
Stewart Allen 2022-03-03 12:27:49 -05:00
commit 703e63e08e
3 changed files with 28 additions and 32 deletions

View file

@ -26,6 +26,7 @@
* `C` add parameterized control of bridge/flat and infill print speeds
* `P` template vars: nozzles used and layers until next use (IDEX)
* `-` improved vertex replacement and widget update matrix tracking
* `-` api control over (non) threaded workloads and wasm
## Mesh:Tool

View file

@ -1064,7 +1064,7 @@ function doSparseLayerFill(slice, options = {}) {
*/
function doDiff(slice, options = {}) {
const { sla, fakedown, grow, min } = options;
if (slice.index === 0 && !fakedown) {
if (slice.index <= 0 && !fakedown) {
return;
}
const top = slice,

View file

@ -567,12 +567,34 @@ function platformLayout(event, gap) {
// space parts to account for anchor in belt mode
if (isBelt) {
gap += process.firstLayerBeltLead || 0;
const WIDGETS = api.widgets.all();
let bounds = platformUpdateBounds(),
movey = -(device.bedDepth / 2);
for (let widget of WIDGETS) {
let ylen = widget.track.box.h;
// only move the root widget in the group
if (widget.id === widget.group.id) {
widget.move(0, movey + ylen/2, 0, true);
movey += ylen + gap;
}
let i, m, sz = isBelt ? {
x: 1,
y: 100000
} : space.platform.size(),
}
if (controller.spaceLayout === 0) {
let sum = 0;
let sorted = WIDGETS.sort((a, b) => a.track.pos.y - b.track.pos.y);
sorted.forEach(w => {
w.move(0, sum, 0);
sum += w.track.box.d + 1 + gap;
});
}
if (controller.spaceRandoX) {
for (let w of WIDGETS) {
w.move(
(0.5 - Math.random()) * (device.bedWidth - w.track.box.w - process.firstLayerBrim),
0, 0);
}
}
} else {
let i, m, sz = space.platform.size(),
mp = [sz.x, sz.y],
ms = [mp[0] / 2, mp[1] / 2],
c = Widget.Groups.blocks().sort(moto.Sort),
@ -589,33 +611,6 @@ function platformLayout(event, gap) {
m.fit.x += m.w / 2 + p.pad;
m.fit.y += m.h / 2 + p.pad;
m.move(p.max.w / 2 - m.fit.x, p.max.h / 2 - m.fit.y, 0, true);
// m.material.visible = true;
}
if (isBelt) {
const WIDGETS = api.widgets.all();
let bounds = platformUpdateBounds(),
movey = -(device.bedDepth / 2 + bounds.min.y);
api.widgets.each(widget => {
// only move the root widget in the group
if (widget.id === widget.group.id) {
widget.move(0, movey, 0);
}
});
if (controller.spaceLayout === 0) {
let sum = 0;
let sorted = WIDGETS.sort((a, b) => a.track.pos.y - b.track.pos.y);
sorted.forEach(w => {
w.move(0, sum, 0);
sum += w.track.box.d + 1;
});
}
if (controller.spaceRandoX) {
for (let w of WIDGETS) {
w.move(
(0.5 - Math.random()) * (device.bedWidth - w.track.box.w - process.firstLayerBrim),
0, 0);
}
}
}