From e1d3a95aae362c853997251dd3e5c41ce8ae801c Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Mon, 11 Jan 2021 12:26:19 -0500 Subject: [PATCH] fix tab dissociation in rotated asymmetric parts --- notes.md | 1 - src/kiri/widget.js | 1 + src/mode/cam/client.js | 5 +++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/notes.md b/notes.md index 79f7c8c3..d4c62ab0 100644 --- a/notes.md +++ b/notes.md @@ -58,7 +58,6 @@ * `B` starting export during animation unleashes chaos * `B` climb vs conventional not fully consistent after refactor * `B` outside cutting direction in roughing mode inverted -* `B` on rotation, tabs dissociate from parts whose center changes with rotation * `F` new registration style: offset cutout * `F` add climb/conventional into each operation diff --git a/src/kiri/widget.js b/src/kiri/widget.js index 9af9587b..15ff2b00 100644 --- a/src/kiri/widget.js +++ b/src/kiri/widget.js @@ -349,6 +349,7 @@ dx = bm.x + bd.x, dy = bm.y + bd.y, dz = bm.z; + this.track.center = { dx, dy, dz }; // move mesh for each widget in group if (!init) { this.group.forEach(w => { diff --git a/src/mode/cam/client.js b/src/mode/cam/client.js index 7fd1f995..1c9414d7 100644 --- a/src/mode/cam/client.js +++ b/src/mode/cam/client.js @@ -742,6 +742,7 @@ let tabs = API.widgets.annotate(widget.id).tab || []; tabs.forEach(rec => { let { id, pos, rot } = rec; + let coff = widget.track.center; let tab = widget.tabs[id]; let m4 = new THREE.Matrix4().makeRotationFromEuler(new THREE.Euler(x || 0, y || 0, z || 0)); // update position vector @@ -752,8 +753,8 @@ new THREE.Quaternion().setFromRotationMatrix(m4) ); tab.box.geometry.applyMatrix4(m4); - tab.box.position.x = pos.x = vc.x; - tab.box.position.y = pos.y = vc.y; + tab.box.position.x = pos.x = vc.x - coff.dx; + tab.box.position.y = pos.y = vc.y - coff.dy; tab.box.position.z = pos.z = vc.z; }); SPACE.update();