dytools-capture-engine 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +6 -29
- package/dist/index.js +6 -29
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -492,6 +492,8 @@ var SimpleZone = class extends CaptureZoneBase {
|
|
|
492
492
|
this.primaryCanvasRectangleId = this.canvasManager.addRectangle(this.rect, this.name, "blue", true, true);
|
|
493
493
|
}
|
|
494
494
|
if (type === CaptureZoneEventType.ZoneHiddenChanged) {
|
|
495
|
+
const zoneHiddenChangedPayload = payload;
|
|
496
|
+
this.ocrOverlayIds.forEach((id) => this.canvasManager?.setVisibility(id, !zoneHiddenChangedPayload.newHidden));
|
|
495
497
|
}
|
|
496
498
|
if (type === CaptureZoneEventType.ZoneOcrMatchesChanged) {
|
|
497
499
|
const zoneOcrMatchesChangedPayload = payload;
|
|
@@ -532,35 +534,6 @@ var SimpleZone = class extends CaptureZoneBase {
|
|
|
532
534
|
}
|
|
533
535
|
}
|
|
534
536
|
}
|
|
535
|
-
update(ocrRead, ocrMatches, canvas, flags) {
|
|
536
|
-
if (!this.primaryCanvasRectangleId) {
|
|
537
|
-
this.primaryCanvasRectangleId = canvas.addRectangle(this.rect, this.name, "blue", true, true);
|
|
538
|
-
} else {
|
|
539
|
-
canvas.setName(this.primaryCanvasRectangleId, this.name);
|
|
540
|
-
canvas.setColor(this.primaryCanvasRectangleId, "blue");
|
|
541
|
-
canvas.setVisibility(this.primaryCanvasRectangleId, !this.hidden);
|
|
542
|
-
canvas.setSelectable(this.primaryCanvasRectangleId, true);
|
|
543
|
-
canvas.setResizable(this.primaryCanvasRectangleId, true);
|
|
544
|
-
canvas.setRectangleSize(this.primaryCanvasRectangleId, this.rect);
|
|
545
|
-
}
|
|
546
|
-
if (!ocrMatches || ocrMatches.length == 0) {
|
|
547
|
-
return;
|
|
548
|
-
}
|
|
549
|
-
let thisOcrMatches = ocrMatches?.filter((e) => e.templateZoneId == this.id) ?? [];
|
|
550
|
-
let matchHash = this.hidden + "|" + thisOcrMatches.map((e) => `${e.ocrTextResultIds.sort().join(",")}`).join(",");
|
|
551
|
-
if (matchHash === this.lastMatchHash) {
|
|
552
|
-
return;
|
|
553
|
-
}
|
|
554
|
-
this.ocrOverlayIds.forEach((id) => canvas.removeObject(id));
|
|
555
|
-
this.lastMatchHash = matchHash;
|
|
556
|
-
let isFirstMatch = true;
|
|
557
|
-
for (const match of thisOcrMatches) {
|
|
558
|
-
if (!this.hidden) {
|
|
559
|
-
this.ocrOverlayIds.push(canvas.addPolygon(match.polygonAbsolute.points, "rgba(0, 255, 0, 0.25)", false));
|
|
560
|
-
}
|
|
561
|
-
break;
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
537
|
toExternal(docWidth, docHeight) {
|
|
565
538
|
return {
|
|
566
539
|
TemplateZoneId: this.id,
|
|
@@ -716,6 +689,10 @@ var AnchorZone = class extends CaptureZoneBase {
|
|
|
716
689
|
});
|
|
717
690
|
this.emitToEngine(CaptureToEngineEventType.ZoneChanged, { zone: this, propertiesChanged: ["groupChildren"] });
|
|
718
691
|
}
|
|
692
|
+
if (type === CaptureZoneEventType.ZoneHiddenChanged) {
|
|
693
|
+
const zoneHiddenChangedPayload = payload;
|
|
694
|
+
this.ocrOverlayIds.forEach((id) => this.canvasManager?.setVisibility(id, !zoneHiddenChangedPayload.newHidden));
|
|
695
|
+
}
|
|
719
696
|
if (type === CaptureZoneEventType.ZoneOcrMatchesChanged) {
|
|
720
697
|
const zoneOcrMatchesChangedPayload = payload;
|
|
721
698
|
let ocrMatches = zoneOcrMatchesChangedPayload.matches;
|
package/dist/index.js
CHANGED
|
@@ -476,6 +476,8 @@ var SimpleZone = class extends CaptureZoneBase {
|
|
|
476
476
|
this.primaryCanvasRectangleId = this.canvasManager.addRectangle(this.rect, this.name, "blue", true, true);
|
|
477
477
|
}
|
|
478
478
|
if (type === CaptureZoneEventType.ZoneHiddenChanged) {
|
|
479
|
+
const zoneHiddenChangedPayload = payload;
|
|
480
|
+
this.ocrOverlayIds.forEach((id) => this.canvasManager?.setVisibility(id, !zoneHiddenChangedPayload.newHidden));
|
|
479
481
|
}
|
|
480
482
|
if (type === CaptureZoneEventType.ZoneOcrMatchesChanged) {
|
|
481
483
|
const zoneOcrMatchesChangedPayload = payload;
|
|
@@ -516,35 +518,6 @@ var SimpleZone = class extends CaptureZoneBase {
|
|
|
516
518
|
}
|
|
517
519
|
}
|
|
518
520
|
}
|
|
519
|
-
update(ocrRead, ocrMatches, canvas, flags) {
|
|
520
|
-
if (!this.primaryCanvasRectangleId) {
|
|
521
|
-
this.primaryCanvasRectangleId = canvas.addRectangle(this.rect, this.name, "blue", true, true);
|
|
522
|
-
} else {
|
|
523
|
-
canvas.setName(this.primaryCanvasRectangleId, this.name);
|
|
524
|
-
canvas.setColor(this.primaryCanvasRectangleId, "blue");
|
|
525
|
-
canvas.setVisibility(this.primaryCanvasRectangleId, !this.hidden);
|
|
526
|
-
canvas.setSelectable(this.primaryCanvasRectangleId, true);
|
|
527
|
-
canvas.setResizable(this.primaryCanvasRectangleId, true);
|
|
528
|
-
canvas.setRectangleSize(this.primaryCanvasRectangleId, this.rect);
|
|
529
|
-
}
|
|
530
|
-
if (!ocrMatches || ocrMatches.length == 0) {
|
|
531
|
-
return;
|
|
532
|
-
}
|
|
533
|
-
let thisOcrMatches = ocrMatches?.filter((e) => e.templateZoneId == this.id) ?? [];
|
|
534
|
-
let matchHash = this.hidden + "|" + thisOcrMatches.map((e) => `${e.ocrTextResultIds.sort().join(",")}`).join(",");
|
|
535
|
-
if (matchHash === this.lastMatchHash) {
|
|
536
|
-
return;
|
|
537
|
-
}
|
|
538
|
-
this.ocrOverlayIds.forEach((id) => canvas.removeObject(id));
|
|
539
|
-
this.lastMatchHash = matchHash;
|
|
540
|
-
let isFirstMatch = true;
|
|
541
|
-
for (const match of thisOcrMatches) {
|
|
542
|
-
if (!this.hidden) {
|
|
543
|
-
this.ocrOverlayIds.push(canvas.addPolygon(match.polygonAbsolute.points, "rgba(0, 255, 0, 0.25)", false));
|
|
544
|
-
}
|
|
545
|
-
break;
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
521
|
toExternal(docWidth, docHeight) {
|
|
549
522
|
return {
|
|
550
523
|
TemplateZoneId: this.id,
|
|
@@ -700,6 +673,10 @@ var AnchorZone = class extends CaptureZoneBase {
|
|
|
700
673
|
});
|
|
701
674
|
this.emitToEngine(CaptureToEngineEventType.ZoneChanged, { zone: this, propertiesChanged: ["groupChildren"] });
|
|
702
675
|
}
|
|
676
|
+
if (type === CaptureZoneEventType.ZoneHiddenChanged) {
|
|
677
|
+
const zoneHiddenChangedPayload = payload;
|
|
678
|
+
this.ocrOverlayIds.forEach((id) => this.canvasManager?.setVisibility(id, !zoneHiddenChangedPayload.newHidden));
|
|
679
|
+
}
|
|
703
680
|
if (type === CaptureZoneEventType.ZoneOcrMatchesChanged) {
|
|
704
681
|
const zoneOcrMatchesChangedPayload = payload;
|
|
705
682
|
let ocrMatches = zoneOcrMatchesChangedPayload.matches;
|