diff --git a/src/kiri/init.js b/src/kiri/init.js index 33288e06..183875d0 100644 --- a/src/kiri/init.js +++ b/src/kiri/init.js @@ -1998,10 +1998,10 @@ API.platform.update_size(); - SPACE.mouse.onHover((int, ev) => { + SPACE.mouse.onHover((int, ev, ints) => { if (!API.feature.hover) return; if (!int) return API.widgets.meshes(); - API.event.emit('mouse.hover', {int, point: int.point, type: 'widget'}); + API.event.emit('mouse.hover', {int, ints, point: int.point, type: 'widget'}); }); SPACE.platform.onHover((int, ev) => { diff --git a/src/kiri/slicer2.js b/src/kiri/slicer2.js index 3b68fbe9..ff27a737 100644 --- a/src/kiri/slicer2.js +++ b/src/kiri/slicer2.js @@ -611,6 +611,7 @@ // emit a polygon if it can be cleaned and still have 2 or more points function emit(poly) { poly = poly.clean(); + if (poly.length === 2 && opt.openok) poly.setOpen(); if (poly.length >= minPoly) output.push(poly); } diff --git a/src/mode/cam/client.js b/src/mode/cam/client.js index 7b879be7..6de4a38d 100644 --- a/src/mode/cam/client.js +++ b/src/mode/cam/client.js @@ -37,13 +37,18 @@ $('set-tools').style.display = isCamMode ? '' : 'none'; kiri.space.platform.setColor(isCamMode ? 0xeeeeee : 0xcccccc); updateStock(undefined, 'internal'); - if (!isCamMode) func.tabClear(); + if (!isCamMode) { + func.tabClear(); + func.traceDone(); + } }); api.event.on("view.set", (mode) => { isArrange = (mode === VIEWS.ARRANGE); isAnimate = false; CAM.animate_clear(api); + func.tabDone(); + func.traceDone(); }); api.event.on("settings.saved", (settings) => { @@ -142,6 +147,10 @@ delbox('tabb'); api.hide.alert(alert); api.feature.hover = false; + if (lastTab) { + lastTab.box.material.color.r = 0; + lastTab = null; + } }); api.event.on("cam.tabs.clear", func.tabClear = () => { func.tabDone(); @@ -269,6 +278,9 @@ lastTrace = null; return; } + // if (data.ints.length === 2) { + // console.log(data.ints); + // } lastTrace = data.int.object; let material = lastTrace.material[0]; let color = material.color; diff --git a/src/mode/cam/slice.js b/src/mode/cam/slice.js index 1c0ad1c2..0f8e09e3 100644 --- a/src/mode/cam/slice.js +++ b/src/mode/cam/slice.js @@ -538,13 +538,15 @@ .sort((a,b) => b - a); let traces = []; slicer.slice(indices, { each: (data, index, total) => { - let slice = data.slice; - traces.push(slice); - if (true) slice.output() - .setLayer("trace", {line: 0x88aa55}, false) - .addPolys(slice.topPolys()) - // updateOp(index, total); - }, genso: true, emptyok: true, flatoff: 0, edges: true, openok: true }); + // create separate slice for each poly (and inner) + BASE.polygons.flatten(data.tops,null,true).forEach(poly => { + let trace = KIRI.newSlice(data.z); + trace.output('trace') + .setLayer("trace", {line: 0x88aa55}, false) + .addPoly(poly); + traces.push(trace); + }); + }, flatoff: 0, edges: true, openok: true }); widget.traces = traces; }; diff --git a/src/moto/space.js b/src/moto/space.js index 32f46b96..0c2d5745 100644 --- a/src/moto/space.js +++ b/src/moto/space.js @@ -710,7 +710,7 @@ let selection = mouseHover ? mouseHover() : null; if (selection && selection.length > 0) { int = intersect(selection, selectRecurse); - if (int.length > 0) mouseHover(int[0], event); + if (int.length > 0) mouseHover(int[0], event, int); } if ((!int || int.length == 0) && platformHover) { vis = platform.visible;