@glodon-aiot/dataset-annotation 3.11.1-shapshot.1765331459 → 3.13.0-alpha.28

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.
Files changed (118) hide show
  1. package/dist/es/DatasetContext/index.mjs +6 -3
  2. package/dist/es/components/DetectionAnnotation/components/ImageDetail/index.mjs +94 -91
  3. package/dist/es/components/DetectionAnnotation/components/ImageModal/index.mjs +129 -0
  4. package/dist/es/components/DetectionAnnotation/components/ImageModal/style.less.mjs +4 -0
  5. package/dist/es/components/DetectionAnnotation/components/LabelMaker/Drawable.mjs +37 -28
  6. package/dist/es/components/DetectionAnnotation/components/LabelMaker/RectLabel.mjs +136 -108
  7. package/dist/es/components/DetectionAnnotation/components/LabelMaker/index.mjs +197 -162
  8. package/dist/es/components/DetectionAnnotation/index.mjs +424 -395
  9. package/dist/es/components/Iconfont/index.mjs +2 -2
  10. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/index.mjs +1 -1
  11. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/index.mjs +1 -1
  12. package/dist/es/components/OcrAnnotation/OcrModal/index.mjs +43 -45
  13. package/dist/es/components/PicZipImportModal/config.mjs +47 -0
  14. package/dist/es/components/PicZipImportModal/index.mjs +308 -293
  15. package/dist/es/components/PicZipImportModal/pic_vlm_json_zip.svg.mjs +4 -0
  16. package/dist/es/components/PicZipImportModal/pic_vlm_zip.svg.mjs +4 -0
  17. package/dist/es/components/PreLabelOCR/index.mjs +1 -1
  18. package/dist/es/components/VLMAnnotation/RegionItem.mjs +94 -0
  19. package/dist/es/components/VLMAnnotation/TextAnnotationPanel.mjs +83 -0
  20. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasDrag.mjs +116 -0
  21. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasSetup.mjs +115 -0
  22. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasZoom.mjs +42 -0
  23. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCropRegionImage.mjs +55 -0
  24. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteControl.mjs +51 -0
  25. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.mjs +47 -0
  26. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.mjs +248 -0
  27. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRLoadingIcon.mjs +106 -0
  28. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.mjs +68 -0
  29. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionHover.mjs +38 -0
  30. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.mjs +141 -0
  31. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionNameText.mjs +72 -0
  32. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.mjs +113 -0
  33. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionUpdate.mjs +103 -0
  34. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useTextLayouts.mjs +156 -0
  35. package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/del.png.mjs +4 -0
  36. package/dist/es/components/VLMAnnotation/VLMLabelMaker/index.mjs +526 -0
  37. package/dist/es/components/VLMAnnotation/VLMLabelMaker/style.less.mjs +4 -0
  38. package/dist/es/components/VLMAnnotation/VLMLabelMaker/utils/coordinateUtils.mjs +33 -0
  39. package/dist/es/components/VLMAnnotation/components/DragButton.mjs +18 -0
  40. package/dist/es/components/VLMAnnotation/components/FitToScreenButton.mjs +16 -0
  41. package/dist/es/components/VLMAnnotation/components/RectangleButton.mjs +30 -0
  42. package/dist/es/components/VLMAnnotation/components/Toolbar.mjs +40 -0
  43. package/dist/es/components/VLMAnnotation/components/ZoomControls.mjs +44 -0
  44. package/dist/es/components/VLMAnnotation/constants.mjs +50 -0
  45. package/dist/es/components/VLMAnnotation/index.mjs +242 -0
  46. package/dist/es/components/VLMAnnotation/style.less.mjs +4 -0
  47. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/index.mjs +343 -0
  48. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/style.less.mjs +4 -0
  49. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.mjs +240 -0
  50. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.mjs +201 -0
  51. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/style.less.mjs +4 -0
  52. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/index.mjs +455 -0
  53. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/style.less.mjs +4 -0
  54. package/dist/es/components/VLMAnnotationDetail/VlmModal/index.mjs +149 -0
  55. package/dist/es/components/VLMAnnotationDetail/VlmModal/style.less.mjs +4 -0
  56. package/dist/es/components/VLMAnnotationDetail/index.mjs +449 -0
  57. package/dist/es/components/VLMAnnotationDetail/style.less.mjs +4 -0
  58. package/dist/es/constant.mjs +3 -3
  59. package/dist/es/createVlmtasetAnnotation/index.mjs +131 -0
  60. package/dist/es/featuresConfig.mjs +13 -9
  61. package/dist/es/index.mjs +11 -7
  62. package/dist/lib/index.js +4 -3
  63. package/dist/src/DatasetContext/index.d.ts +2 -0
  64. package/dist/src/components/DetectionAnnotation/components/ImageDetail/index.d.ts +1 -0
  65. package/dist/src/components/DetectionAnnotation/components/ImageModal/index.d.ts +34 -0
  66. package/dist/src/components/Iconfont/font_4439177_tgvowh6bmlb.d.ts +0 -0
  67. package/dist/src/components/PicZipImportModal/config.d.ts +23 -0
  68. package/dist/src/components/VLMAnnotation/ImageAnnotationDebugger.d.ts +4 -0
  69. package/dist/src/components/VLMAnnotation/RegionItem.d.ts +4 -0
  70. package/dist/src/components/VLMAnnotation/TextAnnotationPanel.d.ts +4 -0
  71. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasDrag.d.ts +13 -0
  72. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasSetup.d.ts +38 -0
  73. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasZoom.d.ts +18 -0
  74. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCropRegionImage.d.ts +7 -0
  75. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteControl.d.ts +13 -0
  76. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.d.ts +21 -0
  77. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.d.ts +32 -0
  78. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRLoadingIcon.d.ts +11 -0
  79. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.d.ts +28 -0
  80. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionHover.d.ts +13 -0
  81. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.d.ts +37 -0
  82. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionNameText.d.ts +12 -0
  83. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.d.ts +15 -0
  84. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionUpdate.d.ts +32 -0
  85. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useTextLayouts.d.ts +25 -0
  86. package/dist/src/components/VLMAnnotation/VLMLabelMaker/index.d.ts +4 -0
  87. package/dist/src/components/VLMAnnotation/VLMLabelMaker/utils/coordinateUtils.d.ts +32 -0
  88. package/dist/src/components/VLMAnnotation/components/DragButton.d.ts +7 -0
  89. package/dist/src/components/VLMAnnotation/components/FitToScreenButton.d.ts +6 -0
  90. package/dist/src/components/VLMAnnotation/components/RectangleButton.d.ts +7 -0
  91. package/dist/src/components/VLMAnnotation/components/Toolbar.d.ts +4 -0
  92. package/dist/src/components/VLMAnnotation/components/ZoomControls.d.ts +4 -0
  93. package/dist/src/components/VLMAnnotation/constants.d.ts +97 -0
  94. package/dist/src/components/VLMAnnotation/index.d.ts +6 -0
  95. package/dist/src/components/VLMAnnotation/types.d.ts +172 -0
  96. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/index.d.ts +14 -0
  97. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.d.ts +12 -0
  98. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.d.ts +12 -0
  99. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/index.d.ts +12 -0
  100. package/dist/src/components/VLMAnnotationDetail/VlmModal/index.d.ts +17 -0
  101. package/dist/src/components/VLMAnnotationDetail/index.d.ts +6 -0
  102. package/dist/src/constant.d.ts +1 -1
  103. package/dist/src/createVlmtasetAnnotation/index.d.ts +16 -0
  104. package/dist/src/featuresConfig.d.ts +4 -0
  105. package/dist/src/index.d.ts +3 -0
  106. package/package.json +2 -2
  107. package/dist/dataset-annotation.js +0 -123598
  108. package/dist/dataset-annotation.umd.cjs +0 -1017
  109. package/dist/example/DatasetAnnotationDemo.d.ts +0 -3
  110. package/dist/example/DemoTabs.d.ts +0 -3
  111. package/dist/example/DetectionDatasetDemo.d.ts +0 -5
  112. package/dist/example/DetectionImageDemo.d.ts +0 -5
  113. package/dist/example/OcrDatasetDemo.d.ts +0 -5
  114. package/dist/example/OcrImageDemo.d.ts +0 -5
  115. package/dist/example/OcrkvcDatasetDemo.d.ts +0 -5
  116. package/dist/example/constant.local.d.ts +0 -6
  117. package/dist/example/index.d.ts +0 -1
  118. package/dist/src/utils/reactCompatibility.d.ts +0 -5
