Skip to content

Commit

Permalink
move/scale history
Browse files Browse the repository at this point in the history
  • Loading branch information
kleber-jg committed Dec 7, 2021
1 parent 85c9b68 commit 47a90ed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/editor-view/selectors/handlers/move.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class MoveHandler implements DraggingHandler {
public startHandling(e: MouseEvent, object: PIXI.DisplayObject) {
this._object = object;
SelectionUtil.mouseEventToGamePoint(e, this._point);
Editor.history.prepare(Editor.data.selectedObject, { position: object.position.clone() });
}

public handle(e: MouseEvent) {
Expand Down Expand Up @@ -54,5 +55,8 @@ export class MoveHandler implements DraggingHandler {
Editor.data.propertyChanged('_bounds', object.getBounds(), DataOrigin.SCENE);
}

public stopHandling() { this._object = null; }
public stopHandling() {
this._object = null;
Editor.history.commit();
}
}
6 changes: 6 additions & 0 deletions src/editor-view/selectors/handlers/scale.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ export class ScaleHandler implements DraggingHandler {
this._vsign = Math.sign(vside - 0.5);
this._hsign = Math.sign(hside - 0.5);

Editor.history.prepare(object, {
scale: object.scale.clone(),
position: object.position.clone(),
});

if (object.renderable) return;

if (vside === VSide.Top) this._groupStickySideVKey = 'bottom';
Expand Down Expand Up @@ -128,5 +133,6 @@ export class ScaleHandler implements DraggingHandler {
public stopHandling(): void {
this._point = null;
this._object = null;
Editor.history.commit();
}
}

0 comments on commit 47a90ed

Please sign in to comment.