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

Commit f7f03c5

Browse files
author
Francois-Xavier Gentilhomme
committed
[FIX] fixes shapeDocument inkRanges issue
1 parent e82df94 commit f7f03c5

File tree

6 files changed

+25
-21
lines changed

6 files changed

+25
-21
lines changed

dist/myscript.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5300,7 +5300,7 @@ MyScript = {
53005300
ShapeDocument.prototype.getInkRanges = function () {
53015301
var inkRanges = [];
53025302
for (var i in this.segments) {
5303-
inkRanges.push(this.segments[i].getInkRanges());
5303+
inkRanges = inkRanges.concat(this.segments[i].getInkRanges());
53045304
}
53055305
return inkRanges;
53065306
};
@@ -12273,17 +12273,19 @@ MyScript = {
1227312273
*
1227412274
* @method drawRecognitionResult
1227512275
* @param {AbstractComponent[]} components
12276-
* @param {ShapeDocument} recognitionResult
12276+
* @param {ShapeDocument} document
1227712277
*/
12278-
ShapeRenderer.prototype.drawRecognitionResult = function (components, recognitionResult) {
12278+
ShapeRenderer.prototype.drawRecognitionResult = function (components, document) {
1227912279
this.clear();
12280-
if (recognitionResult) {
12281-
this.drawShapes(components, recognitionResult.getSegments());
12280+
if (document && (document instanceof scope.ShapeDocument)) {
12281+
this.drawShapes(components, document.getSegments());
1228212282
var lastComponents = [];
12283-
var processedComponents = _extractComponents(components, recognitionResult.getInkRanges());
12283+
var processedComponents = _extractComponents(components, document.getInkRanges());
12284+
1228412285
for (var i in components) {
12285-
if (processedComponents.indexOf(components[i]) < 0) {
12286-
lastComponents.push(components[i]);
12286+
var component = components[i];
12287+
if (processedComponents.indexOf(component) !== -1) {
12288+
lastComponents.push(component);
1228712289
}
1228812290
}
1228912291
this.drawComponents(lastComponents);

dist/myscript.min.css

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

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/output/shape/shapeDocument.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
ShapeDocument.prototype.getInkRanges = function () {
3737
var inkRanges = [];
3838
for (var i in this.segments) {
39-
inkRanges.push(this.segments[i].getInkRanges());
39+
inkRanges = inkRanges.concat(this.segments[i].getInkRanges());
4040
}
4141
return inkRanges;
4242
};

src/rendering/shapeRenderer.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,19 @@
2828
*
2929
* @method drawRecognitionResult
3030
* @param {AbstractComponent[]} components
31-
* @param {ShapeDocument} recognitionResult
31+
* @param {ShapeDocument} document
3232
*/
33-
ShapeRenderer.prototype.drawRecognitionResult = function (components, recognitionResult) {
33+
ShapeRenderer.prototype.drawRecognitionResult = function (components, document) {
3434
this.clear();
35-
if (recognitionResult) {
36-
this.drawShapes(components, recognitionResult.getSegments());
35+
if (document && (document instanceof scope.ShapeDocument)) {
36+
this.drawShapes(components, document.getSegments());
3737
var lastComponents = [];
38-
var processedComponents = _extractComponents(components, recognitionResult.getInkRanges());
38+
var processedComponents = _extractComponents(components, document.getInkRanges());
39+
3940
for (var i in components) {
40-
if (processedComponents.indexOf(components[i]) < 0) {
41-
lastComponents.push(components[i]);
41+
var component = components[i];
42+
if (processedComponents.indexOf(component) !== -1) {
43+
lastComponents.push(component);
4244
}
4345
}
4446
this.drawComponents(lastComponents);

0 commit comments

Comments
 (0)