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

Commit 741304f

Browse files
author
Francois-Xavier Gentilhomme
committed
[DEV] Clear renderer before drawing result
1 parent 918f5a0 commit 741304f

File tree

9 files changed

+16
-14
lines changed

9 files changed

+16
-14
lines changed

dist/myscript.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12165,6 +12165,7 @@ MyScript = {
1216512165
* @param {TextDocument} recognitionResult
1216612166
*/
1216712167
TextRenderer.prototype.drawRecognitionResult = function (components, recognitionResult) {
12168+
this.clear();
1216812169
if (recognitionResult) {
1216912170
this.drawComponents(components);
1217012171
} else {
@@ -12275,6 +12276,7 @@ MyScript = {
1227512276
* @param {ShapeDocument} recognitionResult
1227612277
*/
1227712278
ShapeRenderer.prototype.drawRecognitionResult = function (components, recognitionResult) {
12279+
this.clear();
1227812280
if (recognitionResult) {
1227912281
this.drawShapes(components, recognitionResult.getSegments());
1228012282
var lastComponents = [];
@@ -12660,6 +12662,7 @@ MyScript = {
1266012662
* @param {MathDocument} recognitionResult
1266112663
*/
1266212664
MathRenderer.prototype.drawRecognitionResult = function (components, recognitionResult) {
12665+
this.clear();
1266312666
if (recognitionResult) {
1266412667
var notScratchOutComponents = _removeMathScratchOut(components, recognitionResult.getScratchOutResults());
1266512668
this.drawComponents(notScratchOutComponents);
@@ -12757,6 +12760,7 @@ MyScript = {
1275712760
* @param {MusicDocument} recognitionResult
1275812761
*/
1275912762
MusicRenderer.prototype.drawRecognitionResult = function (components, recognitionResult) {
12763+
this.clear();
1276012764
if (recognitionResult) {
1276112765
var notScratchOutComponents = _removeMusicScratchOut(components, recognitionResult.getScratchOutResults());
1276212766
this.drawComponents(notScratchOutComponents);
@@ -13148,6 +13152,7 @@ MyScript = {
1314813152
* @param {AnalyzerDocument} recognitionResult
1314913153
*/
1315013154
AnalyzerRenderer.prototype.drawRecognitionResult = function (components, recognitionResult) {
13155+
this.clear();
1315113156
if (recognitionResult) {
1315213157
this.shapeRenderer.drawShapes(components, recognitionResult.getShapes());
1315313158
_drawTables(components, recognitionResult.getTables(), this.getContext(), this.getParameters());
@@ -14423,7 +14428,6 @@ MyScript = {
1442314428
};
1442414429

1442514430
InkPaper.prototype._renderResult = function (data) {
14426-
this._selectedRenderer.clear();
1442714431
this._selectedRenderer.drawRecognitionResult(this.getComponents().concat(this._components), data? data.getDocument(): undefined);
1442814432

1442914433
this._onResult(data);
@@ -14528,16 +14532,13 @@ MyScript = {
1452814532

1452914533
InkPaper.prototype._initRenderingCanvas = function () {
1453014534
this._selectedRenderer.clear();
14531-
this._drawInput(this._components);
14532-
};
1453314535

14534-
InkPaper.prototype._drawInput = function (components) {
1453514536
if (this._selectedRecognizer instanceof scope.MusicRecognizer) {
1453614537
if (this._selectedRecognizer.getParameters().getStaff() instanceof scope.MusicStaff) {
1453714538
this._selectedRenderer.drawStaff(this._selectedRecognizer.getParameters().getStaff());
1453814539
}
1453914540
}
14540-
this._selectedRenderer.drawComponents(this.getComponents().concat(components));
14541+
this._selectedRenderer.drawComponents(this.getComponents().concat(this._components));
1454114542
};
1454214543

1454314544
/**

dist/myscript.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/myscript.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/inkPaper.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,6 @@
939939
};
940940

941941
InkPaper.prototype._renderResult = function (data) {
942-
this._selectedRenderer.clear();
943942
this._selectedRenderer.drawRecognitionResult(this.getComponents().concat(this._components), data? data.getDocument(): undefined);
944943

945944
this._onResult(data);
@@ -1044,16 +1043,13 @@
10441043

10451044
InkPaper.prototype._initRenderingCanvas = function () {
10461045
this._selectedRenderer.clear();
1047-
this._drawInput(this._components);
1048-
};
10491046

1050-
InkPaper.prototype._drawInput = function (components) {
10511047
if (this._selectedRecognizer instanceof scope.MusicRecognizer) {
10521048
if (this._selectedRecognizer.getParameters().getStaff() instanceof scope.MusicStaff) {
10531049
this._selectedRenderer.drawStaff(this._selectedRecognizer.getParameters().getStaff());
10541050
}
10551051
}
1056-
this._selectedRenderer.drawComponents(this.getComponents().concat(components));
1052+
this._selectedRenderer.drawComponents(this.getComponents().concat(this._components));
10571053
};
10581054

10591055
/**

src/rendering/analyzerRenderer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
* @param {AnalyzerDocument} recognitionResult
5353
*/
5454
AnalyzerRenderer.prototype.drawRecognitionResult = function (components, recognitionResult) {
55+
this.clear();
5556
if (recognitionResult) {
5657
this.shapeRenderer.drawShapes(components, recognitionResult.getShapes());
5758
_drawTables(components, recognitionResult.getTables(), this.getContext(), this.getParameters());

src/rendering/mathRenderer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
* @param {MathDocument} recognitionResult
3232
*/
3333
MathRenderer.prototype.drawRecognitionResult = function (components, recognitionResult) {
34+
this.clear();
3435
if (recognitionResult) {
3536
var notScratchOutComponents = _removeMathScratchOut(components, recognitionResult.getScratchOutResults());
3637
this.drawComponents(notScratchOutComponents);

src/rendering/musicRenderer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
* @param {MusicDocument} recognitionResult
3232
*/
3333
MusicRenderer.prototype.drawRecognitionResult = function (components, recognitionResult) {
34+
this.clear();
3435
if (recognitionResult) {
3536
var notScratchOutComponents = _removeMusicScratchOut(components, recognitionResult.getScratchOutResults());
3637
this.drawComponents(notScratchOutComponents);

src/rendering/shapeRenderer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
* @param {ShapeDocument} recognitionResult
3232
*/
3333
ShapeRenderer.prototype.drawRecognitionResult = function (components, recognitionResult) {
34+
this.clear();
3435
if (recognitionResult) {
3536
this.drawShapes(components, recognitionResult.getSegments());
3637
var lastComponents = [];

src/rendering/textRenderer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
* @param {TextDocument} recognitionResult
3232
*/
3333
TextRenderer.prototype.drawRecognitionResult = function (components, recognitionResult) {
34+
this.clear();
3435
if (recognitionResult) {
3536
this.drawComponents(components);
3637
} else {

0 commit comments

Comments
 (0)