Skip to content

Commit

Permalink
Editor Viewer: Slot not being updated for groups
Browse files Browse the repository at this point in the history
  • Loading branch information
maurofmferrao committed Aug 28, 2024
1 parent 8be002a commit b31560d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ui/src/editor-core/history-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ HistoryManager.prototype.revertChange = function() {
widget.saveElements({
elements: elementsToSave,
addToHistory: false,
reload: true,
updateEditor: true,
}).then(function() {
// Remove change from history
self.removeLastChange();
Expand Down
8 changes: 6 additions & 2 deletions ui/src/editor-core/properties-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,9 @@ PropertiesPanel.prototype.saveElement = function(
this.toSaveElementCallback = null;

// Save elements to the widget
return parentWidget.saveElements().then((_res) => {
return parentWidget.saveElements({
reloadData: false,
}).then((_res) => {
// Update element position
if (positionChanged) {
app.viewer.updateElement(parentWidget.elements[target.elementId]);
Expand Down Expand Up @@ -799,7 +801,9 @@ PropertiesPanel.prototype.render = function(
targetAux.updateSlot(slotValue - 1, true);

// Save elements
target.saveElements().then((_res) => {
target.saveElements({
reloadData: false,
}).then((_res) => {
// Update group
app.viewer.updateElementGroup(app.selectedObject);
});
Expand Down
16 changes: 11 additions & 5 deletions ui/src/editor-core/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,8 @@ Widget.prototype.getNextWidget = function(reverse = false) {
/**
* Save elements to widget
* @param {object} elements - elements to save
* @param {boolean} reload - reload layout
* @param {boolean} updateEditor - update editor
* @param {boolean} reloadData - reload data
* @param {boolean} forceRequest
* - always make request even another one is happening
* @param {boolean} addToHistory
Expand All @@ -796,7 +797,8 @@ Widget.prototype.getNextWidget = function(reverse = false) {
Widget.prototype.saveElements = function(
{
elements = null,
reload = false,
updateEditor = false,
reloadData = true,
forceRequest = false,
addToHistory = true,
} = {},
Expand All @@ -817,10 +819,14 @@ Widget.prototype.saveElements = function(

let savePending;

const reloadLayout = function(forceReload = false) {
const reloadLayout = function() {
if (!reloadData) {
return;
}

app.reloadData(app.layout,
{
refreshEditor: (reload || forceReload),
refreshEditor: updateEditor,
});
};

Expand Down Expand Up @@ -1243,7 +1249,7 @@ Widget.prototype.removeElement = function(
// Only save if we're not removing the widget
// Save changes to widget
(save && !savedAlready) && this.saveElements({
reload: reload,
updateEditor: reload,
});

// If object is selected, remove it from selection
Expand Down

0 comments on commit b31560d

Please sign in to comment.