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

Commit 568b1fc

Browse files
author
DEWITTE Pierre-Alban
committed
[DEV] Manage resize with shapes
1 parent 3d9f281 commit 568b1fc

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/inkPaper.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -731,9 +731,13 @@
731731
*/
732732
InkPaper.prototype.undo = function () {
733733
if (this.canUndo()) {
734+
//Remove the scratched state for Math strokes
734735
this._components.forEach(function(stroke){
735736
stroke.scratchedStroke = false;
736737
});
738+
//Remove the latsModel used for Shape
739+
this.updatedModel = undefined;
740+
737741
this._redoComponents.push(this._components.pop());
738742

739743
this._clearRESTRecognition(this._instanceId);
@@ -935,8 +939,7 @@
935939
};
936940

937941
InkPaper.prototype._renderResult = function (data) {
938-
this._selectedRenderer.drawRecognitionResult(this.getComponents().concat(this._components), data? data.getDocument(): undefined);
939-
942+
this.updatedModel = this._selectedRenderer.drawRecognitionResult(this.getComponents().concat(this._components), data? data.getDocument(): undefined);
940943
this._onResult(data);
941944
return data;
942945
};
@@ -1045,7 +1048,11 @@
10451048
this._selectedRenderer.drawStaff(this._selectedRecognizer.getParameters().getStaff());
10461049
}
10471050
}
1048-
this._selectedRenderer.drawComponents(this.getComponents().concat(this._components));
1051+
if(this._selectedRecognizer instanceof scope.ShapeRecognizer && this.updatedModel){
1052+
this._selectedRenderer.drawRecognitionResult(this.updatedModel.components, this.updatedModel.document);
1053+
} else {
1054+
this._selectedRenderer.drawComponents(this.getComponents().concat(this._components));
1055+
}
10491056
};
10501057

10511058
/**

src/rendering/shapeRenderer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
} else {
4848
this.drawComponents(components);
4949
}
50+
return {components : components, document : document}
5051
};
5152

5253
/**

0 commit comments

Comments
 (0)