Commit f823b7cf authored by Sergey Luzyanin's avatar Sergey Luzyanin

correct slide's spTree after Undo

parent 8274a409
...@@ -42,7 +42,7 @@ var History = AscCommon.History; ...@@ -42,7 +42,7 @@ var History = AscCommon.History;
function CChangesDrawingsContentComments(Class, Type, Pos, Items, isAdd){ function CChangesDrawingsContentComments(Class, Type, Pos, Items, isAdd){
AscDFH.CChangesDrawingsContent.call(this, Class, Type, Pos, Items, isAdd); AscDFH.CChangesDrawingsContent.call(this, Class, Type, Pos, Items, isAdd);
} }
CChangesDrawingsContentComments.prototype = Object.create(AscDFH.CChangesDrawingsContent.prototype); CChangesDrawingsContentComments.prototype = Object.create(AscDFH.CChangesDrawingsContent.prototype);
CChangesDrawingsContentComments.prototype.constructor = CChangesDrawingsContentComments; CChangesDrawingsContentComments.prototype.constructor = CChangesDrawingsContentComments;
CChangesDrawingsContentComments.prototype.addToInterface = function(){ CChangesDrawingsContentComments.prototype.addToInterface = function(){
for(var i = 0; i < this.Items.length; ++i){ for(var i = 0; i < this.Items.length; ++i){
...@@ -704,6 +704,22 @@ Slide.prototype = ...@@ -704,6 +704,22 @@ Slide.prototype =
if(this.cSld.spTree[i].bDeleted){ if(this.cSld.spTree[i].bDeleted){
this.removeFromSpTreeById(this.cSld.spTree[i].Get_Id()); this.removeFromSpTreeById(this.cSld.spTree[i].Get_Id());
} }
else{
for(var j = i - 1; j > -1; --j){
if(this.cSld.spTree[i] === this.cSld.spTree[j]){
this.removeFromSpTreeByPos(i);
break;
}
}
}
}
},
removeFromSpTreeByPos: function(pos){
if(pos > -1 && pos < this.cSld.spTree.length){
History.Add(new AscDFH.CChangesDrawingsContentPresentation(this, AscDFH.historyitem_SlideRemoveFromSpTree, pos, [this.cSld.spTree[pos]], false));
this.cSld.spTree.splice(pos, 1);
} }
}, },
......
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