Skip to content

Commit

Permalink
history changing Data
Browse files Browse the repository at this point in the history
  • Loading branch information
kleber-swf committed Sep 2, 2021
1 parent 0e0e11e commit 609697d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/data/history.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Data, DataOrigin } from './data';

export interface HistoryEntry {
obj: PIXI.DisplayObject;
properties: { [id: string]: any };
Expand Down Expand Up @@ -26,8 +28,14 @@ class HistoryClass {
public undo() {
if (this.entries.length === 0) return;
const entry = this.entries.pop();
Data.selectObject(entry.obj, DataOrigin.HISTORY);

Object.keys(entry.properties)
.forEach(k => entry.obj[k] = entry.properties[k]);
.forEach(k => {
entry.obj[k] = entry.properties[k];
Data.propertyChanged(k, entry.properties[k], DataOrigin.HISTORY);
});

entry.obj.updateTransform();
this.onHistoryWalk.dispatch(entry);
}
Expand Down

0 comments on commit 609697d

Please sign in to comment.