dytools-capture-engine 1.2.3 → 1.2.4
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 +12 -11
- package/dist/index.js +12 -11
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -506,11 +506,10 @@ var SimpleZone = class extends CaptureZoneBase {
|
|
|
506
506
|
let isFirstMatch = true;
|
|
507
507
|
for (const match of ocrMatches) {
|
|
508
508
|
if (match.templateZoneId != this.id) continue;
|
|
509
|
-
|
|
510
|
-
this.ocrOverlayIds.push(this.canvasManager?.addPolygon(match.polygonAbsolute.points, "rgba(0, 255, 0, 0.25)", false));
|
|
511
|
-
}
|
|
509
|
+
this.ocrOverlayIds.push(this.canvasManager?.addPolygon(match.polygonAbsolute.points, "rgba(0, 255, 0, 0.25)", false));
|
|
512
510
|
break;
|
|
513
511
|
}
|
|
512
|
+
this.ocrOverlayIds.forEach((id) => this.canvasManager?.setVisibility(id, !this.hidden));
|
|
514
513
|
}
|
|
515
514
|
}
|
|
516
515
|
handleEvent(id, type, payload) {
|
|
@@ -705,13 +704,9 @@ var AnchorZone = class extends CaptureZoneBase {
|
|
|
705
704
|
let cycle = this.cycle;
|
|
706
705
|
for (const match of ocrMatches) {
|
|
707
706
|
if (match.templateZoneId != this.id) continue;
|
|
708
|
-
|
|
709
|
-
this.ocrOverlayIds.push(this.canvasManager?.addPolygon(match.polygonAbsolute.points, "rgba(0, 255, 255, 0.25)", false));
|
|
710
|
-
}
|
|
707
|
+
this.ocrOverlayIds.push(this.canvasManager?.addPolygon(match.polygonAbsolute.points, "rgba(0, 255, 255, 0.25)", false));
|
|
711
708
|
if (match.anchorPointAbsolute) {
|
|
712
|
-
|
|
713
|
-
this.ocrOverlayIds.push(this.canvasManager?.addCircle(match.anchorPointAbsolute, 2, "rgba(0, 0, 255, 0.25)", false, false));
|
|
714
|
-
}
|
|
709
|
+
this.ocrOverlayIds.push(this.canvasManager?.addCircle(match.anchorPointAbsolute, 2, "rgba(0, 0, 255, 0.25)", false, false));
|
|
715
710
|
if (isFirstMatch) {
|
|
716
711
|
for (const child of this.children.filter((e) => e.needsAnchorReposition)) {
|
|
717
712
|
let currentAnchorPoint = this.currentAnchorPoint ?? this.rect.origin;
|
|
@@ -720,10 +715,15 @@ var AnchorZone = class extends CaptureZoneBase {
|
|
|
720
715
|
child.needsAnchorReposition = false;
|
|
721
716
|
}
|
|
722
717
|
} else {
|
|
723
|
-
for (
|
|
718
|
+
for (let i = 0; i < this.children.length; i++) {
|
|
719
|
+
const child = this.children[i];
|
|
724
720
|
if (child.hidden == false) {
|
|
725
721
|
let vector = this.currentAnchorPoint ? match.anchorPointAbsolute.getDeltaFromPoint(this.currentAnchorPoint) : new import_dytools_geometry.Vector(0, 0);
|
|
726
|
-
let
|
|
722
|
+
let maxOpacity = 0.5;
|
|
723
|
+
let minOpacity = 0.25;
|
|
724
|
+
let percentThroughArray = (i + 1) / this.children.length;
|
|
725
|
+
let opacity = maxOpacity - (maxOpacity - minOpacity) * percentThroughArray;
|
|
726
|
+
let color = `rgba(" + cycle + ", 128, 255, ${opacity.toFixed(2)})`;
|
|
727
727
|
const polygon = child.rect.move(vector).toPolygon().points;
|
|
728
728
|
this.ocrOverlayIds.push(this.canvasManager?.addPolygon(polygon, color, false));
|
|
729
729
|
}
|
|
@@ -735,6 +735,7 @@ var AnchorZone = class extends CaptureZoneBase {
|
|
|
735
735
|
}
|
|
736
736
|
isFirstMatch = false;
|
|
737
737
|
}
|
|
738
|
+
this.ocrOverlayIds.forEach((id) => this.canvasManager?.setVisibility(id, !this.hidden));
|
|
738
739
|
}
|
|
739
740
|
}
|
|
740
741
|
get cycle() {
|
package/dist/index.js
CHANGED
|
@@ -490,11 +490,10 @@ var SimpleZone = class extends CaptureZoneBase {
|
|
|
490
490
|
let isFirstMatch = true;
|
|
491
491
|
for (const match of ocrMatches) {
|
|
492
492
|
if (match.templateZoneId != this.id) continue;
|
|
493
|
-
|
|
494
|
-
this.ocrOverlayIds.push(this.canvasManager?.addPolygon(match.polygonAbsolute.points, "rgba(0, 255, 0, 0.25)", false));
|
|
495
|
-
}
|
|
493
|
+
this.ocrOverlayIds.push(this.canvasManager?.addPolygon(match.polygonAbsolute.points, "rgba(0, 255, 0, 0.25)", false));
|
|
496
494
|
break;
|
|
497
495
|
}
|
|
496
|
+
this.ocrOverlayIds.forEach((id) => this.canvasManager?.setVisibility(id, !this.hidden));
|
|
498
497
|
}
|
|
499
498
|
}
|
|
500
499
|
handleEvent(id, type, payload) {
|
|
@@ -689,13 +688,9 @@ var AnchorZone = class extends CaptureZoneBase {
|
|
|
689
688
|
let cycle = this.cycle;
|
|
690
689
|
for (const match of ocrMatches) {
|
|
691
690
|
if (match.templateZoneId != this.id) continue;
|
|
692
|
-
|
|
693
|
-
this.ocrOverlayIds.push(this.canvasManager?.addPolygon(match.polygonAbsolute.points, "rgba(0, 255, 255, 0.25)", false));
|
|
694
|
-
}
|
|
691
|
+
this.ocrOverlayIds.push(this.canvasManager?.addPolygon(match.polygonAbsolute.points, "rgba(0, 255, 255, 0.25)", false));
|
|
695
692
|
if (match.anchorPointAbsolute) {
|
|
696
|
-
|
|
697
|
-
this.ocrOverlayIds.push(this.canvasManager?.addCircle(match.anchorPointAbsolute, 2, "rgba(0, 0, 255, 0.25)", false, false));
|
|
698
|
-
}
|
|
693
|
+
this.ocrOverlayIds.push(this.canvasManager?.addCircle(match.anchorPointAbsolute, 2, "rgba(0, 0, 255, 0.25)", false, false));
|
|
699
694
|
if (isFirstMatch) {
|
|
700
695
|
for (const child of this.children.filter((e) => e.needsAnchorReposition)) {
|
|
701
696
|
let currentAnchorPoint = this.currentAnchorPoint ?? this.rect.origin;
|
|
@@ -704,10 +699,15 @@ var AnchorZone = class extends CaptureZoneBase {
|
|
|
704
699
|
child.needsAnchorReposition = false;
|
|
705
700
|
}
|
|
706
701
|
} else {
|
|
707
|
-
for (
|
|
702
|
+
for (let i = 0; i < this.children.length; i++) {
|
|
703
|
+
const child = this.children[i];
|
|
708
704
|
if (child.hidden == false) {
|
|
709
705
|
let vector = this.currentAnchorPoint ? match.anchorPointAbsolute.getDeltaFromPoint(this.currentAnchorPoint) : new Vector(0, 0);
|
|
710
|
-
let
|
|
706
|
+
let maxOpacity = 0.5;
|
|
707
|
+
let minOpacity = 0.25;
|
|
708
|
+
let percentThroughArray = (i + 1) / this.children.length;
|
|
709
|
+
let opacity = maxOpacity - (maxOpacity - minOpacity) * percentThroughArray;
|
|
710
|
+
let color = `rgba(" + cycle + ", 128, 255, ${opacity.toFixed(2)})`;
|
|
711
711
|
const polygon = child.rect.move(vector).toPolygon().points;
|
|
712
712
|
this.ocrOverlayIds.push(this.canvasManager?.addPolygon(polygon, color, false));
|
|
713
713
|
}
|
|
@@ -719,6 +719,7 @@ var AnchorZone = class extends CaptureZoneBase {
|
|
|
719
719
|
}
|
|
720
720
|
isFirstMatch = false;
|
|
721
721
|
}
|
|
722
|
+
this.ocrOverlayIds.forEach((id) => this.canvasManager?.setVisibility(id, !this.hidden));
|
|
722
723
|
}
|
|
723
724
|
}
|
|
724
725
|
get cycle() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dytools-capture-engine",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "An editor allowing the creation of templates for ocr capture.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"typescript": "^5.9.3"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"dytools-canvas-engine": "^1.1.
|
|
27
|
+
"dytools-canvas-engine": "^1.1.2",
|
|
28
28
|
"dytools-geometry": "^1.0.0",
|
|
29
29
|
"dytools-result": "^1.0.1"
|
|
30
30
|
}
|