Commit 7ffeca0b authored by Sergey Luzyanin's avatar Sergey Luzyanin

fix Bug 33882

parent 2de28ba9
...@@ -220,6 +220,10 @@ AscCommon.extendClass(CChangesDrawingObjectsAddToDrawingObjects, AscDFH.CChanges ...@@ -220,6 +220,10 @@ AscCommon.extendClass(CChangesDrawingObjectsAddToDrawingObjects, AscDFH.CChanges
this.Pos = Reader.GetLong(); this.Pos = Reader.GetLong();
}; };
CChangesDrawingObjectsAddToDrawingObjects.prototype.CreateReverseChange = function(){
return new CChangesDrawingObjectsRemoveFromDrawingObjects(this.Class, this.Pos);
};
AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_AddToDrawingObjects] = CChangesDrawingObjectsAddToDrawingObjects; AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_AddToDrawingObjects] = CChangesDrawingObjectsAddToDrawingObjects;
function CChangesDrawingObjectsRemoveFromDrawingObjects(Class, Pos){ function CChangesDrawingObjectsRemoveFromDrawingObjects(Class, Pos){
this.Type = AscDFH.historyitem_AutoShapes_RemoveFromDrawingObjects; this.Type = AscDFH.historyitem_AutoShapes_RemoveFromDrawingObjects;
...@@ -240,6 +244,10 @@ AscCommon.extendClass(CChangesDrawingObjectsRemoveFromDrawingObjects, AscDFH.CCh ...@@ -240,6 +244,10 @@ AscCommon.extendClass(CChangesDrawingObjectsRemoveFromDrawingObjects, AscDFH.CCh
this.Pos = Reader.GetLong(); this.Pos = Reader.GetLong();
}; };
CChangesDrawingObjectsRemoveFromDrawingObjects.prototype.CreateReverseChange = function(){
return new CChangesDrawingObjectsAddToDrawingObjects(this.Class, this.Pos);
};
AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_RemoveFromDrawingObjects] = CChangesDrawingObjectsRemoveFromDrawingObjects; AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_RemoveFromDrawingObjects] = CChangesDrawingObjectsRemoveFromDrawingObjects;
CShape.prototype.addToDrawingObjects = function(pos) CShape.prototype.addToDrawingObjects = function(pos)
......
This diff is collapsed.
This diff is collapsed.
...@@ -60,25 +60,37 @@ var MOVE_DELTA = AscFormat.MOVE_DELTA; ...@@ -60,25 +60,37 @@ var MOVE_DELTA = AscFormat.MOVE_DELTA;
var cToRad2 = (Math.PI/60000)/180; var cToRad2 = (Math.PI/60000)/180;
function CChangesDrawingsAddPathCommand(Class, oCommand, nIndex){ function CChangesDrawingsAddPathCommand(Class, oCommand, nIndex, bReverse){
this.Type = AscDFH.historyitem_PathAddPathCommand; this.Type = AscDFH.historyitem_PathAddPathCommand;
this.Command = oCommand; this.Command = oCommand;
this.Index = nIndex; this.Index = nIndex;
this.bReverse = bReverse;
CChangesDrawingsAddPathCommand.superclass.constructor.call(this, Class); CChangesDrawingsAddPathCommand.superclass.constructor.call(this, Class);
} }
AscCommon.extendClass(CChangesDrawingsAddPathCommand, AscDFH.CChangesBase); AscCommon.extendClass(CChangesDrawingsAddPathCommand, AscDFH.CChangesBase);
CChangesDrawingsAddPathCommand.prototype.Undo = function(){ CChangesDrawingsAddPathCommand.prototype.Undo = function(){
if(this.bReverse){
this.Class.ArrPathCommandInfo.splice(this.Index, 0, this.Command);
}
else{
this.Class.ArrPathCommandInfo.splice(this.Index, 1); this.Class.ArrPathCommandInfo.splice(this.Index, 1);
}
}; };
CChangesDrawingsAddPathCommand.prototype.Redo = function(){ CChangesDrawingsAddPathCommand.prototype.Redo = function(){
if(this.bReverse){
this.Class.ArrPathCommandInfo.splice(this.Index, 1);
}
else{
this.Class.ArrPathCommandInfo.splice(this.Index, 0, this.Command); this.Class.ArrPathCommandInfo.splice(this.Index, 0, this.Command);
}
}; };
CChangesDrawingsAddPathCommand.prototype.WriteToBinary = function(Writer){ CChangesDrawingsAddPathCommand.prototype.WriteToBinary = function(Writer){
Writer.WriteLong(this.Index); Writer.WriteLong(this.Index);
Writer.WriteLong(this.Command.id); Writer.WriteLong(this.Command.id);
Writer.WriteBool(!!this.bReverse);
switch(this.Command.id){ switch(this.Command.id){
case moveTo: case moveTo:
case lineTo: case lineTo:
...@@ -125,6 +137,7 @@ AscCommon.extendClass(CChangesDrawingsAddPathCommand, AscDFH.CChangesBase); ...@@ -125,6 +137,7 @@ AscCommon.extendClass(CChangesDrawingsAddPathCommand, AscDFH.CChangesBase);
this.Index = Reader.GetLong(); this.Index = Reader.GetLong();
this.Command = {}; this.Command = {};
this.Command.id = Reader.GetLong(); this.Command.id = Reader.GetLong();
this.bReverse = Reader.GetBool();
switch(this.Command.id){ switch(this.Command.id){
case moveTo: case moveTo:
case lineTo: case lineTo:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment