Skip to content
This repository was archived by the owner on Jan 4, 2021. It is now read-only.

Commit f319ca9

Browse files
author
DEWITTE Pierre-Alban
committed
[DEV] Improve math undo redo
1 parent 25b292a commit f319ca9

File tree

2 files changed

+3
-34
lines changed

2 files changed

+3
-34
lines changed

src/inkPaper.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,9 @@
731731
*/
732732
InkPaper.prototype.undo = function () {
733733
if (this.canUndo()) {
734+
this._components.forEach(function(stroke){
735+
stroke.scratchedStroke = false;
736+
});
734737
this._redoComponents.push(this._components.pop());
735738

736739
this._clearRESTRecognition(this._instanceId);

src/rendering/mathRenderer.js

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -59,40 +59,6 @@
5959
}
6060
};
6161

62-
/**
63-
* Return non-scratched out components
64-
*
65-
* @private
66-
* @param components
67-
* @param scratchOutResults
68-
* @returns {*}
69-
*/
70-
var _removeMathScratchOut = function (components, scratchOutResults) {
71-
if (!scratchOutResults || scratchOutResults.length === 0) {
72-
return components;
73-
}
74-
75-
var cloneComponents = components.slice(0);
76-
var componentsToRemove = [];
77-
78-
for (var k in scratchOutResults) {
79-
for (var n in scratchOutResults[k].getErasedInkRanges()) {
80-
componentsToRemove.push(scratchOutResults[k].getErasedInkRanges()[n].getComponent());
81-
}
82-
for (var p in scratchOutResults[k].getInkRanges()) {
83-
componentsToRemove.push(scratchOutResults[k].getInkRanges()[p].getComponent());
84-
}
85-
}
86-
87-
componentsToRemove.sort(function (a, b) {
88-
return b - a;
89-
});
90-
91-
for (var z in componentsToRemove) {
92-
cloneComponents.splice(componentsToRemove[z], 1);
93-
}
94-
return cloneComponents;
95-
};
9662

9763
/**
9864
* Return non-scratched out components

0 commit comments

Comments
 (0)