From d32cf6a2fbb26d3f9ed8880aa2307b4bfb53e372 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Mon, 28 Dec 2020 09:57:26 -0500 Subject: [PATCH] flip tabs with part --- src/mode/cam/client.js | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/mode/cam/client.js b/src/mode/cam/client.js index 3d67b9fe..a1843aec 100644 --- a/src/mode/cam/client.js +++ b/src/mode/cam/client.js @@ -361,7 +361,8 @@ func.opFlip = () => { let { process } = current; let { ops, op2 } = process; - let add2 = op2.length === 0; // add flip singleton to b-side + // add flip singleton to b-side + let add2 = op2.length === 0; let axis = poppedRec.axis; flipping = true; process.camZAnchor = { @@ -369,13 +370,29 @@ bottom: "top", middle: "middle" }[process.camZAnchor]; - switch (axis) { - case 'X': - API.selection.rotate(Math.PI, 0, 0); - break; - case 'Y': - API.selection.rotate(0, Math.PI, 0); - break; + // flip tabs + API.widgets.all().forEach(widget => { + let anno = API.widgets.annotate(widget.id).tab || []; + for (let tab of anno) { + let wtp = widget.tabs[tab.id].box.position; + if (axis === 'X') { + tab.pos.y = -tab.pos.y; + wtp.y = -wtp.y; + } + if (axis === 'Y') { + tab.pos.x = -tab.pos.x; + wtp.x = -wtp.x; + } + tab.pos.z = widget.bounds.max.z - tab.pos.z; + wtp.z = widget.bounds.max.z - wtp.z; + } + }); + // flip widget + if (axis === 'X') { + API.selection.rotate(Math.PI, 0, 0); + } + if (axis === 'Y') { + API.selection.rotate(0, Math.PI, 0); } flipping = false; process.ops = op2;