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

fix Bug 33882

parent 2de28ba9
......@@ -220,6 +220,10 @@ AscCommon.extendClass(CChangesDrawingObjectsAddToDrawingObjects, AscDFH.CChanges
this.Pos = Reader.GetLong();
};
CChangesDrawingObjectsAddToDrawingObjects.prototype.CreateReverseChange = function(){
return new CChangesDrawingObjectsRemoveFromDrawingObjects(this.Class, this.Pos);
};
AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_AddToDrawingObjects] = CChangesDrawingObjectsAddToDrawingObjects;
function CChangesDrawingObjectsRemoveFromDrawingObjects(Class, Pos){
this.Type = AscDFH.historyitem_AutoShapes_RemoveFromDrawingObjects;
......@@ -240,6 +244,10 @@ AscCommon.extendClass(CChangesDrawingObjectsRemoveFromDrawingObjects, AscDFH.CCh
this.Pos = Reader.GetLong();
};
CChangesDrawingObjectsRemoveFromDrawingObjects.prototype.CreateReverseChange = function(){
return new CChangesDrawingObjectsAddToDrawingObjects(this.Class, this.Pos);
};
AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_RemoveFromDrawingObjects] = CChangesDrawingObjectsRemoveFromDrawingObjects;
CShape.prototype.addToDrawingObjects = function(pos)
......
This diff is collapsed.
This diff is collapsed.
......@@ -60,25 +60,37 @@ var MOVE_DELTA = AscFormat.MOVE_DELTA;
var cToRad2 = (Math.PI/60000)/180;
function CChangesDrawingsAddPathCommand(Class, oCommand, nIndex){
function CChangesDrawingsAddPathCommand(Class, oCommand, nIndex, bReverse){
this.Type = AscDFH.historyitem_PathAddPathCommand;
this.Command = oCommand;
this.Index = nIndex;
this.bReverse = bReverse;
CChangesDrawingsAddPathCommand.superclass.constructor.call(this, Class);
}
AscCommon.extendClass(CChangesDrawingsAddPathCommand, AscDFH.CChangesBase);
CChangesDrawingsAddPathCommand.prototype.Undo = function(){
this.Class.ArrPathCommandInfo.splice(this.Index, 1);
if(this.bReverse){
this.Class.ArrPathCommandInfo.splice(this.Index, 0, this.Command);
}
else{
this.Class.ArrPathCommandInfo.splice(this.Index, 1);
}
};
CChangesDrawingsAddPathCommand.prototype.Redo = function(){
this.Class.ArrPathCommandInfo.splice(this.Index, 0, this.Command);
if(this.bReverse){
this.Class.ArrPathCommandInfo.splice(this.Index, 1);
}
else{
this.Class.ArrPathCommandInfo.splice(this.Index, 0, this.Command);
}
};
CChangesDrawingsAddPathCommand.prototype.WriteToBinary = function(Writer){
Writer.WriteLong(this.Index);
Writer.WriteLong(this.Command.id);
Writer.WriteBool(!!this.bReverse);
switch(this.Command.id){
case moveTo:
case lineTo:
......@@ -125,6 +137,7 @@ AscCommon.extendClass(CChangesDrawingsAddPathCommand, AscDFH.CChangesBase);
this.Index = Reader.GetLong();
this.Command = {};
this.Command.id = Reader.GetLong();
this.bReverse = Reader.GetBool();
switch(this.Command.id){
case moveTo:
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