diff --git a/src/js/tools/transform/AbstractTransformTool.js b/src/js/tools/transform/AbstractTransformTool.js index caae702f..780412a8 100644 --- a/src/js/tools/transform/AbstractTransformTool.js +++ b/src/js/tools/transform/AbstractTransformTool.js @@ -8,7 +8,15 @@ ns.AbstractTransformTool.prototype.apply = function (evt) { var allFrames = evt.shiftKey; var allLayers = evt.ctrlKey; + this.applyTool_(evt.altKey, allFrames, allLayers); + + $.publish(Events.PISKEL_RESET); + this.raiseSaveStateEvent_({ + altKey : evt.altKey, + allFrames : allFrames, + allLayers : allLayers + }); }; ns.AbstractTransformTool.prototype.applyTool_ = function (altKey, allFrames, allLayers) { @@ -20,13 +28,6 @@ this.applyToolOnFrame_(frame, altKey); }.bind(this)); }.bind(this)); - - $.publish(Events.PISKEL_RESET); - this.raiseSaveStateEvent_({ - altKey : altKey, - allFrames : allFrames, - allLayers : allLayers - }); }; ns.AbstractTransformTool.prototype.raiseSaveStateEvent_ = function (replayData) { diff --git a/src/js/tools/transform/Clone.js b/src/js/tools/transform/Clone.js index b79a6334..95440688 100644 --- a/src/js/tools/transform/Clone.js +++ b/src/js/tools/transform/Clone.js @@ -17,7 +17,5 @@ frame.setPixels(ref.getPixels()); } }); - $.publish(Events.PISKEL_RESET); - this.raiseSaveStateEvent_({}); }; })(); diff --git a/test/drawing/DrawingTests.browser.js b/test/drawing/DrawingTests.browser.js index 6ab99c75..195b8147 100644 --- a/test/drawing/DrawingTests.browser.js +++ b/test/drawing/DrawingTests.browser.js @@ -19,6 +19,7 @@ "transform.clone.twice.undo.once.json", "transform.rotate.once.alt.json", "transform.rotate.twice.undo.once.json", - "transform.mirror.once.alt.json", - "transform.mirror.twice.undo.once.json" + "transform.flip.once.alt.json", + "transform.flip.twice.undo.once.json", + "transform.flip.thrice.undo.all.redo.all.json" ]} \ No newline at end of file diff --git a/test/drawing/DrawingTests.casper.js b/test/drawing/DrawingTests.casper.js index 2f67e613..59d54d65 100644 --- a/test/drawing/DrawingTests.casper.js +++ b/test/drawing/DrawingTests.casper.js @@ -18,6 +18,7 @@ "transform.clone.twice.undo.once.json", "transform.rotate.once.alt.json", "transform.rotate.twice.undo.once.json", - "transform.mirror.once.alt.json", - "transform.mirror.twice.undo.once.json" + "transform.flip.once.alt.json", + "transform.flip.twice.undo.once.json", + "transform.flip.thrice.undo.all.redo.all.json" ]; \ No newline at end of file diff --git a/test/drawing/tests/transform.mirror.once.alt.json b/test/drawing/tests/transform.flip.once.alt.json similarity index 100% rename from test/drawing/tests/transform.mirror.once.alt.json rename to test/drawing/tests/transform.flip.once.alt.json diff --git a/test/drawing/tests/transform.flip.thrice.undo.all.redo.all.json b/test/drawing/tests/transform.flip.thrice.undo.all.redo.all.json new file mode 100644 index 00000000..233becd5 --- /dev/null +++ b/test/drawing/tests/transform.flip.thrice.undo.all.redo.all.json @@ -0,0 +1,135 @@ +{ + "events": [{ + "event": { + "type": "mousedown", + "button": 0, + "shiftKey": false, + "altKey": false, + "ctrlKey": false + }, + "coords": { + "x": 0, + "y": 0 + }, + "type": "mouse-event" + }, { + "event": { + "type": "mousemove", + "button": 0, + "shiftKey": false, + "altKey": false, + "ctrlKey": false + }, + "coords": { + "x": 0, + "y": 0 + }, + "type": "mouse-event" + }, { + "event": { + "type": "mouseup", + "button": 0, + "shiftKey": false, + "altKey": false, + "ctrlKey": false + }, + "coords": { + "x": 0, + "y": 0 + }, + "type": "mouse-event" + }, { + "type": "transformtool-event", + "toolId": "tool-flip", + "event": { + "shiftKey": false, + "altKey": false, + "ctrlKey": false + } + }, { + "type": "transformtool-event", + "toolId": "tool-flip", + "event": { + "shiftKey": false, + "altKey": false, + "ctrlKey": false + } + }, { + "type": "keyboard-event", + "event": { + "which": 90, + "shiftKey": false, + "altKey": false, + "ctrlKey": true, + "target": { + "nodeName": "BODY" + } + } + }, { + "type": "keyboard-event", + "event": { + "which": 90, + "shiftKey": false, + "altKey": false, + "ctrlKey": true, + "target": { + "nodeName": "BODY" + } + } + }, { + "type": "keyboard-event", + "event": { + "which": 90, + "shiftKey": false, + "altKey": false, + "ctrlKey": true, + "target": { + "nodeName": "BODY" + } + } + }, { + "type": "keyboard-event", + "event": { + "which": 89, + "shiftKey": false, + "altKey": false, + "ctrlKey": true, + "target": { + "nodeName": "BODY" + } + } + }, { + "type": "keyboard-event", + "event": { + "which": 89, + "shiftKey": false, + "altKey": false, + "ctrlKey": true, + "target": { + "nodeName": "BODY" + } + } + }, { + "type": "keyboard-event", + "event": { + "which": 89, + "shiftKey": false, + "altKey": false, + "ctrlKey": true, + "target": { + "nodeName": "BODY" + } + } + }], + "initialState": { + "size": { + "width": 2, + "height": 2 + }, + "primaryColor": "#000000", + "secondaryColor": "rgba(0, 0, 0, 0)", + "selectedTool": "tool-pen", + "step": 100 + }, + "png": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFElEQVQIW2NkYGD4z8DAwMjIAAUADikBA/ggJToAAAAASUVORK5CYII=" +} diff --git a/test/drawing/tests/transform.mirror.twice.undo.once.json b/test/drawing/tests/transform.flip.twice.undo.once.json similarity index 100% rename from test/drawing/tests/transform.mirror.twice.undo.once.json rename to test/drawing/tests/transform.flip.twice.undo.once.json