dytools-capture-engine 1.3.1 → 1.3.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 +38 -7
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +38 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1347,7 +1347,13 @@ var CaptureEngine = class {
|
|
|
1347
1347
|
z.Required ?? false,
|
|
1348
1348
|
z.DataType ?? null,
|
|
1349
1349
|
z.ExcludeFromOutput ?? false,
|
|
1350
|
-
z.DefaultValueIfEmpty ?? null
|
|
1350
|
+
z.DefaultValueIfEmpty ?? null,
|
|
1351
|
+
{
|
|
1352
|
+
zoneColor: this.options.anchorZoneColor,
|
|
1353
|
+
ocrMatchColor: this.options.anchorZoneOcrMatchColor,
|
|
1354
|
+
anchorPointColor: this.options.anchorZoneAnchorPointColor,
|
|
1355
|
+
zoneAdditionalChildrenColor: this.options.anchorZoneAdditionalChildrenColor
|
|
1356
|
+
}
|
|
1351
1357
|
);
|
|
1352
1358
|
if (z.AnchorLocation) anchor.anchorLocation = z.AnchorLocation;
|
|
1353
1359
|
if (z.GroupChildrenInSubRecord !== void 0) anchor.groupChildren = z.GroupChildrenInSubRecord;
|
|
@@ -1378,7 +1384,11 @@ var CaptureEngine = class {
|
|
|
1378
1384
|
z.Required ?? false,
|
|
1379
1385
|
z.DataType ?? null,
|
|
1380
1386
|
z.ExcludeFromOutput ?? false,
|
|
1381
|
-
z.DefaultValueIfEmpty ?? null
|
|
1387
|
+
z.DefaultValueIfEmpty ?? null,
|
|
1388
|
+
{
|
|
1389
|
+
zoneColor: this.options.anchorChildZoneColor,
|
|
1390
|
+
ocrMatchColor: this.options.anchorChildZoneOcrMatchColor
|
|
1391
|
+
}
|
|
1382
1392
|
);
|
|
1383
1393
|
}
|
|
1384
1394
|
return new SimpleZone(
|
|
@@ -1391,7 +1401,11 @@ var CaptureEngine = class {
|
|
|
1391
1401
|
z.Required ?? false,
|
|
1392
1402
|
z.DataType ?? null,
|
|
1393
1403
|
z.ExcludeFromOutput ?? false,
|
|
1394
|
-
z.DefaultValueIfEmpty ?? null
|
|
1404
|
+
z.DefaultValueIfEmpty ?? null,
|
|
1405
|
+
{
|
|
1406
|
+
zoneColor: this.options.simpleZoneColor,
|
|
1407
|
+
ocrMatchColor: this.options.simpleZoneOcrMatchColor
|
|
1408
|
+
}
|
|
1395
1409
|
);
|
|
1396
1410
|
}
|
|
1397
1411
|
get name() {
|
|
@@ -1414,7 +1428,10 @@ var CaptureEngine = class {
|
|
|
1414
1428
|
* @param bounds Rectangle
|
|
1415
1429
|
*/
|
|
1416
1430
|
addSimpleZone(bounds, makeCurrentSelected = false) {
|
|
1417
|
-
let newZone = new SimpleZone("Test1", bounds, false, null, null, null
|
|
1431
|
+
let newZone = new SimpleZone("Test1", bounds, false, null, null, null, false, null, false, null, {
|
|
1432
|
+
zoneColor: this.options.simpleZoneColor,
|
|
1433
|
+
ocrMatchColor: this.options.simpleZoneOcrMatchColor
|
|
1434
|
+
});
|
|
1418
1435
|
this.zones.push(newZone);
|
|
1419
1436
|
if (makeCurrentSelected) {
|
|
1420
1437
|
this.setSelectedZones([newZone]);
|
|
@@ -1426,7 +1443,12 @@ var CaptureEngine = class {
|
|
|
1426
1443
|
* @param bounds Rectangle
|
|
1427
1444
|
*/
|
|
1428
1445
|
addAnchorZone(bounds, makeCurrentSelected = false) {
|
|
1429
|
-
let newZone = new AnchorZone(`Anchor ${this.zoneCounter++}`, bounds, false, null, null, null
|
|
1446
|
+
let newZone = new AnchorZone(`Anchor ${this.zoneCounter++}`, bounds, false, null, null, null, false, null, false, null, {
|
|
1447
|
+
zoneColor: this.options.anchorZoneColor,
|
|
1448
|
+
ocrMatchColor: this.options.anchorZoneOcrMatchColor,
|
|
1449
|
+
anchorPointColor: this.options.anchorZoneAnchorPointColor,
|
|
1450
|
+
zoneAdditionalChildrenColor: this.options.anchorZoneAdditionalChildrenColor
|
|
1451
|
+
});
|
|
1430
1452
|
this.zones.push(newZone);
|
|
1431
1453
|
if (makeCurrentSelected) {
|
|
1432
1454
|
this.setSelectedZones([newZone]);
|
|
@@ -1443,7 +1465,10 @@ var CaptureEngine = class {
|
|
|
1443
1465
|
if (!anchorZone) {
|
|
1444
1466
|
throw new Error(`Anchor zone with id ${anchorId} not found`);
|
|
1445
1467
|
}
|
|
1446
|
-
let newZone = new AnchorChildZone(`Child ${this.zoneCounter++}`, bounds, false, null, null, null
|
|
1468
|
+
let newZone = new AnchorChildZone(`Child ${this.zoneCounter++}`, bounds, false, null, null, null, false, null, false, null, {
|
|
1469
|
+
zoneColor: this.options.anchorChildZoneColor,
|
|
1470
|
+
ocrMatchColor: this.options.anchorChildZoneOcrMatchColor
|
|
1471
|
+
});
|
|
1447
1472
|
if (!anchorZone.children) anchorZone.children = [];
|
|
1448
1473
|
anchorZone.children.push(newZone);
|
|
1449
1474
|
if (makeCurrentSelected) {
|
|
@@ -1651,12 +1676,18 @@ var CaptureEngine = class {
|
|
|
1651
1676
|
get height() {
|
|
1652
1677
|
return this.engine.height;
|
|
1653
1678
|
}
|
|
1654
|
-
async setBackgroundImage(imageOrUrl) {
|
|
1679
|
+
async setBackgroundImage(imageOrUrl, adjustZoom = true) {
|
|
1655
1680
|
this.hideOcr();
|
|
1656
1681
|
let preWidth = this.width;
|
|
1657
1682
|
let preHeight = this.height;
|
|
1658
1683
|
await this.engine.setBackgroundImage(imageOrUrl);
|
|
1659
1684
|
if (preWidth !== this.width || preHeight !== this.height) {
|
|
1685
|
+
if (adjustZoom) {
|
|
1686
|
+
let widthChange = this.width / preWidth;
|
|
1687
|
+
let heightChange = this.height / preHeight;
|
|
1688
|
+
let change = Math.max(widthChange, heightChange);
|
|
1689
|
+
this.setZoom(this.zoom / change, new import_dytools_geometry.Point(this.width / 2, this.height / 2));
|
|
1690
|
+
}
|
|
1660
1691
|
this.emitExternal(CapturePublicEventType.TemplateChanged, {});
|
|
1661
1692
|
}
|
|
1662
1693
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -506,7 +506,7 @@ declare class CaptureEngine {
|
|
|
506
506
|
setPan(x: number, y: number): void;
|
|
507
507
|
get width(): number;
|
|
508
508
|
get height(): number;
|
|
509
|
-
setBackgroundImage(imageOrUrl: string | File | Blob): Promise<void>;
|
|
509
|
+
setBackgroundImage(imageOrUrl: string | File | Blob, adjustZoom?: boolean): Promise<void>;
|
|
510
510
|
switchMode(name: string): void;
|
|
511
511
|
get mode(): string;
|
|
512
512
|
setZoneExamples(zoneExamples: ZoneExample[] | null, setMissingExamplesToNull?: boolean): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -506,7 +506,7 @@ declare class CaptureEngine {
|
|
|
506
506
|
setPan(x: number, y: number): void;
|
|
507
507
|
get width(): number;
|
|
508
508
|
get height(): number;
|
|
509
|
-
setBackgroundImage(imageOrUrl: string | File | Blob): Promise<void>;
|
|
509
|
+
setBackgroundImage(imageOrUrl: string | File | Blob, adjustZoom?: boolean): Promise<void>;
|
|
510
510
|
switchMode(name: string): void;
|
|
511
511
|
get mode(): string;
|
|
512
512
|
setZoneExamples(zoneExamples: ZoneExample[] | null, setMissingExamplesToNull?: boolean): void;
|
package/dist/index.js
CHANGED
|
@@ -1331,7 +1331,13 @@ var CaptureEngine = class {
|
|
|
1331
1331
|
z.Required ?? false,
|
|
1332
1332
|
z.DataType ?? null,
|
|
1333
1333
|
z.ExcludeFromOutput ?? false,
|
|
1334
|
-
z.DefaultValueIfEmpty ?? null
|
|
1334
|
+
z.DefaultValueIfEmpty ?? null,
|
|
1335
|
+
{
|
|
1336
|
+
zoneColor: this.options.anchorZoneColor,
|
|
1337
|
+
ocrMatchColor: this.options.anchorZoneOcrMatchColor,
|
|
1338
|
+
anchorPointColor: this.options.anchorZoneAnchorPointColor,
|
|
1339
|
+
zoneAdditionalChildrenColor: this.options.anchorZoneAdditionalChildrenColor
|
|
1340
|
+
}
|
|
1335
1341
|
);
|
|
1336
1342
|
if (z.AnchorLocation) anchor.anchorLocation = z.AnchorLocation;
|
|
1337
1343
|
if (z.GroupChildrenInSubRecord !== void 0) anchor.groupChildren = z.GroupChildrenInSubRecord;
|
|
@@ -1362,7 +1368,11 @@ var CaptureEngine = class {
|
|
|
1362
1368
|
z.Required ?? false,
|
|
1363
1369
|
z.DataType ?? null,
|
|
1364
1370
|
z.ExcludeFromOutput ?? false,
|
|
1365
|
-
z.DefaultValueIfEmpty ?? null
|
|
1371
|
+
z.DefaultValueIfEmpty ?? null,
|
|
1372
|
+
{
|
|
1373
|
+
zoneColor: this.options.anchorChildZoneColor,
|
|
1374
|
+
ocrMatchColor: this.options.anchorChildZoneOcrMatchColor
|
|
1375
|
+
}
|
|
1366
1376
|
);
|
|
1367
1377
|
}
|
|
1368
1378
|
return new SimpleZone(
|
|
@@ -1375,7 +1385,11 @@ var CaptureEngine = class {
|
|
|
1375
1385
|
z.Required ?? false,
|
|
1376
1386
|
z.DataType ?? null,
|
|
1377
1387
|
z.ExcludeFromOutput ?? false,
|
|
1378
|
-
z.DefaultValueIfEmpty ?? null
|
|
1388
|
+
z.DefaultValueIfEmpty ?? null,
|
|
1389
|
+
{
|
|
1390
|
+
zoneColor: this.options.simpleZoneColor,
|
|
1391
|
+
ocrMatchColor: this.options.simpleZoneOcrMatchColor
|
|
1392
|
+
}
|
|
1379
1393
|
);
|
|
1380
1394
|
}
|
|
1381
1395
|
get name() {
|
|
@@ -1398,7 +1412,10 @@ var CaptureEngine = class {
|
|
|
1398
1412
|
* @param bounds Rectangle
|
|
1399
1413
|
*/
|
|
1400
1414
|
addSimpleZone(bounds, makeCurrentSelected = false) {
|
|
1401
|
-
let newZone = new SimpleZone("Test1", bounds, false, null, null, null
|
|
1415
|
+
let newZone = new SimpleZone("Test1", bounds, false, null, null, null, false, null, false, null, {
|
|
1416
|
+
zoneColor: this.options.simpleZoneColor,
|
|
1417
|
+
ocrMatchColor: this.options.simpleZoneOcrMatchColor
|
|
1418
|
+
});
|
|
1402
1419
|
this.zones.push(newZone);
|
|
1403
1420
|
if (makeCurrentSelected) {
|
|
1404
1421
|
this.setSelectedZones([newZone]);
|
|
@@ -1410,7 +1427,12 @@ var CaptureEngine = class {
|
|
|
1410
1427
|
* @param bounds Rectangle
|
|
1411
1428
|
*/
|
|
1412
1429
|
addAnchorZone(bounds, makeCurrentSelected = false) {
|
|
1413
|
-
let newZone = new AnchorZone(`Anchor ${this.zoneCounter++}`, bounds, false, null, null, null
|
|
1430
|
+
let newZone = new AnchorZone(`Anchor ${this.zoneCounter++}`, bounds, false, null, null, null, false, null, false, null, {
|
|
1431
|
+
zoneColor: this.options.anchorZoneColor,
|
|
1432
|
+
ocrMatchColor: this.options.anchorZoneOcrMatchColor,
|
|
1433
|
+
anchorPointColor: this.options.anchorZoneAnchorPointColor,
|
|
1434
|
+
zoneAdditionalChildrenColor: this.options.anchorZoneAdditionalChildrenColor
|
|
1435
|
+
});
|
|
1414
1436
|
this.zones.push(newZone);
|
|
1415
1437
|
if (makeCurrentSelected) {
|
|
1416
1438
|
this.setSelectedZones([newZone]);
|
|
@@ -1427,7 +1449,10 @@ var CaptureEngine = class {
|
|
|
1427
1449
|
if (!anchorZone) {
|
|
1428
1450
|
throw new Error(`Anchor zone with id ${anchorId} not found`);
|
|
1429
1451
|
}
|
|
1430
|
-
let newZone = new AnchorChildZone(`Child ${this.zoneCounter++}`, bounds, false, null, null, null
|
|
1452
|
+
let newZone = new AnchorChildZone(`Child ${this.zoneCounter++}`, bounds, false, null, null, null, false, null, false, null, {
|
|
1453
|
+
zoneColor: this.options.anchorChildZoneColor,
|
|
1454
|
+
ocrMatchColor: this.options.anchorChildZoneOcrMatchColor
|
|
1455
|
+
});
|
|
1431
1456
|
if (!anchorZone.children) anchorZone.children = [];
|
|
1432
1457
|
anchorZone.children.push(newZone);
|
|
1433
1458
|
if (makeCurrentSelected) {
|
|
@@ -1635,12 +1660,18 @@ var CaptureEngine = class {
|
|
|
1635
1660
|
get height() {
|
|
1636
1661
|
return this.engine.height;
|
|
1637
1662
|
}
|
|
1638
|
-
async setBackgroundImage(imageOrUrl) {
|
|
1663
|
+
async setBackgroundImage(imageOrUrl, adjustZoom = true) {
|
|
1639
1664
|
this.hideOcr();
|
|
1640
1665
|
let preWidth = this.width;
|
|
1641
1666
|
let preHeight = this.height;
|
|
1642
1667
|
await this.engine.setBackgroundImage(imageOrUrl);
|
|
1643
1668
|
if (preWidth !== this.width || preHeight !== this.height) {
|
|
1669
|
+
if (adjustZoom) {
|
|
1670
|
+
let widthChange = this.width / preWidth;
|
|
1671
|
+
let heightChange = this.height / preHeight;
|
|
1672
|
+
let change = Math.max(widthChange, heightChange);
|
|
1673
|
+
this.setZoom(this.zoom / change, new Point(this.width / 2, this.height / 2));
|
|
1674
|
+
}
|
|
1644
1675
|
this.emitExternal(CapturePublicEventType.TemplateChanged, {});
|
|
1645
1676
|
}
|
|
1646
1677
|
}
|