fix bug with supports not following a part mirror and mirror not triggering a workspace save

This commit is contained in:
Stewart Allen 2021-03-25 14:19:17 -04:00
commit 995e23bbca
3 changed files with 23 additions and 5 deletions

View file

@ -490,10 +490,7 @@
} }
function mirrorSelection() { function mirrorSelection() {
API.selection.for_widgets(function(widget) { API.selection.mirror();
widget.mirror();
});
SPACE.update();
} }
function keys(o) { function keys(o) {
@ -540,7 +537,7 @@
y = y - current.device.bedDepth/2 + (bounds.max.y - bounds.min.y)/2 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) { function deviceExport(exp, name) {

View file

@ -77,6 +77,7 @@
move: moveSelection, move: moveSelection,
scale: scaleSelection, scale: scaleSelection,
rotate: rotateSelection, rotate: rotateSelection,
mirror: mirrorSelection,
meshes: function() { return selectedMeshes.slice() }, meshes: function() { return selectedMeshes.slice() },
widgets: function(orall) { widgets: function(orall) {
let sel = selectedMeshes.slice().map(m => m.widget); let sel = selectedMeshes.slice().map(m => m.widget);
@ -1454,6 +1455,15 @@
SPACE.update(); 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) { function moveSelection(x, y, z, abs) {
if (viewMode !== VIEWS.ARRANGE) return; if (viewMode !== VIEWS.ARRANGE) return;
forSelectedGroups(function (w) { forSelectedGroups(function (w) {

View file

@ -294,6 +294,17 @@
func.sclear(); 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 => { api.event.on("widget.rotate", rot => {
if (!isFdmMode) { if (!isFdmMode) {
return; return;