fix tab re-create on slice after rotate
This commit is contained in:
parent
7befba7040
commit
6c89d99bb8
3 changed files with 8 additions and 19 deletions
|
|
@ -87,6 +87,12 @@ export function addWidgetTab(widget, rec) {
|
|||
}
|
||||
}
|
||||
|
||||
export function recreateTabs() {
|
||||
let widgets = api.widgets.all();
|
||||
for (let w of widgets) clearTabs(w, true);
|
||||
restoreTabs(widgets);
|
||||
}
|
||||
|
||||
export function restoreTabs(widgets) {
|
||||
widgets.forEach(widget => {
|
||||
const tabs = api.widgets.annotate(widget.id).tab || [];
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import { helicalOn, helicalDone } from './cl-helical.js';
|
|||
import { originSelectDone } from './cl-origin.js';
|
||||
import { Widget, newWidget } from '../../core/widget.js';
|
||||
import { space } from '../../../moto/space.js';
|
||||
import { recreateTabs } from './cl-tab.js';
|
||||
|
||||
const { BufferGeometryUtils } = THREE;
|
||||
|
||||
|
|
@ -808,6 +809,7 @@ export function init() {
|
|||
return;
|
||||
}
|
||||
clearPops();
|
||||
recreateTabs();
|
||||
for (let group of Widget.Groups.list()) {
|
||||
let root = group[0];
|
||||
if (root.tabs)
|
||||
|
|
|
|||
|
|
@ -99,25 +99,6 @@ export async function cam_slice(settings, widget, onupdate, ondone) {
|
|||
// initial setup
|
||||
var_compute();
|
||||
|
||||
if (tabs) {
|
||||
// create tab polygons. defer offset to each op
|
||||
// since it's dependent on selected tool diameter
|
||||
tabs.forEach(tab => {
|
||||
let zero = newPoint(0, 0, 0),
|
||||
point = newPoint(tab.pos.x, tab.pos.y, tab.pos.z),
|
||||
poly = newPolygon().centerRectangle(zero, tab.dim.x, tab.dim.y),
|
||||
[rx, ry, rz, rw] = tab.rot,
|
||||
m4 = new THREE.Matrix4().makeRotationFromQuaternion(
|
||||
new THREE.Quaternion(rx, ry, rz, rw)
|
||||
);
|
||||
poly.points = poly.points
|
||||
.map(p => new THREE.Vector3(p.x, p.y, p.z).applyMatrix4(m4))
|
||||
.map(v => newPoint(v.x, v.y, v.z));
|
||||
poly.move(point);
|
||||
tab.poly = poly;
|
||||
});
|
||||
}
|
||||
|
||||
function error(msg) {
|
||||
ondone(msg);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue