@glodon-aiot/dataset-annotation 3.14.0-alpha.32 → 3.15.0-alpha.1
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/es/DatasetContext/index.mjs +3 -6
- package/dist/es/components/DetectionAnnotation/components/ImageDetail/index.mjs +91 -94
- package/dist/es/components/DetectionAnnotation/components/LabelMaker/Drawable.mjs +28 -37
- package/dist/es/components/DetectionAnnotation/components/LabelMaker/RectLabel.mjs +101 -145
- package/dist/es/components/DetectionAnnotation/components/LabelMaker/index.mjs +195 -256
- package/dist/es/components/DetectionAnnotation/index.mjs +424 -456
- package/dist/es/components/Iconfont/index.mjs +2 -2
- package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/index.mjs +1 -1
- package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/index.mjs +1 -1
- package/dist/es/components/OcrAnnotation/OcrModal/index.mjs +45 -43
- package/dist/es/components/PicZipImportModal/index.mjs +293 -308
- package/dist/es/components/PreLabelOCR/index.mjs +1 -1
- package/dist/es/constant.mjs +3 -3
- package/dist/es/featuresConfig.mjs +9 -13
- package/dist/es/index.mjs +7 -11
- package/dist/lib/index.js +3 -4
- package/dist/src/DatasetContext/index.d.ts +0 -2
- package/dist/src/components/DetectionAnnotation/components/ImageDetail/index.d.ts +0 -1
- package/dist/src/constant.d.ts +1 -1
- package/dist/src/featuresConfig.d.ts +0 -4
- package/dist/src/index.d.ts +0 -3
- package/package.json +2 -2
- package/dist/es/components/DetectionAnnotation/components/ImageModal/index.mjs +0 -129
- package/dist/es/components/DetectionAnnotation/components/ImageModal/style.less.mjs +0 -4
- package/dist/es/components/PicZipImportModal/config.mjs +0 -47
- package/dist/es/components/PicZipImportModal/pic_vlm_json_zip.svg.mjs +0 -4
- package/dist/es/components/PicZipImportModal/pic_vlm_zip.svg.mjs +0 -4
- package/dist/es/components/VLMAnnotation/RegionItem.mjs +0 -170
- package/dist/es/components/VLMAnnotation/TextAnnotationPanel.mjs +0 -94
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasDrag.mjs +0 -116
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasSetup.mjs +0 -115
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasZoom.mjs +0 -42
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCropRegionImage.mjs +0 -55
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteControl.mjs +0 -51
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.mjs +0 -62
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.mjs +0 -421
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRControl.mjs +0 -100
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRLoadingIcon.mjs +0 -106
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.mjs +0 -101
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionBoundaryCheck.mjs +0 -103
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionHover.mjs +0 -38
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.mjs +0 -173
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionNameText.mjs +0 -72
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.mjs +0 -116
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionUpdate.mjs +0 -98
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useTextLayouts.mjs +0 -156
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/ai.svg.mjs +0 -4
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/del.png.mjs +0 -4
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/error.svg.mjs +0 -4
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/loading.svg.mjs +0 -4
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/star.svg.mjs +0 -4
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/index.mjs +0 -651
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/style.less.mjs +0 -4
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/utils/coordinateUtils.mjs +0 -33
- package/dist/es/components/VLMAnnotation/components/DragButton.mjs +0 -18
- package/dist/es/components/VLMAnnotation/components/FitToScreenButton.mjs +0 -16
- package/dist/es/components/VLMAnnotation/components/RectangleButton.mjs +0 -30
- package/dist/es/components/VLMAnnotation/components/Toolbar.mjs +0 -40
- package/dist/es/components/VLMAnnotation/components/ZoomControls.mjs +0 -44
- package/dist/es/components/VLMAnnotation/constants.mjs +0 -57
- package/dist/es/components/VLMAnnotation/index.mjs +0 -279
- package/dist/es/components/VLMAnnotation/style.less.mjs +0 -4
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/index.mjs +0 -343
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/style.less.mjs +0 -4
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.mjs +0 -240
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.mjs +0 -201
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/style.less.mjs +0 -4
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/index.mjs +0 -455
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/style.less.mjs +0 -4
- package/dist/es/components/VLMAnnotationDetail/VlmModal/index.mjs +0 -149
- package/dist/es/components/VLMAnnotationDetail/VlmModal/style.less.mjs +0 -4
- package/dist/es/components/VLMAnnotationDetail/index.mjs +0 -449
- package/dist/es/components/VLMAnnotationDetail/style.less.mjs +0 -4
- package/dist/es/createVlmtasetAnnotation/index.mjs +0 -131
- package/dist/src/components/DetectionAnnotation/components/ImageModal/index.d.ts +0 -34
- package/dist/src/components/Iconfont/font_4439177_tgvowh6bmlb.d.ts +0 -0
- package/dist/src/components/PicZipImportModal/config.d.ts +0 -23
- package/dist/src/components/VLMAnnotation/ImageAnnotationDebugger.d.ts +0 -4
- package/dist/src/components/VLMAnnotation/RegionItem.d.ts +0 -4
- package/dist/src/components/VLMAnnotation/TextAnnotationPanel.d.ts +0 -4
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasDrag.d.ts +0 -13
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasSetup.d.ts +0 -38
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasZoom.d.ts +0 -18
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCropRegionImage.d.ts +0 -7
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteControl.d.ts +0 -13
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.d.ts +0 -22
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.d.ts +0 -34
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRControl.d.ts +0 -16
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRLoadingIcon.d.ts +0 -11
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.d.ts +0 -29
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionBoundaryCheck.d.ts +0 -31
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionHover.d.ts +0 -13
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.d.ts +0 -41
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionNameText.d.ts +0 -12
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.d.ts +0 -16
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionUpdate.d.ts +0 -32
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useTextLayouts.d.ts +0 -25
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/index.d.ts +0 -4
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/utils/coordinateUtils.d.ts +0 -32
- package/dist/src/components/VLMAnnotation/components/DragButton.d.ts +0 -7
- package/dist/src/components/VLMAnnotation/components/FitToScreenButton.d.ts +0 -6
- package/dist/src/components/VLMAnnotation/components/RectangleButton.d.ts +0 -7
- package/dist/src/components/VLMAnnotation/components/Toolbar.d.ts +0 -4
- package/dist/src/components/VLMAnnotation/components/ZoomControls.d.ts +0 -4
- package/dist/src/components/VLMAnnotation/constants.d.ts +0 -113
- package/dist/src/components/VLMAnnotation/index.d.ts +0 -6
- package/dist/src/components/VLMAnnotation/types.d.ts +0 -187
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/index.d.ts +0 -14
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.d.ts +0 -12
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.d.ts +0 -12
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/index.d.ts +0 -12
- package/dist/src/components/VLMAnnotationDetail/VlmModal/index.d.ts +0 -17
- package/dist/src/components/VLMAnnotationDetail/index.d.ts +0 -6
- package/dist/src/createVlmtasetAnnotation/index.d.ts +0 -16
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { Tooltip as r, Button as e } from "antd";
|
|
3
|
-
import { ExpandOutlined as i } from "@ant-design/icons";
|
|
4
|
-
const l = ({
|
|
5
|
-
onClick: o
|
|
6
|
-
}) => /* @__PURE__ */ t(r, {
|
|
7
|
-
title: "适应屏幕",
|
|
8
|
-
placement: "right",
|
|
9
|
-
children: /* @__PURE__ */ t(e, {
|
|
10
|
-
icon: /* @__PURE__ */ t(i, {}),
|
|
11
|
-
onClick: o
|
|
12
|
-
})
|
|
13
|
-
});
|
|
14
|
-
export {
|
|
15
|
-
l as default
|
|
16
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { jsx as t, jsxs as i, Fragment as n } from "react/jsx-runtime";
|
|
2
|
-
import { Tooltip as r, Button as c } from "antd";
|
|
3
|
-
import l from "../../Iconfont/index.mjs";
|
|
4
|
-
const s = ({
|
|
5
|
-
active: o,
|
|
6
|
-
onClick: e
|
|
7
|
-
}) => /* @__PURE__ */ t(r, {
|
|
8
|
-
title: /* @__PURE__ */ i(n, {
|
|
9
|
-
children: [/* @__PURE__ */ t("div", {
|
|
10
|
-
children: "画矩形-按R键"
|
|
11
|
-
}), /* @__PURE__ */ t("div", {
|
|
12
|
-
style: {
|
|
13
|
-
fontSize: 14,
|
|
14
|
-
color: "#ff9326"
|
|
15
|
-
},
|
|
16
|
-
children: "预标注服务会按需计费!"
|
|
17
|
-
})]
|
|
18
|
-
}),
|
|
19
|
-
placement: "right",
|
|
20
|
-
children: /* @__PURE__ */ t(c, {
|
|
21
|
-
icon: /* @__PURE__ */ t(l, {
|
|
22
|
-
type: "icon-biaozhu-juxingkuang"
|
|
23
|
-
}),
|
|
24
|
-
className: o ? "active" : "",
|
|
25
|
-
onClick: e
|
|
26
|
-
})
|
|
27
|
-
});
|
|
28
|
-
export {
|
|
29
|
-
s as default
|
|
30
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { jsxs as t, Fragment as f, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { Space as s, Divider as u } from "antd";
|
|
3
|
-
import d from "./RectangleButton.mjs";
|
|
4
|
-
import v from "./DragButton.mjs";
|
|
5
|
-
import C from "./ZoomControls.mjs";
|
|
6
|
-
import g from "./FitToScreenButton.mjs";
|
|
7
|
-
import { ZOOM_STEP as i } from "../constants.mjs";
|
|
8
|
-
const Z = ({
|
|
9
|
-
drawingMode: e,
|
|
10
|
-
draggable: n,
|
|
11
|
-
scale: m,
|
|
12
|
-
onToggleDrawingMode: c,
|
|
13
|
-
onToggleDrag: a,
|
|
14
|
-
onZoom: r,
|
|
15
|
-
onFitToScreen: l,
|
|
16
|
-
readOnly: p
|
|
17
|
-
}) => /* @__PURE__ */ t(s, {
|
|
18
|
-
direction: "vertical",
|
|
19
|
-
size: 16,
|
|
20
|
-
children: [!p && /* @__PURE__ */ t(f, {
|
|
21
|
-
children: [/* @__PURE__ */ o(d, {
|
|
22
|
-
active: e,
|
|
23
|
-
onClick: c
|
|
24
|
-
}), /* @__PURE__ */ o(v, {
|
|
25
|
-
active: n,
|
|
26
|
-
onClick: a
|
|
27
|
-
}), /* @__PURE__ */ o(u, {
|
|
28
|
-
type: "horizontal"
|
|
29
|
-
})]
|
|
30
|
-
}), /* @__PURE__ */ o(C, {
|
|
31
|
-
scale: m,
|
|
32
|
-
onZoomIn: () => r(-i),
|
|
33
|
-
onZoomOut: () => r(i)
|
|
34
|
-
}), /* @__PURE__ */ o(g, {
|
|
35
|
-
onClick: l
|
|
36
|
-
})]
|
|
37
|
-
});
|
|
38
|
-
export {
|
|
39
|
-
Z as default
|
|
40
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { jsxs as t, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { Space as m, Tooltip as n, Button as e } from "antd";
|
|
3
|
-
import { ZoomInOutlined as p, ZoomOutOutlined as s } from "@ant-design/icons";
|
|
4
|
-
import { MAX_ZOOM as a, MIN_ZOOM as h } from "../constants.mjs";
|
|
5
|
-
const Z = ({
|
|
6
|
-
scale: i,
|
|
7
|
-
onZoomIn: r,
|
|
8
|
-
onZoomOut: l
|
|
9
|
-
}) => {
|
|
10
|
-
const c = i >= a, d = i <= h;
|
|
11
|
-
return /* @__PURE__ */ t(m, {
|
|
12
|
-
direction: "vertical",
|
|
13
|
-
size: 16,
|
|
14
|
-
children: [/* @__PURE__ */ o(n, {
|
|
15
|
-
title: "放大-鼠标滚轮前滑",
|
|
16
|
-
placement: "right",
|
|
17
|
-
children: /* @__PURE__ */ o(e, {
|
|
18
|
-
icon: /* @__PURE__ */ o(p, {}),
|
|
19
|
-
onClick: r,
|
|
20
|
-
disabled: c
|
|
21
|
-
})
|
|
22
|
-
}), /* @__PURE__ */ t("div", {
|
|
23
|
-
style: {
|
|
24
|
-
textAlign: "center",
|
|
25
|
-
fontSize: 8,
|
|
26
|
-
color: "#666",
|
|
27
|
-
padding: "4px 0",
|
|
28
|
-
lineHeight: "32px"
|
|
29
|
-
},
|
|
30
|
-
children: [Math.round(i * 100), "%"]
|
|
31
|
-
}), /* @__PURE__ */ o(n, {
|
|
32
|
-
title: "缩小-鼠标滚轮后滑",
|
|
33
|
-
placement: "right",
|
|
34
|
-
children: /* @__PURE__ */ o(e, {
|
|
35
|
-
icon: /* @__PURE__ */ o(s, {}),
|
|
36
|
-
onClick: l,
|
|
37
|
-
disabled: d
|
|
38
|
-
})
|
|
39
|
-
})]
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
export {
|
|
43
|
-
Z as default
|
|
44
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
const _ = 8, E = 0.1, O = 0.999, T = 0.01, R = 100, L = 2, C = "#EAD4FF", A = "#9C24F2", I = "rgba(156, 36, 242, 0.1)", n = "rgba(156, 36, 242, 0.05)", s = "transparent", t = "rgba(0, 0, 0, 0)", N = [5, 5], c = "vlm-label-maker-canvas", o = 300, S = 0.7, F = 0.05, D = 0.95, M = "rect", a = "区域", r = "区域1", P = "Arial, sans-serif", H = 12, U = 4, X = 3, G = 3, g = 1.5, Y = 0.5, b = 3e-3, K = "rgba(156, 36, 242, 0.2)", Z = "rgba(156, 36, 242, 0.5)", e = "#9C24F2", B = "rgba(156, 36, 242, 0.2)", W = "rgba(156, 36, 242, 0.2)", l = "rgba(156, 36, 242, 0.5)", V = "rgba(0, 255, 0, 0.2)", i = 300, m = "#9C24F2", p = 6, v = 24, f = 20, k = 24, x = 24, d = 20, h = 24, j = "#9C24F2", q = "image/png", u = "确认删除", w = "确定要删除此标注区域吗?", y = "确定", z = "取消", J = "rgba(156, 36, 242, 0.5)", Q = 1, $ = [5, 5];
|
|
2
|
-
export {
|
|
3
|
-
A as ACTIVE_RECT_STROKE_COLOR,
|
|
4
|
-
d as AI_CONTROL_OFFSET_X,
|
|
5
|
-
h as AI_CONTROL_OFFSET_Y,
|
|
6
|
-
x as AI_ICON_SIZE,
|
|
7
|
-
L as BASE_STROKE_WIDTH,
|
|
8
|
-
c as CANVAS_CONTAINER_CLASS,
|
|
9
|
-
m as CONTROL_POINT_COLOR,
|
|
10
|
-
p as CONTROL_POINT_SIZE,
|
|
11
|
-
J as CROSSHAIR_LINE_COLOR,
|
|
12
|
-
$ as CROSSHAIR_LINE_DASH_ARRAY,
|
|
13
|
-
Q as CROSSHAIR_LINE_WIDTH,
|
|
14
|
-
S as DEFAULT_LEFT_RATIO,
|
|
15
|
-
D as DEFAULT_MAX_RATIO,
|
|
16
|
-
o as DEFAULT_MIN_LEFT_WIDTH,
|
|
17
|
-
F as DEFAULT_MIN_RATIO,
|
|
18
|
-
r as DEFAULT_REGION_NAME,
|
|
19
|
-
M as DEFAULT_SHAPE_TYPE,
|
|
20
|
-
f as DELETE_CONTROL_OFFSET_X,
|
|
21
|
-
k as DELETE_CONTROL_OFFSET_Y,
|
|
22
|
-
v as DELETE_ICON_SIZE,
|
|
23
|
-
z as DELETE_MODAL_CANCEL_TEXT,
|
|
24
|
-
w as DELETE_MODAL_CONTENT,
|
|
25
|
-
y as DELETE_MODAL_OK_TEXT,
|
|
26
|
-
u as DELETE_MODAL_TITLE,
|
|
27
|
-
n as HOVER_RECT_FILL_COLOR,
|
|
28
|
-
q as IMAGE_EXPORT_FORMAT,
|
|
29
|
-
_ as MAX_ZOOM,
|
|
30
|
-
E as MIN_ZOOM,
|
|
31
|
-
b as OCR_SCAN_ANIMATION_SPEED,
|
|
32
|
-
X as OCR_SCAN_LINE_BASE_HEIGHT,
|
|
33
|
-
Z as OCR_SCAN_LINE_BRIGHT_COLOR,
|
|
34
|
-
e as OCR_SCAN_LINE_CORE_COLOR,
|
|
35
|
-
Y as OCR_SCAN_LINE_CORE_HEIGHT_MULTIPLIER,
|
|
36
|
-
g as OCR_SCAN_LINE_CORE_POSITION_MULTIPLIER,
|
|
37
|
-
K as OCR_SCAN_LINE_GLOW_COLOR,
|
|
38
|
-
G as OCR_SCAN_LINE_GLOW_MULTIPLIER,
|
|
39
|
-
C as RECT_STROKE_COLOR,
|
|
40
|
-
P as REGION_NAME_FONT_FAMILY,
|
|
41
|
-
H as REGION_NAME_FONT_SIZE,
|
|
42
|
-
U as REGION_NAME_PADDING,
|
|
43
|
-
a as REGION_NAME_PREFIX,
|
|
44
|
-
j as REGION_NAME_TEXT_COLOR,
|
|
45
|
-
I as SELECTED_RECT_FILL_COLOR,
|
|
46
|
-
t as TEMP_RECT_FILL_COLOR,
|
|
47
|
-
N as TEMP_RECT_STROKE_DASH_ARRAY,
|
|
48
|
-
V as TEXT_LAYOUT_RECT_CLICK_FEEDBACK_COLOR,
|
|
49
|
-
i as TEXT_LAYOUT_RECT_FEEDBACK_DELAY,
|
|
50
|
-
B as TEXT_LAYOUT_RECT_FILL_COLOR,
|
|
51
|
-
l as TEXT_LAYOUT_RECT_HOVER_STROKE_COLOR,
|
|
52
|
-
W as TEXT_LAYOUT_RECT_STROKE_COLOR,
|
|
53
|
-
s as TRANSPARENT_FILL,
|
|
54
|
-
O as ZOOM_FACTOR,
|
|
55
|
-
T as ZOOM_PRECISION_ERROR,
|
|
56
|
-
R as ZOOM_STEP
|
|
57
|
-
};
|
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
var me = Object.defineProperty, fe = Object.defineProperties;
|
|
2
|
-
var pe = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var ee = Object.getOwnPropertySymbols;
|
|
4
|
-
var ve = Object.prototype.hasOwnProperty, be = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var te = (l, o, r) => o in l ? me(l, o, { enumerable: !0, configurable: !0, writable: !0, value: r }) : l[o] = r, u = (l, o) => {
|
|
6
|
-
for (var r in o || (o = {}))
|
|
7
|
-
ve.call(o, r) && te(l, r, o[r]);
|
|
8
|
-
if (ee)
|
|
9
|
-
for (var r of ee(o))
|
|
10
|
-
be.call(o, r) && te(l, r, o[r]);
|
|
11
|
-
return l;
|
|
12
|
-
}, a = (l, o) => fe(l, pe(o));
|
|
13
|
-
import { jsxs as Ee, jsx as g } from "react/jsx-runtime";
|
|
14
|
-
import { useMemo as Te, useState as b, useRef as S, useEffect as w } from "react";
|
|
15
|
-
import { Modal as Ae } from "antd";
|
|
16
|
-
import "./style.less.mjs";
|
|
17
|
-
import ye from "./TextAnnotationPanel.mjs";
|
|
18
|
-
import Le from "./VLMLabelMaker/index.mjs";
|
|
19
|
-
import { DEFAULT_SHAPE_TYPE as Re, DELETE_MODAL_TITLE as Me, DELETE_MODAL_CONTENT as we, DELETE_MODAL_OK_TEXT as _e, DELETE_MODAL_CANCEL_TEXT as he, DEFAULT_MIN_LEFT_WIDTH as ge, DEFAULT_MAX_RATIO as F, DEFAULT_MIN_RATIO as ne, DEFAULT_LEFT_RATIO as De } from "./constants.mjs";
|
|
20
|
-
const V = (l) => {
|
|
21
|
-
var o, r;
|
|
22
|
-
return a(u({}, l), {
|
|
23
|
-
labels: (r = (o = l.labels) == null ? void 0 : o.map((c) => {
|
|
24
|
-
if (c.shape.name === "rect") {
|
|
25
|
-
const {
|
|
26
|
-
x: L,
|
|
27
|
-
y: E,
|
|
28
|
-
width: T,
|
|
29
|
-
height: f
|
|
30
|
-
} = c.shape;
|
|
31
|
-
return a(u({}, c), {
|
|
32
|
-
shape: a(u({}, c.shape), {
|
|
33
|
-
x: L + T / 2,
|
|
34
|
-
y: E + f / 2
|
|
35
|
-
})
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
return c;
|
|
39
|
-
})) != null ? r : []
|
|
40
|
-
});
|
|
41
|
-
}, Oe = (l) => {
|
|
42
|
-
var o, r;
|
|
43
|
-
return a(u({}, l), {
|
|
44
|
-
labels: (r = (o = l.labels) == null ? void 0 : o.map((c) => {
|
|
45
|
-
if (c.shape.name === "rect") {
|
|
46
|
-
const {
|
|
47
|
-
x: L,
|
|
48
|
-
y: E,
|
|
49
|
-
width: T,
|
|
50
|
-
height: f
|
|
51
|
-
} = c.shape;
|
|
52
|
-
return a(u({}, c), {
|
|
53
|
-
shape: a(u({}, c.shape), {
|
|
54
|
-
x: L - T / 2,
|
|
55
|
-
y: E - f / 2
|
|
56
|
-
})
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
return c;
|
|
60
|
-
})) != null ? r : []
|
|
61
|
-
});
|
|
62
|
-
}, Be = ({
|
|
63
|
-
sample: l,
|
|
64
|
-
labelDefinitions: o,
|
|
65
|
-
onChange: r,
|
|
66
|
-
leftRatio: c,
|
|
67
|
-
resizable: L = !0,
|
|
68
|
-
minLeftRatio: E,
|
|
69
|
-
maxLeftRatio: T,
|
|
70
|
-
minLeftWidth: f = ge,
|
|
71
|
-
onRatioChange: U,
|
|
72
|
-
ocrRecognize: re,
|
|
73
|
-
coordinateType: R = "top-left",
|
|
74
|
-
hideRightSide: D,
|
|
75
|
-
readOnly: B
|
|
76
|
-
}) => {
|
|
77
|
-
var K, Y, G, J, Q, Z;
|
|
78
|
-
const i = Te(() => R === "center" ? Oe(l) : l, [l, R]), [d, _] = b((K = i == null ? void 0 : i.labels) != null ? K : []), [m, p] = b(null), [O, v] = b(null), [A, y] = b(null);
|
|
79
|
-
b(Re);
|
|
80
|
-
const h = S(null), [Ne, oe] = b(0);
|
|
81
|
-
w(() => {
|
|
82
|
-
const t = setInterval(() => {
|
|
83
|
-
h.current && oe((e) => e + 1);
|
|
84
|
-
}, 100);
|
|
85
|
-
return () => clearInterval(t);
|
|
86
|
-
}, []);
|
|
87
|
-
const I = Math.min(F, Math.max(ne, E != null ? E : ne)), X = Math.min(F, Math.max(I, T != null ? T : F)), N = S(null), P = S(!1), x = (t, e) => {
|
|
88
|
-
let n = I;
|
|
89
|
-
return typeof f == "number" && f >= 0 && e && e > 0 && (n = Math.max(n, Math.min(F, f / e))), Math.min(X, Math.max(n, t));
|
|
90
|
-
}, k = typeof c == "number", [se, $] = b(x(c != null ? c : De));
|
|
91
|
-
w(() => {
|
|
92
|
-
k || $((t) => x(t));
|
|
93
|
-
}, [I, X]);
|
|
94
|
-
const le = (Y = N.current) == null ? void 0 : Y.clientWidth, ce = x(k ? c : se, le), j = D ? 1 : ce, ue = D ? 0 : 1 - j, ae = D ? !1 : L, [, H] = b(0);
|
|
95
|
-
w(() => {
|
|
96
|
-
const t = N.current;
|
|
97
|
-
if (!t)
|
|
98
|
-
return;
|
|
99
|
-
let e = null, n = 0;
|
|
100
|
-
if (typeof ResizeObserver != "undefined")
|
|
101
|
-
e = new ResizeObserver(() => {
|
|
102
|
-
cancelAnimationFrame(n), n = requestAnimationFrame(() => {
|
|
103
|
-
H((s) => s + 1);
|
|
104
|
-
});
|
|
105
|
-
}), e.observe(t);
|
|
106
|
-
else {
|
|
107
|
-
const s = () => H((M) => M + 1);
|
|
108
|
-
return window.addEventListener("resize", s), () => {
|
|
109
|
-
window.removeEventListener("resize", s);
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
return () => {
|
|
113
|
-
e && e.disconnect(), cancelAnimationFrame(n);
|
|
114
|
-
};
|
|
115
|
-
}, []), w(() => {
|
|
116
|
-
var t;
|
|
117
|
-
_((t = i == null ? void 0 : i.labels) != null ? t : []), p(null), v(null), y(null);
|
|
118
|
-
}, [i]), w(() => {
|
|
119
|
-
A && (p(null), v(null));
|
|
120
|
-
}, [A]), w(() => {
|
|
121
|
-
m !== null && y(null);
|
|
122
|
-
}, [m]);
|
|
123
|
-
const q = (t) => {
|
|
124
|
-
const e = N.current;
|
|
125
|
-
if (!e)
|
|
126
|
-
return;
|
|
127
|
-
const n = e.getBoundingClientRect(), s = x((t - n.left) / n.width, n.width);
|
|
128
|
-
U && U(s), k || $(s);
|
|
129
|
-
}, ie = (t) => {
|
|
130
|
-
if (!L)
|
|
131
|
-
return;
|
|
132
|
-
t.preventDefault(), P.current = !0, document.body.style.userSelect = "none", document.body.style.setProperty("-webkit-user-select", "none"), document.body.style.setProperty("-moz-user-select", "none"), document.body.style.setProperty("-ms-user-select", "none"), q(t.clientX);
|
|
133
|
-
const e = (s) => {
|
|
134
|
-
P.current && (s.preventDefault(), q(s.clientX));
|
|
135
|
-
}, n = () => {
|
|
136
|
-
P.current = !1, document.body.style.userSelect = "", document.body.style.setProperty("-webkit-user-select", ""), document.body.style.setProperty("-moz-user-select", ""), document.body.style.setProperty("-ms-user-select", ""), window.removeEventListener("mousemove", e), window.removeEventListener("mouseup", n);
|
|
137
|
-
};
|
|
138
|
-
window.addEventListener("mousemove", e), window.addEventListener("mouseup", n);
|
|
139
|
-
};
|
|
140
|
-
return /* @__PURE__ */ Ee("div", {
|
|
141
|
-
className: "vlm-annotation-wrap",
|
|
142
|
-
ref: N,
|
|
143
|
-
children: [/* @__PURE__ */ g("div", {
|
|
144
|
-
className: "vlm-annotation-left",
|
|
145
|
-
style: {
|
|
146
|
-
flex: `${j} 1 0%`,
|
|
147
|
-
minWidth: typeof f == "number" ? `${f}px` : void 0
|
|
148
|
-
},
|
|
149
|
-
children: /* @__PURE__ */ g(Le, {
|
|
150
|
-
ref: h,
|
|
151
|
-
sample: i,
|
|
152
|
-
labelDefinitions: o,
|
|
153
|
-
labels: d,
|
|
154
|
-
onChange: (t) => {
|
|
155
|
-
if (r) {
|
|
156
|
-
const e = a(u({}, i), {
|
|
157
|
-
labels: t
|
|
158
|
-
});
|
|
159
|
-
r(R === "center" ? V(e) : e);
|
|
160
|
-
}
|
|
161
|
-
_(t);
|
|
162
|
-
},
|
|
163
|
-
onRegionSelect: y,
|
|
164
|
-
onRegionChange: (t, e) => {
|
|
165
|
-
},
|
|
166
|
-
ocrRecognize: re,
|
|
167
|
-
activeLabelValue: m,
|
|
168
|
-
onClearActive: () => {
|
|
169
|
-
p(null), v(null);
|
|
170
|
-
},
|
|
171
|
-
selectedRegion: A,
|
|
172
|
-
onAppendTextToActive: (t) => {
|
|
173
|
-
if (!m || O === null)
|
|
174
|
-
return;
|
|
175
|
-
const e = d[O];
|
|
176
|
-
if (!e)
|
|
177
|
-
return;
|
|
178
|
-
const n = m.label.id, M = (e.content[n] || "") + t, C = [...d], W = a(u({}, e), {
|
|
179
|
-
content: a(u({}, e.content), {
|
|
180
|
-
[n]: M
|
|
181
|
-
})
|
|
182
|
-
});
|
|
183
|
-
C[O] = W, _(C);
|
|
184
|
-
const de = a(u({}, m), {
|
|
185
|
-
region: W
|
|
186
|
-
});
|
|
187
|
-
if (p(de), (o == null ? void 0 : o.find((z) => z.id === n)) && setTimeout(() => {
|
|
188
|
-
}, 0), r) {
|
|
189
|
-
const z = a(u({}, i), {
|
|
190
|
-
labels: C
|
|
191
|
-
});
|
|
192
|
-
r(R === "center" ? V(z) : z);
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
|
-
readOnly: B
|
|
196
|
-
})
|
|
197
|
-
}), ae ? /* @__PURE__ */ g("div", {
|
|
198
|
-
className: "vlm-annotation-resizer",
|
|
199
|
-
role: "separator",
|
|
200
|
-
"aria-orientation": "vertical",
|
|
201
|
-
onMouseDown: ie
|
|
202
|
-
}) : null, !D && /* @__PURE__ */ g("div", {
|
|
203
|
-
className: "vlm-annotation-right",
|
|
204
|
-
style: {
|
|
205
|
-
flex: `${ue} 1 0%`
|
|
206
|
-
},
|
|
207
|
-
children: /* @__PURE__ */ g(ye, {
|
|
208
|
-
labelDefinitions: o,
|
|
209
|
-
labels: d,
|
|
210
|
-
selectedRegion: A,
|
|
211
|
-
activeLabelValue: m,
|
|
212
|
-
activeRegionNumber: O,
|
|
213
|
-
readOnly: B,
|
|
214
|
-
onRegionClick: (t) => {
|
|
215
|
-
y(t);
|
|
216
|
-
},
|
|
217
|
-
onOCR: (t) => {
|
|
218
|
-
var n;
|
|
219
|
-
const e = d.find((s) => s.id === t);
|
|
220
|
-
e && y(e), (n = h.current) == null || n.performOCRById(t);
|
|
221
|
-
},
|
|
222
|
-
ocrRecognizing: (J = (G = h.current) == null ? void 0 : G.ocrRecognizingRef) == null ? void 0 : J.current,
|
|
223
|
-
ocrErrors: (Z = (Q = h.current) == null ? void 0 : Q.ocrErrorRef) == null ? void 0 : Z.current,
|
|
224
|
-
onDelete: (t) => {
|
|
225
|
-
const e = d.find((n) => n.id === t);
|
|
226
|
-
e && y(e), Ae.confirm({
|
|
227
|
-
title: Me,
|
|
228
|
-
content: we,
|
|
229
|
-
okText: _e,
|
|
230
|
-
cancelText: he,
|
|
231
|
-
onOk: () => {
|
|
232
|
-
const n = d.filter((s) => s.id !== t);
|
|
233
|
-
if (_(n), (A == null ? void 0 : A.id) === t && y(null), (m == null ? void 0 : m.region.id) === t && (p(null), v(null)), r) {
|
|
234
|
-
const s = a(u({}, i), {
|
|
235
|
-
labels: n
|
|
236
|
-
});
|
|
237
|
-
r(R === "center" ? V(s) : s);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
});
|
|
241
|
-
},
|
|
242
|
-
onInputActive: (t, e) => {
|
|
243
|
-
if (e !== void 0 && d[e]) {
|
|
244
|
-
const n = d[e], s = {
|
|
245
|
-
label: t.label,
|
|
246
|
-
// 使用传入的 label,确保 label 字段被更新
|
|
247
|
-
region: u({}, n)
|
|
248
|
-
};
|
|
249
|
-
p(s), v(e);
|
|
250
|
-
} else
|
|
251
|
-
p(t), e !== void 0 && v(e);
|
|
252
|
-
},
|
|
253
|
-
onChange: (t, e) => {
|
|
254
|
-
if (t !== null && e !== void 0) {
|
|
255
|
-
const n = [...d];
|
|
256
|
-
n[e] = t.region, _(n);
|
|
257
|
-
const s = {
|
|
258
|
-
label: t.label,
|
|
259
|
-
// 确保使用传入的 label
|
|
260
|
-
region: n[e]
|
|
261
|
-
// 使用更新后的 region
|
|
262
|
-
};
|
|
263
|
-
if (p(s), v(e), r) {
|
|
264
|
-
const M = a(u({}, i), {
|
|
265
|
-
labels: n
|
|
266
|
-
});
|
|
267
|
-
r(R === "center" ? V(M) : M);
|
|
268
|
-
}
|
|
269
|
-
} else
|
|
270
|
-
p(null), v(null);
|
|
271
|
-
}
|
|
272
|
-
})
|
|
273
|
-
})]
|
|
274
|
-
});
|
|
275
|
-
};
|
|
276
|
-
export {
|
|
277
|
-
V as convertTopLeftToCenter,
|
|
278
|
-
Be as default
|
|
279
|
-
};
|