fix slicing of slabs (requires pocket bottom revisit)
This commit is contained in:
parent
4ba452d812
commit
a077cf5739
6 changed files with 22 additions and 10 deletions
|
|
@ -241,7 +241,8 @@ function updateFieldsFromSettings(setrec, uirec = api.ui, opt = {}) {
|
||||||
if (!uirec.hasOwnProperty(key)) {
|
if (!uirec.hasOwnProperty(key)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let uie = uirec[key], typ = uie ? uie.type : null;
|
let uie = uirec[key],
|
||||||
|
typ = uie ? uie.type : null;
|
||||||
if (opt.trace) {
|
if (opt.trace) {
|
||||||
console.log({ key, uie, typ, val });
|
console.log({ key, uie, typ, val });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ export const UI = {
|
||||||
bound,
|
bound,
|
||||||
toInt,
|
toInt,
|
||||||
toFloat,
|
toFloat,
|
||||||
|
toFloatArray,
|
||||||
toDegsFloat,
|
toDegsFloat,
|
||||||
isSticky,
|
isSticky,
|
||||||
setSticky,
|
setSticky,
|
||||||
|
|
@ -327,22 +328,28 @@ function toInt() {
|
||||||
function toFloat() {
|
function toFloat() {
|
||||||
let nv = this.value !== '' ? parseFloat(this.value) : null;
|
let nv = this.value !== '' ? parseFloat(this.value) : null;
|
||||||
if (nv !== null && this.bound) nv = this.bound(nv);
|
if (nv !== null && this.bound) nv = this.bound(nv);
|
||||||
|
this.value = nv;
|
||||||
if (this.setv) {
|
if (this.setv) {
|
||||||
return this.setv(nv * units);
|
return this.setv(nv * units);
|
||||||
} else {
|
|
||||||
this.value = nv;
|
|
||||||
}
|
}
|
||||||
return nv;
|
return nv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toFloatArray() {
|
||||||
|
let nv = this.value !== '' ? this.value.split(',').map(v => parseFloat(v)) : null;
|
||||||
|
console.log({ toFloatArray: nv });
|
||||||
|
if (this.bound) nv = nv.map(v => this.bound(v));
|
||||||
|
this.array = nv;
|
||||||
|
return nv;
|
||||||
|
}
|
||||||
|
|
||||||
function toDegsFloat(){
|
function toDegsFloat(){
|
||||||
let nv = this.value !== '' ? parseFloat(this.value) : null;
|
let nv = this.value !== '' ? parseFloat(this.value) : null;
|
||||||
if (nv !== null && this.bound) nv = this.bound(nv);
|
if (nv !== null && this.bound) nv = this.bound(nv);
|
||||||
nv = (nv+360)% 360; // bound the val to 0-359.99
|
nv = (nv+360)% 360; // bound the val to 0-359.99
|
||||||
|
this.value = nv;
|
||||||
if (this.setv) {
|
if (this.setv) {
|
||||||
return this.setv(nv);
|
return this.setv(nv);
|
||||||
} else {
|
|
||||||
this.value = nv;
|
|
||||||
}
|
}
|
||||||
return nv;
|
return nv;
|
||||||
}
|
}
|
||||||
|
|
@ -610,8 +617,8 @@ function newInput(label, opt = {}) {
|
||||||
hide = opt.hide,
|
hide = opt.hide,
|
||||||
size = opt.size ?? 5,
|
size = opt.size ?? 5,
|
||||||
height = opt.height || 0,
|
height = opt.height || 0,
|
||||||
ip = height > 1 ? DOC.createElement('textarea') : DOC.createElement('input'),
|
action = opt.action || bindTo || inputAction,
|
||||||
action = opt.action || bindTo || inputAction;
|
ip = height > 1 ? DOC.createElement('textarea') : DOC.createElement('input');
|
||||||
|
|
||||||
row.appendChild(newLabel(label));
|
row.appendChild(newLabel(label));
|
||||||
row.appendChild(ip);
|
row.appendChild(ip);
|
||||||
|
|
|
||||||
|
|
@ -920,7 +920,7 @@ class Widget {
|
||||||
if (a.z < z && b.z < z && c.z < z) {
|
if (a.z < z && b.z < z && c.z < z) {
|
||||||
// skip faces under threshold
|
// skip faces under threshold
|
||||||
continue;
|
continue;
|
||||||
} else if (a.z === z && a.z === b.z && a.z === c.z) {
|
// } else if (a.z === z && a.z === b.z && a.z === c.z) {
|
||||||
// skip faces coplanar with z (shadow looks up)
|
// skip faces coplanar with z (shadow looks up)
|
||||||
} else if (a.z >= z && b.z >= z && c.z >= z) {
|
} else if (a.z >= z && b.z >= z && c.z >= z) {
|
||||||
found.push([a, b, c]);
|
found.push([a, b, c]);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ const { MODES } = api.const;
|
||||||
const { uc: UC } = api;
|
const { uc: UC } = api;
|
||||||
const { alerts, conf } = api;
|
const { alerts, conf } = api;
|
||||||
const { current: LANG } = api.language;
|
const { current: LANG } = api.language;
|
||||||
const { toInt, toFloat } = UC;
|
const { toInt, toFloat, toFloatArray } = UC;
|
||||||
|
|
||||||
const units = true;
|
const units = true;
|
||||||
let seed = Date.now();
|
let seed = Date.now();
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,10 @@ class OpOutline extends CamOp {
|
||||||
async slice(progress) {
|
async slice(progress) {
|
||||||
let { op, state } = this;
|
let { op, state } = this;
|
||||||
let { shadow, tool, widget } = state;
|
let { shadow, tool, widget } = state;
|
||||||
|
let shadow_base = shadow.base;
|
||||||
|
if (!(shadow_base && shadow_base.length)) {
|
||||||
|
throw 'missing shadow base';
|
||||||
|
}
|
||||||
let areas = POLY.flatten(POLY.expand(shadow.base, tool.fluteDiameter() / 2 - 0.001));
|
let areas = POLY.flatten(POLY.expand(shadow.base, tool.fluteDiameter() / 2 - 0.001));
|
||||||
let cutout = {
|
let cutout = {
|
||||||
areas: { [widget.id]: areas.map(p => p.toArray()) },
|
areas: { [widget.id]: areas.map(p => p.toArray()) },
|
||||||
|
|
|
||||||
|
|
@ -1412,7 +1412,7 @@ details[open] summary::after {
|
||||||
background-color: var(--blue-2);
|
background-color: var(--blue-2);
|
||||||
}
|
}
|
||||||
#oplist > div {
|
#oplist > div {
|
||||||
padding: 5px 20px 5px 7px !important;
|
padding: 4px 20px 4px 7px !important;
|
||||||
}
|
}
|
||||||
#oplist > div, .opdiv {
|
#oplist > div, .opdiv {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue