dytools-capture-engine 1.1.2 → 1.1.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 CHANGED
@@ -568,7 +568,6 @@ var SimpleZone = class extends CaptureZoneBase {
568
568
  }
569
569
  }
570
570
  toExternal(docWidth, docHeight) {
571
- console.log(`Sim x:${this.rect.origin.x}, y:${this.rect.origin.y}, w:${this.rect.size.width}, h:${this.rect.size.height}`);
572
571
  return {
573
572
  TemplateZoneId: this.id,
574
573
  Name: this.name,
@@ -598,6 +597,7 @@ var AnchorChildZone = class extends SimpleZone {
598
597
  }
599
598
  toExternalChild(docWidth, docHeight, parentAnchor) {
600
599
  let external = this.toExternal(docWidth, docHeight);
600
+ if (!external) return null;
601
601
  external.Type = "TemplateAnchorZoneChild";
602
602
  const parentAnchorPercent = new import_dytools_geometry.Point(parentAnchor.x / docWidth, parentAnchor.y / docHeight);
603
603
  external.X = this.rect.origin.x / docWidth - parentAnchorPercent.x;
@@ -880,7 +880,7 @@ var AnchorZone = class extends CaptureZoneBase {
880
880
  AnchorLocationXAbsoluteHint: this.currentAnchorPoint?.x,
881
881
  AnchorLocationYAbsoluteHint: this.currentAnchorPoint?.y,
882
882
  GroupChildrenInSubRecord: this.groupChildren,
883
- ChildZones: this.children.map((e) => e instanceof AnchorChildZone ? e.toExternalChild(docWidth, docHeight, this.currentAnchorPoint || this.rect.origin) : e.toExternal(docWidth, docHeight))
883
+ ChildZones: this.children.map((e) => e instanceof AnchorChildZone ? e.toExternalChild(docWidth, docHeight, this.currentAnchorPoint || this.rect.origin) ?? null : e.toExternal(docWidth, docHeight) ?? null).filter((e) => e !== null)
884
884
  };
885
885
  }
886
886
  };
@@ -1338,15 +1338,6 @@ var CaptureEngine = class {
1338
1338
  const docWidth = this.width;
1339
1339
  const docHeight = this.height;
1340
1340
  this.getOcrMatchesSnapshot();
1341
- console.log(this.zones.filter((e) => e.name == "Anchor 1").map((e) => {
1342
- let extParent = e.toExternal(docWidth, docHeight);
1343
- if (extParent.ChildZones && extParent.ChildZones.length > 0) {
1344
- let ext = extParent.ChildZones[0];
1345
- return { x: ext.X, y: ext.Y, width: ext.Width, height: ext.Height };
1346
- } else {
1347
- return "no child";
1348
- }
1349
- }));
1350
1341
  return {
1351
1342
  Name: this._name ?? "Untitled",
1352
1343
  DocumentWidth: docWidth,
package/dist/index.d.cts CHANGED
@@ -415,7 +415,7 @@ interface TemplateZoneBase {
415
415
  children?: TemplateZoneBase[];
416
416
  handleEvent?<T extends CaptureEngineToZoneEventType>(id: string, type: T, payload: CaptureEngineToZoneEventPayloads[T]): void;
417
417
  setCanvasManager?(cm?: ZoneCanvasManager): void;
418
- toExternal(docWidth: number, docHeight: number): ExternalTemplateZone;
418
+ toExternal(docWidth: number, docHeight: number): ExternalTemplateZone | null;
419
419
  setEngineEventSink?(callback?: (type: CaptureToEngineEventType, payload?: CaptureToEngineEventPayloads[CaptureToEngineEventType]) => void): void;
420
420
  }
421
421
  interface ZoneCanvasManager {
package/dist/index.d.ts CHANGED
@@ -415,7 +415,7 @@ interface TemplateZoneBase {
415
415
  children?: TemplateZoneBase[];
416
416
  handleEvent?<T extends CaptureEngineToZoneEventType>(id: string, type: T, payload: CaptureEngineToZoneEventPayloads[T]): void;
417
417
  setCanvasManager?(cm?: ZoneCanvasManager): void;
418
- toExternal(docWidth: number, docHeight: number): ExternalTemplateZone;
418
+ toExternal(docWidth: number, docHeight: number): ExternalTemplateZone | null;
419
419
  setEngineEventSink?(callback?: (type: CaptureToEngineEventType, payload?: CaptureToEngineEventPayloads[CaptureToEngineEventType]) => void): void;
420
420
  }
421
421
  interface ZoneCanvasManager {
package/dist/index.js CHANGED
@@ -552,7 +552,6 @@ var SimpleZone = class extends CaptureZoneBase {
552
552
  }
553
553
  }
554
554
  toExternal(docWidth, docHeight) {
555
- console.log(`Sim x:${this.rect.origin.x}, y:${this.rect.origin.y}, w:${this.rect.size.width}, h:${this.rect.size.height}`);
556
555
  return {
557
556
  TemplateZoneId: this.id,
558
557
  Name: this.name,
@@ -582,6 +581,7 @@ var AnchorChildZone = class extends SimpleZone {
582
581
  }
583
582
  toExternalChild(docWidth, docHeight, parentAnchor) {
584
583
  let external = this.toExternal(docWidth, docHeight);
584
+ if (!external) return null;
585
585
  external.Type = "TemplateAnchorZoneChild";
586
586
  const parentAnchorPercent = new Point(parentAnchor.x / docWidth, parentAnchor.y / docHeight);
587
587
  external.X = this.rect.origin.x / docWidth - parentAnchorPercent.x;
@@ -864,7 +864,7 @@ var AnchorZone = class extends CaptureZoneBase {
864
864
  AnchorLocationXAbsoluteHint: this.currentAnchorPoint?.x,
865
865
  AnchorLocationYAbsoluteHint: this.currentAnchorPoint?.y,
866
866
  GroupChildrenInSubRecord: this.groupChildren,
867
- ChildZones: this.children.map((e) => e instanceof AnchorChildZone ? e.toExternalChild(docWidth, docHeight, this.currentAnchorPoint || this.rect.origin) : e.toExternal(docWidth, docHeight))
867
+ ChildZones: this.children.map((e) => e instanceof AnchorChildZone ? e.toExternalChild(docWidth, docHeight, this.currentAnchorPoint || this.rect.origin) ?? null : e.toExternal(docWidth, docHeight) ?? null).filter((e) => e !== null)
868
868
  };
869
869
  }
870
870
  };
@@ -1322,15 +1322,6 @@ var CaptureEngine = class {
1322
1322
  const docWidth = this.width;
1323
1323
  const docHeight = this.height;
1324
1324
  this.getOcrMatchesSnapshot();
1325
- console.log(this.zones.filter((e) => e.name == "Anchor 1").map((e) => {
1326
- let extParent = e.toExternal(docWidth, docHeight);
1327
- if (extParent.ChildZones && extParent.ChildZones.length > 0) {
1328
- let ext = extParent.ChildZones[0];
1329
- return { x: ext.X, y: ext.Y, width: ext.Width, height: ext.Height };
1330
- } else {
1331
- return "no child";
1332
- }
1333
- }));
1334
1325
  return {
1335
1326
  Name: this._name ?? "Untitled",
1336
1327
  DocumentWidth: docWidth,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dytools-capture-engine",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "An editor allowing the creation of templates for ocr capture.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",