@@ -1,10 +1,13 @@
1
- import { createContext as t } from "react";
2
- const a = t({
1
+ import { createContext as e } from "react";
2
+ const a = e({
3
3
  datasetId: "",
4
4
  versionId: "",
5
5
  no: "",
6
6
  loading: !1,
7
- services: {}
7
+ services: {},
8
+ token: "",
9
+ apiUrl: "",
10
+ featuresConfig: {}
8
11
  });
9
12
  export {
10
13
  a as default
@@ -1,166 +1,169 @@
1
- var Z = Object.defineProperty, _ = Object.defineProperties;
2
- var $ = Object.getOwnPropertyDescriptors;
3
- var E = Object.getOwnPropertySymbols;
4
- var V = Object.prototype.hasOwnProperty, S = Object.prototype.propertyIsEnumerable;
5
- var F = (n, t, a) => t in n ? Z(n, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : n[t] = a, m = (n, t) => {
1
+ var _ = Object.defineProperty, $ = Object.defineProperties;
2
+ var V = Object.getOwnPropertyDescriptors;
3
+ var M = Object.getOwnPropertySymbols;
4
+ var S = Object.prototype.hasOwnProperty, ee = Object.prototype.propertyIsEnumerable;
5
+ var A = (n, t, a) => t in n ? _(n, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : n[t] = a, m = (n, t) => {
6
6
  for (var a in t || (t = {}))
7
- V.call(t, a) && F(n, a, t[a]);
8
- if (E)
9
- for (var a of E(t))
10
- S.call(t, a) && F(n, a, t[a]);
7
+ S.call(t, a) && A(n, a, t[a]);
8
+ if (M)
9
+ for (var a of M(t))
10
+ ee.call(t, a) && A(n, a, t[a]);
11
11
  return n;
12
- }, N = (n, t) => _(n, $(t));
13
- import { jsxs as p, jsx as r } from "react/jsx-runtime";
14
- import { useRef as M, useState as b, useEffect as x } from "react";
15
- import { Button as A } from "antd";
16
- import { useKeyPress as B } from "ahooks";
12
+ }, u = (n, t) => $(n, V(t));
13
+ import { jsxs as b, jsx as c } from "react/jsx-runtime";
14
+ import { useRef as B, useState as h, useEffect as g } from "react";
15
+ import { Button as H } from "antd";
16
+ import { useKeyPress as K } from "ahooks";
17
17
  import "./style.less.mjs";
18
- import ee from "../Labels/index.mjs";
19
- import ie from "../LabelMaker/index.mjs";
20
- import H from "../../../Iconfont/index.mjs";
21
- const fe = (n) => {
22
- var P, z, D;
18
+ import ie from "../Labels/index.mjs";
19
+ import le from "../LabelMaker/index.mjs";
20
+ import O from "../../../Iconfont/index.mjs";
21
+ const me = (n) => {
22
+ var D, E, F;
23
23
  const {
24
24
  datasetId: t,
25
25
  isImageDetailVisible: a = !0,
26
26
  currentSample: e,
27
- onNextClick: h,
28
- onPrevClick: g,
27
+ onNextClick: v,
28
+ onPrevClick: L,
29
29
  labels: d = [],
30
- editing: K,
31
- onRefresh: v,
32
- onChange: R,
33
- isPreLabel: j,
34
- settingHide: k,
35
- imgCount: c,
36
- readonly: O,
37
- showLabelList: q = !0,
38
- renderLabelItem: G
39
- } = n, J = M(null), Q = M({}), [C, T] = b({}), [u, L] = b(), [o, I] = b(), [W, X] = b(!1), [U, w] = b(!1);
40
- B("rightarrow", () => {
41
- h && h();
42
- }), B("leftarrow", () => {
43
- g && g();
44
- }), x(() => () => {
45
- W && v && v();
46
- }, []), x(() => {
30
+ editing: q,
31
+ onRefresh: N,
32
+ onChange: k,
33
+ isPreLabel: C,
34
+ settingHide: U,
35
+ imgCount: r,
36
+ readonly: G,
37
+ showLabelList: P = !0,
38
+ renderLabelItem: J,
39
+ onLoadingChange: I
40
+ } = n, Q = B(null), T = B({}), [z, W] = h({}), [w, p] = h(), [o, y] = h(), [X, Y] = h(!1), [x, R] = h(!1);
41
+ K("rightarrow", () => {
42
+ v && v();
43
+ }), K("leftarrow", () => {
44
+ L && L();
45
+ }), g(() => () => {
46
+ X && N && N();
47
+ }, []), g(() => {
47
48
  var l, s;
48
- if (L(void 0), I(void 0), !a || !((l = e == null ? void 0 : e.labels) != null && l.length))
49
+ if (p(void 0), y(void 0), !a || !((l = e == null ? void 0 : e.labels) != null && l.length))
49
50
  return;
50
- const i = (s = o || e) == null ? void 0 : s.labels.reduce((f, y) => (f[y.id] ? ++f[y.id] : f[y.id] = 1, f), {});
51
- T(i || {});
52
- }, [a, e, o]), x(() => {
53
- e != null && e.fileUrl && w(!0);
54
- }, [e == null ? void 0 : e.fileUrl]), x(() => {
51
+ const i = (s = o || e) == null ? void 0 : s.labels.reduce((f, j) => (f[j.id] ? ++f[j.id] : f[j.id] = 1, f), {});
52
+ W(i || {});
53
+ }, [a, e, o]), g(() => {
54
+ e != null && e.fileUrl && R(!0);
55
+ }, [e == null ? void 0 : e.fileUrl]), g(() => {
56
+ I && I(x);
57
+ }, [x, I]), g(() => {
55
58
  if (o != null && o.labels) {
56
59
  const i = [];
57
60
  o.labels.forEach((l) => {
58
61
  const s = d.find((f) => f.id === l.id);
59
- s && i.push(N(m({}, l), {
62
+ s && i.push(u(m({}, l), {
60
63
  label: s.label
61
64
  }));
62
- }), o.labels = i, I(m({}, o));
65
+ }), o.labels = i, y(m({}, o));
63
66
  }
64
67
  }, [d]);
65
- const Y = () => {
66
- J.current && w(!1);
68
+ const Z = () => {
69
+ Q.current && R(!1);
67
70
  };
68
- return window.onresize = Y, /* @__PURE__ */ p("div", {
71
+ return window.onresize = Z, /* @__PURE__ */ b("div", {
69
72
  className: "detection-image-detail",
70
- children: [/* @__PURE__ */ p("div", {
73
+ children: [/* @__PURE__ */ b("div", {
71
74
  className: "detail-image",
72
- children: [k ? /* @__PURE__ */ p("div", {
75
+ children: [U ? /* @__PURE__ */ b("div", {
73
76
  className: "img-detail-info",
74
- children: ["第 ", c == null ? void 0 : c.index, " 张 / 共 ", c == null ? void 0 : c.total, " 张"]
75
- }) : /* @__PURE__ */ r("div", {
77
+ children: ["第 ", r == null ? void 0 : r.index, " 张 / 共 ", r == null ? void 0 : r.total, " 张"]
78
+ }) : /* @__PURE__ */ c("div", {
76
79
  className: "img-detail-info",
77
- children: c == null ? void 0 : c.index
78
- }), /* @__PURE__ */ p("div", {
80
+ children: r == null ? void 0 : r.index
81
+ }), /* @__PURE__ */ b("div", {
79
82
  className: "detail-content",
80
- children: [g && /* @__PURE__ */ r(A, {
83
+ children: [L && /* @__PURE__ */ c(H, {
81
84
  className: "select-prev",
82
- icon: /* @__PURE__ */ r(H, {
85
+ icon: /* @__PURE__ */ c(O, {
83
86
  type: "icon-zuojiantou"
84
87
  }),
85
88
  type: "text",
86
- disabled: U,
87
- onClick: () => g(),
89
+ disabled: x,
90
+ onClick: () => L(),
88
91
  tabIndex: 0
89
- }), /* @__PURE__ */ r("div", {
92
+ }), /* @__PURE__ */ b("div", {
90
93
  className: "select-main",
91
- ref: Q,
92
- children: /* @__PURE__ */ r(ie, {
93
- disabled: O,
94
+ ref: T,
95
+ children: [((D = e == null ? void 0 : e.sampleFileName) == null ? void 0 : D.name) && /* @__PURE__ */ c("div", {
96
+ className: "img-detail-name-overlay",
97
+ children: e.sampleFileName.name
98
+ }), /* @__PURE__ */ c(le, {
99
+ disabled: G,
94
100
  imageUrl: (e == null ? void 0 : e.fileUrl) || "",
95
- pen: u,
96
- labels: ((P = o ? o.labels : e == null ? void 0 : e.labels) == null ? void 0 : P.map((i) => {
101
+ pen: w,
102
+ labels: ((E = o ? o.labels : e == null ? void 0 : e.labels) == null ? void 0 : E.map((i) => {
97
103
  var l;
98
- return N(m({}, i), {
104
+ return u(m({}, i), {
99
105
  color: ((l = d.find((s) => s.id === i.id)) == null ? void 0 : l.color) || ""
100
106
  });
101
107
  })) || [],
102
- onImageLoad: () => w(!1),
108
+ onImageLoad: () => R(!1),
103
109
  onChange: (i) => {
104
- if (L(void 0), !e)
110
+ if (p(void 0), !e)
105
111
  return;
106
- const l = N(m({}, e), {
112
+ const l = u(m({}, e), {
107
113
  labels: i.map((s) => ({
108
114
  id: s.id,
109
115
  label: s.label,
110
116
  box: s.box
111
117
  }))
112
118
  });
113
- I(l), R && R(l);
119
+ y(l), k && k(l);
114
120
  },
115
- isPreLabel: j,
116
- renderLabelItem: G
117
- })
118
- }), h && /* @__PURE__ */ r(A, {
121
+ isPreLabel: C,
122
+ renderLabelItem: J
123
+ }, P ? "with-slide" : "no-slide")]
124
+ }), v && /* @__PURE__ */ c(H, {
119
125
  className: "select-next",
120
- icon: /* @__PURE__ */ r(H, {
126
+ icon: /* @__PURE__ */ c(O, {
121
127
  type: "icon-youjiantou"
122
128
  }),
123
129
  type: "text",
124
- disabled: U,
125
- onClick: () => h()
130
+ disabled: x,
131
+ onClick: () => v()
126
132
  })]
127
- }), ((z = e == null ? void 0 : e.sampleFileName) == null ? void 0 : z.name) && /* @__PURE__ */ r("div", {
128
- className: "img-detail-info",
129
- children: e.sampleFileName.name
130
133
  })]
131
- }), (!!(d != null && d.length) || K) && q && /* @__PURE__ */ r("div", {
134
+ }), (!!(d != null && d.length) || q) && P && /* @__PURE__ */ c("div", {
132
135
  className: "detail-slide",
133
- children: /* @__PURE__ */ r(ee, {
136
+ children: /* @__PURE__ */ c(ie, {
134
137
  datasetId: t,
135
138
  selectMode: "single",
136
- data: ((D = Object.keys(C)) == null ? void 0 : D.map((i) => {
139
+ data: ((F = Object.keys(z)) == null ? void 0 : F.map((i) => {
137
140
  const l = d.find((s) => s.id === i);
138
141
  if (l)
139
- return l.count = C[i], l;
142
+ return l.count = z[i], l;
140
143
  }).filter((i) => !!i)) || [],
141
144
  shortcut: !0,
142
- selected: u ? [u] : [],
145
+ selected: w ? [w] : [],
143
146
  onSelectedChange: (i) => {
144
147
  if (i.length > 2) {
145
148
  console.warn("不支持选中多个标签");
146
149
  return;
147
150
  }
148
151
  if (!i.length) {
149
- L(void 0);
152
+ p(void 0);
150
153
  return;
151
154
  }
152
155
  const l = d == null ? void 0 : d.find((s) => i[0].label === s.label);
153
- L(l);
156
+ p(l);
154
157
  },
155
158
  onListChange: () => {
156
- X(!0), v && v();
159
+ Y(!0), N && N();
157
160
  },
158
- isPreLabel: j,
159
- settingHide: k
161
+ isPreLabel: C,
162
+ settingHide: U
160
163
  })
161
164
  })]
162
165
  });
163
166
  };
164
167
  export {
165
- fe as default
168
+ me as default
166
169
  };
@@ -0,0 +1,129 @@
1
+ import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
+ import { useState as P } from "react";
3
+ import { Modal as E, Tabs as j, Space as K, Button as a } from "antd";
4
+ import { useKeyPress as b } from "ahooks";
5
+ import V from "../ImageDetail/index.mjs";
6
+ import "./style.less.mjs";
7
+ import B from "../../../DataEmpty/index.mjs";
8
+ const G = (u) => {
9
+ const {
10
+ datasetId: v,
11
+ setIsImageDetailVisible: s,
12
+ isImageDetailVisible: c = !0,
13
+ currentSample: o,
14
+ onNextClick: t,
15
+ onPrevClick: r,
16
+ onSave: N,
17
+ onDeleteSample: m,
18
+ labels: y = [],
19
+ onRefresh: k,
20
+ onChange: I,
21
+ isPreLabel: n,
22
+ settingHide: L,
23
+ imgCount: F,
24
+ showLabelList: w = !0,
25
+ renderLabelItem: D,
26
+ onEnterEdit: f,
27
+ filterItems: h,
28
+ filterMode: S,
29
+ onFilterChange: p,
30
+ previewMode: i = !0,
31
+ canLabel: d = !1,
32
+ canDelete: g = !1
33
+ } = u, [C, x] = P(!1);
34
+ return b("rightarrow", () => {
35
+ i || t && t();
36
+ }), b("leftarrow", () => {
37
+ i || r && r();
38
+ }), /* @__PURE__ */ l(E, {
39
+ title: /* @__PURE__ */ e("div", {
40
+ className: "detection-sample-detail-title",
41
+ children: /* @__PURE__ */ e("span", {
42
+ children: i ? "详情" : "标注"
43
+ })
44
+ }),
45
+ width: "100%",
46
+ open: c,
47
+ onCancel: () => s(!1),
48
+ footer: null,
49
+ centered: !0,
50
+ wrapClassName: "detection-modal-wrap",
51
+ className: "detection-modal",
52
+ bodyStyle: {
53
+ padding: 0
54
+ },
55
+ destroyOnClose: !1,
56
+ children: [/* @__PURE__ */ e("div", {
57
+ className: "detail-tabs",
58
+ children: !i && h && /* @__PURE__ */ e(j, {
59
+ activeKey: S,
60
+ items: h,
61
+ onChange: (M) => p && p(M)
62
+ })
63
+ }), o ? /* @__PURE__ */ e(V, {
64
+ datasetId: v,
65
+ isImageDetailVisible: c,
66
+ setIsImageDetailVisible: s,
67
+ currentSample: o,
68
+ onNextClick: i ? t : void 0,
69
+ onPrevClick: i ? r : void 0,
70
+ labels: y,
71
+ editing: !i,
72
+ onRefresh: k,
73
+ onChange: I,
74
+ isPreLabel: n,
75
+ settingHide: L,
76
+ readonly: i || !d,
77
+ showLabelList: i ? !1 : w,
78
+ renderLabelItem: D,
79
+ onLoadingChange: x
80
+ }) : /* @__PURE__ */ e(B, {}), o && /* @__PURE__ */ e("div", {
81
+ className: "detail-footer",
82
+ children: i ? /* @__PURE__ */ l(K, {
83
+ children: [f && d && /* @__PURE__ */ e("div", {
84
+ className: "detail-actions",
85
+ children: /* @__PURE__ */ e(a, {
86
+ type: "primary",
87
+ onClick: f,
88
+ children: "标注"
89
+ })
90
+ }), g && /* @__PURE__ */ e(a, {
91
+ danger: !0,
92
+ onClick: m,
93
+ children: "删除数据"
94
+ })]
95
+ }) : /* @__PURE__ */ l("div", {
96
+ className: "footer-bar",
97
+ children: [/* @__PURE__ */ e("div", {
98
+ className: "footer-left"
99
+ }), /* @__PURE__ */ l("div", {
100
+ className: "footer-center",
101
+ children: [/* @__PURE__ */ e(a, {
102
+ onClick: r,
103
+ disabled: C,
104
+ children: "上一张"
105
+ }), /* @__PURE__ */ e(a, {
106
+ onClick: t,
107
+ disabled: C,
108
+ children: "下一张"
109
+ })]
110
+ }), /* @__PURE__ */ l("div", {
111
+ className: "footer-right",
112
+ children: [d && /* @__PURE__ */ e(a, {
113
+ type: "primary",
114
+ onClick: N,
115
+ disabled: n,
116
+ children: "保存标注"
117
+ }), g && /* @__PURE__ */ e(a, {
118
+ onClick: m,
119
+ disabled: n,
120
+ children: "删除数据"
121
+ })]
122
+ })]
123
+ })
124
+ })]
125
+ });
126
+ };
127
+ export {
128
+ G as default
129
+ };
@@ -0,0 +1,4 @@
1
+ const t = "";
2
+ export {
3
+ t as default
4
+ };
@@ -1,45 +1,54 @@
1
- function I(e, u) {
2
- y(e);
3
- let h = -1, s = -1, n = 0, p = 0;
4
- e.on("mouse:down", (g) => {
5
- h = -1, s = -1, n = 0, p = 0;
6
- const i = e.getZoom();
7
- s = g.e.offsetX / i, h = g.e.offsetY / i;
8
- }), e.on("mouse:up", (g) => {
9
- if (s === -1 && h === -1)
1
+ function X(e, n) {
2
+ T(e);
3
+ let h = -1, s = -1, p = 0, m = 0, w = !1;
4
+ e.on("mouse:down:before", (d) => {
5
+ const f = d.target, u = e.getActiveObject();
6
+ if (f && f !== e.backgroundImage) {
7
+ u !== f && (e.setActiveObject(f), e.requestRenderAll()), e.skipTargetFind = !1;
10
8
  return;
11
- const i = e.getZoom(), m = g.e.offsetX > e.getWidth() ? e.getWidth() / i : g.e.offsetX / i, w = g.e.offsetY > e.getHeight() ? e.getHeight() / i : g.e.offsetY / i;
12
- if (n = Math.abs(m - s), p = Math.abs(w - h), n === 0 || p === 0)
9
+ }
10
+ u && (e.discardActiveObject(), e.renderAll()), e.skipTargetFind = !0;
11
+ }), e.on("mouse:down", (d) => {
12
+ if (!e.skipTargetFind)
13
13
  return;
14
- const T = e.viewportTransform ? e.viewportTransform[4] / i : 0, X = e.viewportTransform ? e.viewportTransform[5] / i : 0;
15
- let f = h > w ? w : h, r = s > m ? m : s, l = n, d = p;
16
- f = f - X, r = r - T;
17
- const Y = () => {
18
- var o, b;
14
+ w = !0, h = -1, s = -1, p = 0, m = 0;
15
+ const f = e.getZoom();
16
+ s = d.e.offsetX / f, h = d.e.offsetY / f;
17
+ }), e.on("mouse:up", (d) => {
18
+ if (e.skipTargetFind = !1, !w || (w = !1, s === -1 && h === -1))
19
+ return;
20
+ const f = e.getZoom(), u = d.e.offsetX > e.getWidth() ? e.getWidth() / f : d.e.offsetX / f, b = d.e.offsetY > e.getHeight() ? e.getHeight() / f : d.e.offsetY / f;
21
+ if (p = Math.abs(u - s), m = Math.abs(b - h), p === 0 || m === 0)
22
+ return;
23
+ const y = e.viewportTransform ? e.viewportTransform[4] / f : 0, A = e.viewportTransform ? e.viewportTransform[5] / f : 0;
24
+ let r = h > b ? b : h, i = s > u ? u : s, l = p, g = m;
25
+ r = r - A, i = i - y;
26
+ const F = () => {
27
+ var o, k;
19
28
  const t = e.backgroundImage;
20
- t && typeof t != "string" && ((o = t.aCoords) != null && o.tl.x, (b = t.aCoords) != null && b.tl.y), t && typeof t != "string" && t.top !== void 0 && t.height !== void 0 && t.left !== void 0 && t.width !== void 0 && (f < t.top && (d = d - (t.top - f), f = t.top), f + d > t.top + t.height && (d = t.top + t.height - f + d - d, f = t.height + t.top - d), r < t.left && (l = l - (t.left - r), r = t.left), r + l > t.left + t.width && (l = t.left + t.width - r + l - l, r = t.width + t.left - l));
21
- }, k = (t) => {
29
+ t && typeof t != "string" && ((o = t.aCoords) != null && o.tl.x, (k = t.aCoords) != null && k.tl.y), t && typeof t != "string" && t.top !== void 0 && t.height !== void 0 && t.left !== void 0 && t.width !== void 0 && (r < t.top && (g = g - (t.top - r), r = t.top), r + g > t.top + t.height && (g = t.top + t.height - r + g - g, r = t.height + t.top - g), i < t.left && (l = l - (t.left - i), i = t.left), i + l > t.left + t.width && (l = t.left + t.width - i + l - l, i = t.width + t.left - l));
30
+ }, I = (t) => {
22
31
  const o = e.backgroundImage;
23
32
  return !(o && typeof o != "string" && o.top !== void 0 && o.height !== void 0 && o.left !== void 0 && o.width !== void 0 && (t[0] < o.left || t[1] < o.top || t[0] > o.left + o.width || t[1] > o.top + o.height));
24
33
  };
25
- Y();
26
- const c = [[r, f], [r + l, f], [r + l, f + d], [r, f + d]];
27
- u && c.every((t) => k(t)) && u({
34
+ F();
35
+ const c = [[i, r], [i + l, r], [i + l, r + g], [i, r + g]];
36
+ n && c.every((t) => I(t)) && n({
28
37
  id: "",
29
38
  color: "#cccccc",
30
39
  label: "未知",
31
40
  box: c
32
- }), e.skipTargetFind = !1, y(e);
41
+ }), T(e);
33
42
  });
34
43
  }
35
- const y = (e) => {
36
- e.off("mouse:down"), e.off("mouse:up");
44
+ const T = (e) => {
45
+ e.off("mouse:down"), e.off("mouse:down:before"), e.off("mouse:up"), e.skipTargetFind = !1;
37
46
  };
38
- function x(e, u, h) {
47
+ function Y(e, n, h) {
39
48
  if (!h)
40
- return I(e, u), e;
49
+ return X(e, n), e;
41
50
  }
42
51
  export {
43
- x as drawable,
44
- y as stopDraw
52
+ Y as drawable,
53
+ T as stopDraw
45
54
  };