add origin offset reset button
This commit is contained in:
parent
5532cf28e4
commit
4197377d85
6 changed files with 43 additions and 8 deletions
|
|
@ -5,6 +5,10 @@ const boxes = [];
|
|||
|
||||
let lastBox;
|
||||
|
||||
export function clearboxes() {
|
||||
boxes.length = 0;
|
||||
}
|
||||
|
||||
export function getlastbox() {
|
||||
return lastBox;
|
||||
}
|
||||
|
|
@ -19,7 +23,7 @@ export function delbox(name) {
|
|||
export function addbox(point, color, name, dim = {x:1,y:1,z:1,rz:0}, opt = {}) {
|
||||
delbox(name);
|
||||
|
||||
const box = boxes[name] = new Mesh(
|
||||
const box = new Mesh(
|
||||
new BoxGeometry(dim.x, dim.y, dim.z),
|
||||
new MeshPhongMaterial({
|
||||
transparent: true,
|
||||
|
|
@ -28,6 +32,10 @@ export function addbox(point, color, name, dim = {x:1,y:1,z:1,rz:0}, opt = {}) {
|
|||
})
|
||||
);
|
||||
|
||||
if (name) {
|
||||
boxes[name] = box;
|
||||
}
|
||||
|
||||
box.position.x = point.x;
|
||||
box.position.y = point.y;
|
||||
box.position.z = point.z;
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ function updateSettingsFromFields(setrec, uirec = api.ui, changes) {
|
|||
}
|
||||
|
||||
// given a settings region, update values of matching bound UI fields
|
||||
function updateFieldsFromSettings(setrec, uirec = api.ui, trace) {
|
||||
function updateFieldsFromSettings(setrec, uirec = api.ui, opt = {}) {
|
||||
if (!setrec) {
|
||||
updateFieldsFromSettings(settings.device);
|
||||
updateFieldsFromSettings(settings.process);
|
||||
|
|
@ -229,6 +229,9 @@ function updateFieldsFromSettings(setrec, uirec = api.ui, trace) {
|
|||
updateExtruderFields(settings.device);
|
||||
return;
|
||||
}
|
||||
if (opt.trace) {
|
||||
console.log({ setrec, uirec });
|
||||
}
|
||||
for (let key in setrec) {
|
||||
if (!setrec.hasOwnProperty(key)) {
|
||||
continue;
|
||||
|
|
@ -238,6 +241,9 @@ function updateFieldsFromSettings(setrec, uirec = api.ui, trace) {
|
|||
continue;
|
||||
}
|
||||
let uie = uirec[key], typ = uie ? uie.type : null;
|
||||
if (opt.trace) {
|
||||
console.log({ key, uie, typ, val });
|
||||
}
|
||||
if (typ === 'text') {
|
||||
if (uie.setv) {
|
||||
uie.setv(val);
|
||||
|
|
@ -271,6 +277,8 @@ function updateFieldsFromSettings(setrec, uirec = api.ui, trace) {
|
|||
} else {
|
||||
uie.value = '';
|
||||
}
|
||||
} else if (opt.trace) {
|
||||
console.log('skipped', { key, val, typ });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -672,6 +672,7 @@ function addUnits(input, round) {
|
|||
} else {
|
||||
input.value = value;
|
||||
}
|
||||
// console.log({ value }, input.real, input.value );
|
||||
return input.real;
|
||||
};
|
||||
return input;
|
||||
|
|
|
|||
Loading…
Reference in a new issue