checkpoint traces work

This commit is contained in:
Stewart Allen 2020-12-01 00:35:25 -05:00
commit 94dc665231
5 changed files with 26 additions and 11 deletions

View file

@ -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) => {

View file

@ -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);
}

View file

@ -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;

View file

@ -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;
};

View file

@ -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;