editor: undo/redo: compute path intersection to make sure all widgets are updated
This commit is contained in:
parent
71dc1752a9
commit
dd3726c3bf
1 changed files with 37 additions and 2 deletions
|
|
@ -544,10 +544,11 @@ var Editor = class Editor {
|
|||
}
|
||||
|
||||
if (w.props.width !== undefined || w.props.height !== undefined) newWidgets.push(updateWidget(w, {preventSelect: this.selectedWidgets.length > 1}))
|
||||
this.pushHistory()
|
||||
|
||||
}
|
||||
|
||||
this.pushHistory()
|
||||
|
||||
if (newWidgets.length > 1) this.select(newWidgets, {preventSelect: this.selectedWidgets.length > 1})
|
||||
|
||||
}
|
||||
|
|
@ -572,10 +573,11 @@ var Editor = class Editor {
|
|||
}
|
||||
|
||||
newWidgets.push(updateWidget(w, {preventSelect: this.selectedWidgets.length > 1}))
|
||||
this.pushHistory()
|
||||
|
||||
}
|
||||
|
||||
this.pushHistory()
|
||||
|
||||
if (newWidgets.length > 1) this.select(newWidgets)
|
||||
|
||||
}
|
||||
|
|
@ -625,6 +627,23 @@ var Editor = class Editor {
|
|||
if (!path || path.length > d1[i].path.length) path = d1[i].path
|
||||
}
|
||||
|
||||
if (d1.length > 1) {
|
||||
// path intersection
|
||||
var stop, j, k, n
|
||||
for (j = 0; j < path.length; j++) {
|
||||
for (k = 0; k < d1.length; k++) {
|
||||
if (d1[k].path[j] !== path[j]) {
|
||||
stop = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if (stop) break
|
||||
}
|
||||
n = stop ? j : j - 1
|
||||
path.splice(n, path.length - n)
|
||||
}
|
||||
|
||||
|
||||
this.updateWidgetByPath(path)
|
||||
|
||||
}
|
||||
|
|
@ -643,6 +662,22 @@ var Editor = class Editor {
|
|||
if (!path || path.length > d1[i].path.length) path = d1[i].path
|
||||
}
|
||||
|
||||
if (d1.length > 1) {
|
||||
// path intersection
|
||||
var stop, j, k, n
|
||||
for (j = 0; j < path.length; j++) {
|
||||
for (k = 0; k < d1.length; k++) {
|
||||
if (d1[k].path[j] !== path[j]) {
|
||||
stop = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if (stop) break
|
||||
}
|
||||
n = stop ? j : j - 1
|
||||
path.splice(n, path.length - n)
|
||||
}
|
||||
|
||||
this.updateWidgetByPath(path)
|
||||
|
||||
this.historyState -= 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue