From fd972c79017f64dc31a0e41c422cb212d1e42e0e Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Tue, 29 Sep 2009 19:21:10 +0000 Subject: [PATCH] Fixed undo/redo on poly segment change and control point edit git-svn-id: http://svg-edit.googlecode.com/svn/trunk@737 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 50a70c63..d3ebc484 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -2179,6 +2179,10 @@ function BatchCommand(text) { grip.mouseover( function() { this.setAttribute("stroke", "#F00"); } ); grip.mouseout( function() {this.setAttribute("stroke", "#00F"); } ); grip.dblclick( function() { + + var batchCmd = new BatchCommand("Toggle Poly Segment Type"); + var old_d = current_poly.getAttribute('d'); + // Toggle segment to curve/straight line var type = current_poly.pathSegList.getItem(index+1).pathSegType; var next_index = index+1; @@ -2227,7 +2231,9 @@ function BatchCommand(text) { // console.log(2,current_poly.pathSegList.getItem(i)); // } - + batchCmd.addSubCommand(new ChangeElementCommand(current_poly, {d: old_d})); + addCommandToHistory(batchCmd); + call("changed", [current_poly]); }); } @@ -2752,6 +2758,10 @@ function BatchCommand(text) { // else, move back to select mode else if(current_ctrl_pt_drag != -1) { current_ctrl_pt_drag = -1; + var batchCmd = new BatchCommand("Edit Poly control points"); + batchCmd.addSubCommand(new ChangeElementCommand(current_poly, {d:current_poly_oldd})); + addCommandToHistory(batchCmd); + call("changed", [current_poly]); } else { current_mode = "select";