fix color index mismatch

This commit is contained in:
Stewart Allen 2020-11-09 01:42:17 -05:00
commit bd160df487
2 changed files with 10 additions and 10 deletions

View file

@ -195,7 +195,9 @@
MODES, MODES,
VIEWS, VIEWS,
SETUP, SETUP,
SECURE SECURE,
STACKS,
SPACE
}, },
var: { var: {
layer_lo: 0, layer_lo: 0,
@ -272,7 +274,7 @@
reload: reload, reload: reload,
restore: restoreWorkspace, restore: restoreWorkspace,
clear: clearWorkspace, clear: clearWorkspace,
save: saveWorkspace, save: saveWorkspace
}, },
tweak, tweak,
util: { util: {

View file

@ -178,9 +178,8 @@
// allow changing colors // allow changing colors
if (opts.color) { if (opts.color) {
if (!cur.cpath) { if (!cur.cpath) {
// seed
cur.cpath = [ Object.assign({ start: 0, count: indln - 1 }, cur.color) ]; cur.cpath = [ Object.assign({ start: 0, count: indln - 1 }, cur.color) ];
} else { }
// rewrite last color count if color or opacity have changed // rewrite last color count if color or opacity have changed
const pc = cur.cpath[cur.cpath.length - 1]; const pc = cur.cpath[cur.cpath.length - 1];
if (pc.face !== opts.color.face || pc.opacity !== opts.color.opacity) { if (pc.face !== opts.color.face || pc.opacity !== opts.color.opacity) {
@ -188,7 +187,6 @@
cur.cpath.push(Object.assign({ start: indln, count: Infinity }, opts.color)); cur.cpath.push(Object.assign({ start: indln, count: Infinity }, opts.color));
} }
} }
}
} else { } else {
cur.paths.push({ index, faces, z: poly.getZ() }); cur.paths.push({ index, faces, z: poly.getZ() });
} }