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
master
Alexis Deveria 2009-09-29 19:21:10 +00:00
parent ca24dd3caf
commit fd972c7901
1 changed files with 11 additions and 1 deletions

View File

@ -2179,6 +2179,10 @@ function BatchCommand(text) {
grip.mouseover( function() { this.setAttribute("stroke", "#F00"); } ); grip.mouseover( function() { this.setAttribute("stroke", "#F00"); } );
grip.mouseout( function() {this.setAttribute("stroke", "#00F"); } ); grip.mouseout( function() {this.setAttribute("stroke", "#00F"); } );
grip.dblclick( function() { grip.dblclick( function() {
var batchCmd = new BatchCommand("Toggle Poly Segment Type");
var old_d = current_poly.getAttribute('d');
// Toggle segment to curve/straight line // Toggle segment to curve/straight line
var type = current_poly.pathSegList.getItem(index+1).pathSegType; var type = current_poly.pathSegList.getItem(index+1).pathSegType;
var next_index = index+1; var next_index = index+1;
@ -2227,7 +2231,9 @@ function BatchCommand(text) {
// console.log(2,current_poly.pathSegList.getItem(i)); // 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, move back to select mode
else if(current_ctrl_pt_drag != -1) { else if(current_ctrl_pt_drag != -1) {
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 { else {
current_mode = "select"; current_mode = "select";