frame.identify 0.5.5 → 0.5.6
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.
|
@@ -28,6 +28,7 @@ export declare function ModalImageCropped(props: {
|
|
|
28
28
|
dataUrl: string;
|
|
29
29
|
modalIsOpen: boolean;
|
|
30
30
|
onCloseModal: (rotationAngle: number, contourPoints: Point[], points: Point[], trademark?: Point) => () => void;
|
|
31
|
+
trademarkLineScale?: number;
|
|
31
32
|
testMode?: boolean;
|
|
32
33
|
}): import("react").JSX.Element;
|
|
33
34
|
//# sourceMappingURL=ModalImageCropped.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalImageCropped.d.ts","sourceRoot":"","sources":["../src/ModalImageCropped.tsx"],"names":[],"mappings":"AAUA,OAAO,EAqBL,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAG3C,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC;AAI1B;;;;;;;;;GASG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,KAAK,EAAE,YAAY,CAAC,OAAO,eAAe,CAAC,CAAC;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,CACZ,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,KAAK,EAAE,EACtB,MAAM,EAAE,KAAK,EAAE,EACf,SAAS,CAAC,EAAE,KAAK,KACd,MAAM,IAAI,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,+
|
|
1
|
+
{"version":3,"file":"ModalImageCropped.d.ts","sourceRoot":"","sources":["../src/ModalImageCropped.tsx"],"names":[],"mappings":"AAUA,OAAO,EAqBL,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAG3C,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC;AAI1B;;;;;;;;;GASG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,KAAK,EAAE,YAAY,CAAC,OAAO,eAAe,CAAC,CAAC;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,CACZ,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,KAAK,EAAE,EACtB,MAAM,EAAE,KAAK,EAAE,EACf,SAAS,CAAC,EAAE,KAAK,KACd,MAAM,IAAI,CAAC;IAChB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,+BA81CA"}
|
|
@@ -9,6 +9,7 @@ export declare function ModalImageLoaded(props: {
|
|
|
9
9
|
modalIsOpen: boolean;
|
|
10
10
|
onAfterCloseModal: (sl: number, sh: number, dbl: number, rotationAngle: number, contourPoints: Point[], points: Point[], trademark?: Point) => () => void;
|
|
11
11
|
onAfterCropImage?: (base64: string, sl: number, sh: number, dbl: number, x0: number, y0: number, width: number, height: number) => void;
|
|
12
|
+
trademarkLineScale?: number;
|
|
12
13
|
testMode?: boolean;
|
|
13
14
|
}): import("react").JSX.Element;
|
|
14
15
|
//# sourceMappingURL=ModalImageLoaded.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalImageLoaded.d.ts","sourceRoot":"","sources":["../src/ModalImageLoaded.tsx"],"names":[],"mappings":"AAIA,OAAO,EAKL,eAAe,EAIhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAI3C,OAAO,EAAqB,KAAK,EAAE,MAAM,GAAG,CAAC;AAG7C,MAAM,MAAM,sBAAsB,GAAG;IACnC,cAAc,EAAE,MAAM,I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EAAE,KAAK,EAAE,EACtB,MAAM,EAAE,KAAK,EAAE,EACf,SAAS,CAAC,EAAE,KAAK,KACd,MAAM,IAAI,CAAC;IAChB,gBAAgB,CAAC,EAAE,CACjB,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,MAAM,EACX,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,KACX,IAAI,CAAC;IACV,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,+BA6YA"}
|
package/dist/frame.identify.js
CHANGED
|
@@ -4762,6 +4762,7 @@ function ds(e) {
|
|
|
4762
4762
|
let a = O.context.SL ?? 0, o = O.context.SH ?? 0, s = O.context.AZG ?? 0;
|
|
4763
4763
|
e.onAfterCloseModal(a, o, s, t, n, r, i)(), f(!1);
|
|
4764
4764
|
},
|
|
4765
|
+
trademarkLineScale: e.trademarkLineScale,
|
|
4765
4766
|
testMode: e.testMode
|
|
4766
4767
|
}, b),
|
|
4767
4768
|
/* @__PURE__ */ c(cs, {
|
|
@@ -6583,7 +6584,7 @@ function Kc(e) {
|
|
|
6583
6584
|
for (let e = 0; e < t.length; e += 1) {
|
|
6584
6585
|
let i = t[e], a = ce(i);
|
|
6585
6586
|
if (e > 0 && a < n) {
|
|
6586
|
-
|
|
6587
|
+
r = e;
|
|
6587
6588
|
break;
|
|
6588
6589
|
}
|
|
6589
6590
|
n = a;
|
|
@@ -6600,7 +6601,7 @@ function Kc(e) {
|
|
|
6600
6601
|
let n = i(t * 2 * Math.PI / 128);
|
|
6601
6602
|
return n.x > a && (a = n.x), n.x < o && (o = n.x), n.y > s && (s = n.y), n.y < c && (c = n.y), n;
|
|
6602
6603
|
});
|
|
6603
|
-
if (
|
|
6604
|
+
if (r) {
|
|
6604
6605
|
let t = a - o, n = s - c, r = e / t, i = l.map((e) => ({
|
|
6605
6606
|
x: e.x - o - t / 2,
|
|
6606
6607
|
y: e.y - c - n / 2
|
|
@@ -6610,7 +6611,7 @@ function Kc(e) {
|
|
|
6610
6611
|
} : void 0, d = -Infinity, f = Infinity, p = -Infinity, m = Infinity;
|
|
6611
6612
|
i.forEach((e) => {
|
|
6612
6613
|
e.x > d && (d = e.x), e.x < f && (f = e.x), e.y > p && (p = e.y), e.y < m && (m = e.y);
|
|
6613
|
-
})
|
|
6614
|
+
});
|
|
6614
6615
|
let h = i.map((e) => ({
|
|
6615
6616
|
x: e.x,
|
|
6616
6617
|
y: -e.y
|
|
@@ -6620,17 +6621,17 @@ function Kc(e) {
|
|
|
6620
6621
|
} : void 0, _ = -Infinity, v = Infinity, y = -Infinity, b = Infinity;
|
|
6621
6622
|
h.forEach((e) => {
|
|
6622
6623
|
e.x > _ && (_ = e.x), e.x < v && (v = e.x), e.y > y && (y = e.y), e.y < b && (b = e.y);
|
|
6623
|
-
})
|
|
6624
|
+
});
|
|
6624
6625
|
let x = pe(h, r), S = g ? fe(g, r) : void 0, C = -Infinity, w = Infinity, T = -Infinity, E = Infinity;
|
|
6625
6626
|
x.forEach((e) => {
|
|
6626
6627
|
e.x > C && (C = e.x), e.x < w && (w = e.x), e.y > T && (T = e.y), e.y < E && (E = e.y);
|
|
6627
|
-
}),
|
|
6628
|
+
}), me(x) || (x.reverse(), x.forEach((e) => {
|
|
6628
6629
|
e.x > C && (C = e.x), e.x < w && (w = e.x), e.y > T && (T = e.y), e.y < E && (E = e.y);
|
|
6629
|
-
})
|
|
6630
|
+
}));
|
|
6630
6631
|
let D = de(x), k = Infinity, A = -Infinity, j = Infinity, M = -Infinity;
|
|
6631
6632
|
return D.forEach((e) => {
|
|
6632
6633
|
e.x > A && (A = e.x), e.x < k && (k = e.x), e.y > M && (M = e.y), e.y < j && (j = e.y);
|
|
6633
|
-
}),
|
|
6634
|
+
}), {
|
|
6634
6635
|
polygon: D,
|
|
6635
6636
|
box: {
|
|
6636
6637
|
minX: o,
|
|
@@ -6658,7 +6659,6 @@ function Kc(e) {
|
|
|
6658
6659
|
de
|
|
6659
6660
|
]);
|
|
6660
6661
|
function ge(t, n, r) {
|
|
6661
|
-
console.log(`getRT1Points: trademark: ${r?.x}, ${r?.y}`);
|
|
6662
6662
|
let i = he(t, n, p, !0), a = le(i.polygon);
|
|
6663
6663
|
if (e.testMode) {
|
|
6664
6664
|
let e = se(a);
|
|
@@ -6691,7 +6691,7 @@ function Kc(e) {
|
|
|
6691
6691
|
e.beginPath(), e.strokeStyle = "green", e.lineWidth = 3, e.fillStyle = "rgba(255, 0, 0, 0.3)", e.moveTo(H.polygon[0].x, H.polygon[0].y);
|
|
6692
6692
|
for (let t of H.polygon) e.lineTo(t.x, t.y);
|
|
6693
6693
|
return e.closePath(), e.fill(), e.stroke(), H;
|
|
6694
|
-
}, [H]), ve = n(() => {
|
|
6694
|
+
}, [H]), ve = n((e = .9) => {
|
|
6695
6695
|
if (R.value !== "Shape defined" && R.value !== "Trademark defined" || H.polygon.length === 0) return {
|
|
6696
6696
|
points: [],
|
|
6697
6697
|
center: {
|
|
@@ -6699,103 +6699,103 @@ function Kc(e) {
|
|
|
6699
6699
|
y: 0
|
|
6700
6700
|
}
|
|
6701
6701
|
};
|
|
6702
|
-
let { polygon:
|
|
6703
|
-
x: (
|
|
6704
|
-
y: (
|
|
6705
|
-
};
|
|
6702
|
+
let { polygon: t, box: n } = H, r = {
|
|
6703
|
+
x: (n.minX + n.maxX) / 2,
|
|
6704
|
+
y: (n.minY + n.maxY) / 2
|
|
6705
|
+
}, i = e, a = e;
|
|
6706
6706
|
return {
|
|
6707
|
-
points:
|
|
6708
|
-
x: (e.x -
|
|
6709
|
-
y: (e.y -
|
|
6707
|
+
points: t.map((e) => ({
|
|
6708
|
+
x: (e.x - r.x) * i + r.x,
|
|
6709
|
+
y: (e.y - r.y) * a + r.y
|
|
6710
6710
|
})).slice(40, 80),
|
|
6711
|
-
center:
|
|
6711
|
+
center: r
|
|
6712
6712
|
};
|
|
6713
6713
|
}, [H, R.value]);
|
|
6714
6714
|
function U(e, t, n) {
|
|
6715
6715
|
e.strokeStyle = "red", e.lineWidth = 3, n ? e.setLineDash([4, 3]) : e.setLineDash([]), e.beginPath(), e.moveTo(t[0].x, t[0].y), e.lineTo(n?.x ?? t[1].x, n?.y ?? t[1].y), e.stroke(), n && e.setLineDash([]);
|
|
6716
6716
|
}
|
|
6717
|
-
let ye = n((
|
|
6718
|
-
let
|
|
6719
|
-
if (!
|
|
6720
|
-
let
|
|
6721
|
-
x === 0 ?
|
|
6722
|
-
let
|
|
6723
|
-
x:
|
|
6724
|
-
y:
|
|
6717
|
+
let ye = n((t, n) => {
|
|
6718
|
+
let r = s.current, i = u.current;
|
|
6719
|
+
if (!r || !i) return [];
|
|
6720
|
+
let a = r.getContext("2d");
|
|
6721
|
+
x === 0 ? a.drawImage(i, 0, 0) : (a.clearRect(0, 0, r.width, r.height), a.save(), a.translate(r.width / 2, r.height / 2), a.rotate(x), a.drawImage(i, -i.naturalWidth / 2, -i.naturalHeight / 2), a.restore()), a.setLineDash([]);
|
|
6722
|
+
let o = {
|
|
6723
|
+
x: r.width / 2,
|
|
6724
|
+
y: r.height / 2
|
|
6725
6725
|
};
|
|
6726
|
-
switch (Gc(
|
|
6726
|
+
switch (Gc(t, x, o), R.value) {
|
|
6727
6727
|
case Io:
|
|
6728
6728
|
case Lo: break;
|
|
6729
6729
|
case Ro:
|
|
6730
|
-
re(
|
|
6730
|
+
re(a);
|
|
6731
6731
|
break;
|
|
6732
6732
|
case zo:
|
|
6733
|
-
B(
|
|
6733
|
+
B(a, p, "orange"), V(a, p, "magenta", !0);
|
|
6734
6734
|
break;
|
|
6735
6735
|
case Bo:
|
|
6736
6736
|
{
|
|
6737
|
-
let { points:
|
|
6738
|
-
if (oe(
|
|
6739
|
-
let
|
|
6737
|
+
let { points: t, center: r } = ve(e.trademarkLineScale);
|
|
6738
|
+
if (oe(a, t, r, "red"), n && t.length > 0) {
|
|
6739
|
+
let e = t[ae(n, t)], r = [
|
|
6740
6740
|
{
|
|
6741
|
-
x:
|
|
6742
|
-
y:
|
|
6741
|
+
x: e.x + 10,
|
|
6742
|
+
y: e.y
|
|
6743
6743
|
},
|
|
6744
6744
|
{
|
|
6745
|
-
x:
|
|
6746
|
-
y:
|
|
6745
|
+
x: e.x,
|
|
6746
|
+
y: e.y + 10
|
|
6747
6747
|
},
|
|
6748
6748
|
{
|
|
6749
|
-
x:
|
|
6750
|
-
y:
|
|
6749
|
+
x: e.x - 10,
|
|
6750
|
+
y: e.y
|
|
6751
6751
|
},
|
|
6752
6752
|
{
|
|
6753
|
-
x:
|
|
6754
|
-
y:
|
|
6753
|
+
x: e.x,
|
|
6754
|
+
y: e.y - 10
|
|
6755
6755
|
}
|
|
6756
6756
|
];
|
|
6757
|
-
V(
|
|
6757
|
+
V(a, r, "black"), z(a);
|
|
6758
6758
|
}
|
|
6759
6759
|
}
|
|
6760
6760
|
break;
|
|
6761
6761
|
case Vo:
|
|
6762
6762
|
{
|
|
6763
|
-
let { points:
|
|
6764
|
-
if (oe(
|
|
6765
|
-
let
|
|
6763
|
+
let { points: t, center: r } = ve(e.trademarkLineScale);
|
|
6764
|
+
if (oe(a, t, r, "red"), n && t.length > 0) {
|
|
6765
|
+
let e = t[ae(n, t)], r = [
|
|
6766
6766
|
{
|
|
6767
|
-
x:
|
|
6768
|
-
y:
|
|
6767
|
+
x: e.x + 10,
|
|
6768
|
+
y: e.y
|
|
6769
6769
|
},
|
|
6770
6770
|
{
|
|
6771
|
-
x:
|
|
6772
|
-
y:
|
|
6771
|
+
x: e.x,
|
|
6772
|
+
y: e.y + 10
|
|
6773
6773
|
},
|
|
6774
6774
|
{
|
|
6775
|
-
x:
|
|
6776
|
-
y:
|
|
6775
|
+
x: e.x - 10,
|
|
6776
|
+
y: e.y
|
|
6777
6777
|
},
|
|
6778
6778
|
{
|
|
6779
|
-
x:
|
|
6780
|
-
y:
|
|
6779
|
+
x: e.x,
|
|
6780
|
+
y: e.y - 10
|
|
6781
6781
|
}
|
|
6782
6782
|
];
|
|
6783
|
-
V(
|
|
6783
|
+
V(a, r, "black"), z(a);
|
|
6784
6784
|
}
|
|
6785
6785
|
}
|
|
6786
|
-
z(
|
|
6786
|
+
z(a);
|
|
6787
6787
|
break;
|
|
6788
6788
|
case Ho:
|
|
6789
|
-
z(
|
|
6789
|
+
z(a);
|
|
6790
6790
|
break;
|
|
6791
6791
|
default: console.log(`unknown state: ${R.value}`);
|
|
6792
6792
|
}
|
|
6793
|
-
let { polygon:
|
|
6794
|
-
if (
|
|
6795
|
-
let
|
|
6796
|
-
U(
|
|
6793
|
+
let { polygon: c } = _e(a);
|
|
6794
|
+
if (t.length === 2 && (R.value === "Image cropped" || R.value === "X-axis started") && U(a, Gc(t, x, o)), t.length === 1 && R.value === "X-axis started" && n) {
|
|
6795
|
+
let e = Wc(n, x, o);
|
|
6796
|
+
U(a, Gc(t, x, o), e);
|
|
6797
6797
|
}
|
|
6798
|
-
return
|
|
6798
|
+
return c;
|
|
6799
6799
|
}, [
|
|
6800
6800
|
p,
|
|
6801
6801
|
re,
|
|
@@ -6803,6 +6803,7 @@ function Kc(e) {
|
|
|
6803
6803
|
_e,
|
|
6804
6804
|
B,
|
|
6805
6805
|
z,
|
|
6806
|
+
e.trademarkLineScale,
|
|
6806
6807
|
x,
|
|
6807
6808
|
R.value,
|
|
6808
6809
|
ve
|
|
@@ -6876,8 +6877,8 @@ function Kc(e) {
|
|
|
6876
6877
|
function Te() {
|
|
6877
6878
|
if (!Le) throw Error("SL is undefined");
|
|
6878
6879
|
if (!Re) throw Error("SH is undefined");
|
|
6879
|
-
let { points: t, center: n, scaledTrademark: r } = ge(Le, Re, O)
|
|
6880
|
-
if (
|
|
6880
|
+
let { points: t, center: n, scaledTrademark: r } = ge(Le, Re, O);
|
|
6881
|
+
if (R.value === "Points defined") e.actor.send({ type: ns });
|
|
6881
6882
|
else if (R.value === "Shape defined") e.actor.send({ type: Uo });
|
|
6882
6883
|
else if (R.value === "Trademark defined") e.actor.send({ type: Uo });
|
|
6883
6884
|
else if (R.value === "Finished") e.onCloseModal(x, p, t, r)(), e.actor.send({ type: Wo });
|
|
@@ -6908,8 +6909,8 @@ function Kc(e) {
|
|
|
6908
6909
|
function je(t, n, r) {
|
|
6909
6910
|
if (n) k(void 0), e.actor.send({ type: r });
|
|
6910
6911
|
else {
|
|
6911
|
-
let { points: n } = ve(), r = n[ae(t, n)];
|
|
6912
|
-
|
|
6912
|
+
let { points: n } = ve(e.trademarkLineScale), r = n[ae(t, n)];
|
|
6913
|
+
k(r), e.actor.send({
|
|
6913
6914
|
type: ts,
|
|
6914
6915
|
trademark: r
|
|
6915
6916
|
});
|
|
@@ -6957,7 +6958,7 @@ function Kc(e) {
|
|
|
6957
6958
|
je(i, a, is);
|
|
6958
6959
|
break;
|
|
6959
6960
|
case Ho:
|
|
6960
|
-
|
|
6961
|
+
a && e.actor.send({ type: as });
|
|
6961
6962
|
break;
|
|
6962
6963
|
default: console.log(`handleMouseDown: unhandled state ${n.value}`);
|
|
6963
6964
|
}
|