diff --git a/src/geo/polygons.js b/src/geo/polygons.js index 41102373..8a5d7947 100644 --- a/src/geo/polygons.js +++ b/src/geo/polygons.js @@ -481,7 +481,11 @@ export function union(polys, minarea, all, opt = {}) { } for (i=0; i= minarea) { + uset.push(out[i]); + } + } } opt.changes = length(uset) - lpre; diff --git a/src/kiri/app/keyboard.js b/src/kiri/app/keyboard.js index d0e825c9..22bb4be1 100644 --- a/src/kiri/app/keyboard.js +++ b/src/kiri/app/keyboard.js @@ -258,6 +258,7 @@ class KeyboardControl { switch (evt.key) { // case 'g': return this.#api.group.merge(); // case 'u': return this.#api.group.split(); + case 'w': return $('render-edges').onclick(); } } @@ -366,9 +367,6 @@ class KeyboardControl { case this.#cca('o'): // tools this.#api.show.tools(); break; - case this.#cca('c'): // local devices - this.#api.show.local(); - break; case this.#cca('v'): // toggle single slice view mode if (this.#api.view.get() === this.#VIEWS.ARRANGE) { this.#api.space.set_focus(this.#selection.widgets()); @@ -399,6 +397,12 @@ class KeyboardControl { this.#api.view.set(this.#VIEWS.ARRANGE); } break; + case this.#cca('w'): // set ghost + $('render-ghost').onclick(); + break; + case this.#cca('W'): // set wireframe + $('render-wire').onclick(); + break; default: this.#onUnhandledKey(evt); handled = false; diff --git a/src/kiri/app/visuals.js b/src/kiri/app/visuals.js index 1b988120..7a351f06 100644 --- a/src/kiri/app/visuals.js +++ b/src/kiri/app/visuals.js @@ -112,7 +112,7 @@ function setVisibleLayer(h, l) { * @param {number} [opacity] - Optional wireframe opacity */ function setWireframe(bool, color, opacity) { - api.widgets.each(function(w) { w.setWireframe(bool, color, opacity) }); + api.widgets.each((w) => { w.setWireframe(bool, color, opacity) }); space.update(); } @@ -303,19 +303,19 @@ function updateStats(add) { } export const visuals = { - set_progress: setProgress, - set_wireframe: setWireframe, - set_edges: setEdges, - unit_scale: unitScale, - update_speeds: updateSpeeds, - update_slider: updateSlider, - update_slider_max: updateSliderMax, - update_stack_labels: updateStackLabelState, - update_stats: updateStats, - show_slices: showSlices, hide_slices: hideSlices, - show_slider: showSlider, hide_slider: hideSlider, + set_edges: setEdges, + set_progress: setProgress, set_visible_layer: setVisibleLayer, - set_widget_visibility: setWidgetVisibility + set_widget_visibility: setWidgetVisibility, + set_wireframe: setWireframe, + show_slices: showSlices, + show_slider: showSlider, + unit_scale: unitScale, + update_slider_max: updateSliderMax, + update_slider: updateSlider, + update_speeds: updateSpeeds, + update_stack_labels: updateStackLabelState, + update_stats: updateStats }; diff --git a/src/kiri/core/widget.js b/src/kiri/core/widget.js index a1035977..20874102 100644 --- a/src/kiri/core/widget.js +++ b/src/kiri/core/widget.js @@ -703,7 +703,18 @@ class Widget { let minZabove = Math.min(Infinity, ...zover); let shadow = this.#computeShadowAt(z - 0.005, minZabove); if (minZabove < Infinity) { - shadow = POLY.union([...shadow, ...shadows[minZabove]], 0.001, true, { wasm: false }); + shadow = POLY.union([...shadow, ...shadows[minZabove]], 0, true, { wasm: false }); + // cull interior sliver voids + for (let poly of shadow) { + if (poly.inner) { + poly.inner = poly.inner.filter(inr => { + let A = inr.area(); + let P = inr.perimeter(); + let R = (2 * A / P); + return R > 0.05; + }); + } + } } return shadows[z] = POLY.setZ(shadow, z); } diff --git a/src/kiri/core/widgets.js b/src/kiri/core/widgets.js index 39d621ee..94adf087 100644 --- a/src/kiri/core/widgets.js +++ b/src/kiri/core/widgets.js @@ -105,9 +105,9 @@ export const widgets = { replace, opacity(o) { setOpacity(o); console.trace('opacity() deprecated') }, annotate, - setIndexed, setAxisIndex, setColor(c,s) { api.widgets.each(widget => widget.setColor(c,undefined,s) )}, + setIndexed, setOpacity, all() { return WIDGETS.slice() }, add(w) { return WIDGETS.push(w) },