diff --git a/src/kiri/init.js b/src/kiri/init.js index 4e928651..2deeb528 100644 --- a/src/kiri/init.js +++ b/src/kiri/init.js @@ -490,10 +490,7 @@ } function mirrorSelection() { - API.selection.for_widgets(function(widget) { - widget.mirror(); - }); - SPACE.update(); + API.selection.mirror(); } function keys(o) { @@ -540,7 +537,7 @@ y = y - current.device.bedDepth/2 + (bounds.max.y - bounds.min.y)/2 } - moveSelection(x, y, z, true); + API.selection.move(x, y, z, true); } function deviceExport(exp, name) { diff --git a/src/kiri/main.js b/src/kiri/main.js index f62cfb8f..b85f5036 100644 --- a/src/kiri/main.js +++ b/src/kiri/main.js @@ -77,6 +77,7 @@ move: moveSelection, scale: scaleSelection, rotate: rotateSelection, + mirror: mirrorSelection, meshes: function() { return selectedMeshes.slice() }, widgets: function(orall) { let sel = selectedMeshes.slice().map(m => m.widget); @@ -1454,6 +1455,15 @@ SPACE.update(); } + function mirrorSelection() { + API.selection.for_widgets(function(widget) { + widget.mirror(); + API.event.emit("widget.mirror", widget); + }); + SPACE.update(); + auto_save(); + } + function moveSelection(x, y, z, abs) { if (viewMode !== VIEWS.ARRANGE) return; forSelectedGroups(function (w) { diff --git a/src/mode/fdm/client.js b/src/mode/fdm/client.js index 28c339a9..92d266da 100644 --- a/src/mode/fdm/client.js +++ b/src/mode/fdm/client.js @@ -294,6 +294,17 @@ func.sclear(); } }); + api.event.on("widget.mirror", widget => { + if (!isFdmMode) { + return; + } + let ann = API.widgets.annotate(widget.id); + let sups = ann.support || []; + sups.forEach(sup => { + let wsup = widget.sups[sup.id]; + wsup.box.position.x = wsup.x = sup.x = -sup.x; + }); + }); api.event.on("widget.rotate", rot => { if (!isFdmMode) { return;