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.delete = false; // for culling during tracing
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);
}

View file

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

View file

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

View file

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

View file

@ -70,15 +70,11 @@
api.event.on("key.esc", () => {
func.sdone()
});
api.event.on("selection.rotate", rot => {
const {x, y, z} = rot;
api.event.on("widget.rotate", rot => {
const {widget, x, y, z} = rot;
if (x || y) {
API.selection.widgets().forEach(widget => {
clearWidgetSupports(widget);
});
API.conf.save();
} else {
API.selection.widgets().forEach(widget => {
let ann = API.widgets.annotate(widget.id);
let sups = ann.support || [];
sups.forEach(sup => {
@ -91,7 +87,6 @@
wsup.box.position.y = wsup.y = sup.y = vc.y;
wsup.box.position.z = wsup.z = sup.z = vc.z;
});
});
}
});
api.event.on("mouse.hover.up", int => {

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
fetch('/wasm/kiri-sla.wasm')
.then(response => response.arrayBuffer())