fix support and rotate, codec for server workers, click on support error

This commit is contained in:
Stewart Allen 2020-11-23 18:16:45 -05:00
commit 975dbde473
6 changed files with 39 additions and 21 deletions

View file

@ -48,7 +48,7 @@
this.depth = 0; // depth nested from top parent (density for support fill) this.depth = 0; // depth nested from top parent (density for support fill)
this.delete = false; // for culling during tracing this.delete = false; // for culling during tracing
this.fillang = null; // hinted fill angle this.fillang = null; // hinted fill angle
this.fills = null; // fill lines (only used by supports currently) this.fill = null; // fill lines (only used by supports currently)
if (points) this.addPoints(points); if (points) this.addPoints(points);
} }

View file

@ -203,6 +203,13 @@
} }
}); });
} }
if (d.cpath) {
d.cpath.forEach(rec => {
if (rec.count === null) {
rec.count = Infinity;
}
});
}
// console.log('<--',d); // console.log('<--',d);
} }
return render; return render;

View file

@ -1944,7 +1944,9 @@
} }
if (event && event.target.nodeName === "CANVAS") { if (event && event.target.nodeName === "CANVAS") {
if (selection) { if (selection) {
platform.select(selection.object.widget, event.shiftKey); if (selection.object.widget) {
platform.select(selection.object.widget, event.shiftKey);
}
} else { } else {
platform.deselect(); platform.deselect();
} }

View file

@ -992,6 +992,7 @@
if (viewMode !== VIEWS.ARRANGE) return; if (viewMode !== VIEWS.ARRANGE) return;
forSelectedGroups(function (w) { forSelectedGroups(function (w) {
w.rotate(x, y, z); w.rotate(x, y, z);
API.event.emit('widget.rotate', {widget: w, x, y, z});
}); });
updateSelectedBounds(); updateSelectedBounds();
platform.compute_max_z(); platform.compute_max_z();

View file

@ -70,27 +70,22 @@
api.event.on("key.esc", () => { api.event.on("key.esc", () => {
func.sdone() func.sdone()
}); });
api.event.on("selection.rotate", rot => { api.event.on("widget.rotate", rot => {
const {x, y, z} = rot; const {widget, x, y, z} = rot;
if (x || y) { if (x || y) {
API.selection.widgets().forEach(widget => { clearWidgetSupports(widget);
clearWidgetSupports(widget);
});
API.conf.save();
} else { } else {
API.selection.widgets().forEach(widget => { let ann = API.widgets.annotate(widget.id);
let ann = API.widgets.annotate(widget.id); let sups = ann.support || [];
let sups = ann.support || []; sups.forEach(sup => {
sups.forEach(sup => { let wsup = widget.sups[sup.id];
let wsup = widget.sups[sup.id]; let vc = new THREE.Vector3(sup.x, sup.y, sup.z);
let vc = new THREE.Vector3(sup.x, sup.y, sup.z); let m4 = new THREE.Matrix4();
let m4 = new THREE.Matrix4(); m4 = m4.makeRotationFromEuler(new THREE.Euler(x || 0, y || 0, z || 0));
m4 = m4.makeRotationFromEuler(new THREE.Euler(x || 0, y || 0, z || 0)); vc.applyMatrix4(m4);
vc.applyMatrix4(m4); wsup.box.position.x = wsup.x = sup.x = vc.x;
wsup.box.position.x = wsup.x = sup.x = vc.x; wsup.box.position.y = wsup.y = sup.y = vc.y;
wsup.box.position.y = wsup.y = sup.y = vc.y; wsup.box.position.z = wsup.z = sup.z = vc.z;
wsup.box.position.z = wsup.z = sup.z = vc.z;
});
}); });
} }
}); });

View file

@ -462,6 +462,19 @@
} }
} }
// for unbound workers
// if (self.WASM) {
// let {exports} = wasmInstance;
// let heap = new Uint8Array(exports.memory.buffer);
// self.wasm = {
// heap,
// memory: exports.memory,
// // heap: wasmMemory,
// // memory: memoryBytes,
// render: exports.render,
// rle_encode: exports.rle_encode
// };
// } else
// load renderer code in worker context only // load renderer code in worker context only
fetch('/wasm/kiri-sla.wasm') fetch('/wasm/kiri-sla.wasm')
.then(response => response.arrayBuffer()) .then(response => response.arrayBuffer())