fix autosave on widget drag

This commit is contained in:
Stewart Allen 2020-11-20 10:44:36 -05:00
commit 2370702464
2 changed files with 5 additions and 10 deletions

View file

@ -1911,11 +1911,7 @@
if (bound.max.x + delta.x >= width) return; if (bound.max.x + delta.x >= width) return;
if (bound.max.y + delta.y >= depth) return; if (bound.max.y + delta.y >= depth) return;
} }
API.selection.for_widgets(function(widget) { API.selection.move(delta.x, delta.y, 0);
widget.move(delta.x, delta.y, 0);
API.event.emit('widget.move', {widget, delta});
});
API.selection.update_bounds();
API.event.emit('selection.drag', delta); API.event.emit('selection.drag', delta);
} else { } else {
return API.selection.meshes().length > 0; return API.selection.meshes().length > 0;

View file

@ -82,8 +82,7 @@
widgets: function() { return selectedMeshes.slice().map(m => m.widget) }, widgets: function() { return selectedMeshes.slice().map(m => m.widget) },
for_groups: forSelectedGroups, for_groups: forSelectedGroups,
for_meshes: forSelectedMeshes, for_meshes: forSelectedMeshes,
for_widgets: forSelectedWidgets, for_widgets: forSelectedWidgets
update_bounds: updateSelectedBounds
}; };
const platform = { const platform = {
@ -951,10 +950,10 @@
function moveSelection(x, y, z, abs) { function moveSelection(x, y, z, abs) {
if (viewMode !== VIEWS.ARRANGE) return; if (viewMode !== VIEWS.ARRANGE) return;
// setViewMode(VIEWS.ARRANGE);
forSelectedGroups(function (w) { forSelectedGroups(function (w) {
w.move(x, y, z, abs); w.move(x, y, z, abs);
}); });
updateSelectedBounds();
API.event.emit('selection.move', {x, y, z, abs}); API.event.emit('selection.move', {x, y, z, abs});
SPACE.update(); SPACE.update();
auto_save(); auto_save();
@ -962,12 +961,12 @@
function scaleSelection() { function scaleSelection() {
if (viewMode !== VIEWS.ARRANGE) return; if (viewMode !== VIEWS.ARRANGE) return;
// setViewMode(VIEWS.ARRANGE);
let args = arguments; let args = arguments;
forSelectedGroups(function (w) { forSelectedGroups(function (w) {
w.scale(...args); w.scale(...args);
}); });
platform.compute_max_z(); platform.compute_max_z();
updateSelectedBounds();
API.event.emit('selection.scale', [...arguments]); API.event.emit('selection.scale', [...arguments]);
// skip update if last argument is strictly 'false' // skip update if last argument is strictly 'false'
if ([...arguments].pop() === false) { if ([...arguments].pop() === false) {
@ -980,10 +979,10 @@
function rotateSelection(x, y, z) { function rotateSelection(x, y, z) {
if (viewMode !== VIEWS.ARRANGE) return; if (viewMode !== VIEWS.ARRANGE) return;
// setViewMode(VIEWS.ARRANGE);
forSelectedGroups(function (w) { forSelectedGroups(function (w) {
w.rotate(x, y, z); w.rotate(x, y, z);
}); });
updateSelectedBounds();
platform.compute_max_z(); platform.compute_max_z();
API.event.emit('selection.rotate', {x, y, z}); API.event.emit('selection.rotate', {x, y, z});
updateSelectedInfo(); updateSelectedInfo();