@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.
- package/dist/es/DatasetContext/index.mjs +6 -3
- package/dist/es/components/DetectionAnnotation/components/ImageDetail/index.mjs +94 -91
- package/dist/es/components/DetectionAnnotation/components/ImageModal/index.mjs +129 -0
- package/dist/es/components/DetectionAnnotation/components/ImageModal/style.less.mjs +4 -0
- package/dist/es/components/DetectionAnnotation/components/LabelMaker/Drawable.mjs +37 -28
- package/dist/es/components/DetectionAnnotation/components/LabelMaker/RectLabel.mjs +136 -108
- package/dist/es/components/DetectionAnnotation/components/LabelMaker/index.mjs +197 -162
- package/dist/es/components/DetectionAnnotation/index.mjs +424 -395
- 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 +43 -45
- package/dist/es/components/PicZipImportModal/config.mjs +47 -0
- package/dist/es/components/PicZipImportModal/index.mjs +308 -293
- package/dist/es/components/PicZipImportModal/pic_vlm_json_zip.svg.mjs +4 -0
- package/dist/es/components/PicZipImportModal/pic_vlm_zip.svg.mjs +4 -0
- package/dist/es/components/PreLabelOCR/index.mjs +1 -1
- package/dist/es/components/VLMAnnotation/RegionItem.mjs +94 -0
- package/dist/es/components/VLMAnnotation/TextAnnotationPanel.mjs +83 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasDrag.mjs +116 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasSetup.mjs +115 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasZoom.mjs +42 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCropRegionImage.mjs +55 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteControl.mjs +51 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.mjs +47 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.mjs +248 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRLoadingIcon.mjs +106 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.mjs +68 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionHover.mjs +38 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.mjs +141 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionNameText.mjs +72 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.mjs +113 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionUpdate.mjs +103 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useTextLayouts.mjs +156 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/del.png.mjs +4 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/index.mjs +526 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/style.less.mjs +4 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/utils/coordinateUtils.mjs +33 -0
- package/dist/es/components/VLMAnnotation/components/DragButton.mjs +18 -0
- package/dist/es/components/VLMAnnotation/components/FitToScreenButton.mjs +16 -0
- package/dist/es/components/VLMAnnotation/components/RectangleButton.mjs +30 -0
- package/dist/es/components/VLMAnnotation/components/Toolbar.mjs +40 -0
- package/dist/es/components/VLMAnnotation/components/ZoomControls.mjs +44 -0
- package/dist/es/components/VLMAnnotation/constants.mjs +50 -0
- package/dist/es/components/VLMAnnotation/index.mjs +242 -0
- package/dist/es/components/VLMAnnotation/style.less.mjs +4 -0
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/index.mjs +343 -0
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/style.less.mjs +4 -0
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.mjs +240 -0
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.mjs +201 -0
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/style.less.mjs +4 -0
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/index.mjs +455 -0
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/style.less.mjs +4 -0
- package/dist/es/components/VLMAnnotationDetail/VlmModal/index.mjs +149 -0
- package/dist/es/components/VLMAnnotationDetail/VlmModal/style.less.mjs +4 -0
- package/dist/es/components/VLMAnnotationDetail/index.mjs +449 -0
- package/dist/es/components/VLMAnnotationDetail/style.less.mjs +4 -0
- package/dist/es/constant.mjs +3 -3
- package/dist/es/createVlmtasetAnnotation/index.mjs +131 -0
- package/dist/es/featuresConfig.mjs +13 -9
- package/dist/es/index.mjs +11 -7
- package/dist/lib/index.js +4 -3
- package/dist/src/DatasetContext/index.d.ts +2 -0
- package/dist/src/components/DetectionAnnotation/components/ImageDetail/index.d.ts +1 -0
- package/dist/src/components/DetectionAnnotation/components/ImageModal/index.d.ts +34 -0
- package/dist/src/components/Iconfont/font_4439177_tgvowh6bmlb.d.ts +0 -0
- package/dist/src/components/PicZipImportModal/config.d.ts +23 -0
- package/dist/src/components/VLMAnnotation/ImageAnnotationDebugger.d.ts +4 -0
- package/dist/src/components/VLMAnnotation/RegionItem.d.ts +4 -0
- package/dist/src/components/VLMAnnotation/TextAnnotationPanel.d.ts +4 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasDrag.d.ts +13 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasSetup.d.ts +38 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasZoom.d.ts +18 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCropRegionImage.d.ts +7 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteControl.d.ts +13 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.d.ts +21 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.d.ts +32 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRLoadingIcon.d.ts +11 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.d.ts +28 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionHover.d.ts +13 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.d.ts +37 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionNameText.d.ts +12 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.d.ts +15 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionUpdate.d.ts +32 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useTextLayouts.d.ts +25 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/index.d.ts +4 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/utils/coordinateUtils.d.ts +32 -0
- package/dist/src/components/VLMAnnotation/components/DragButton.d.ts +7 -0
- package/dist/src/components/VLMAnnotation/components/FitToScreenButton.d.ts +6 -0
- package/dist/src/components/VLMAnnotation/components/RectangleButton.d.ts +7 -0
- package/dist/src/components/VLMAnnotation/components/Toolbar.d.ts +4 -0
- package/dist/src/components/VLMAnnotation/components/ZoomControls.d.ts +4 -0
- package/dist/src/components/VLMAnnotation/constants.d.ts +97 -0
- package/dist/src/components/VLMAnnotation/index.d.ts +6 -0
- package/dist/src/components/VLMAnnotation/types.d.ts +172 -0
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/index.d.ts +14 -0
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.d.ts +12 -0
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.d.ts +12 -0
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/index.d.ts +12 -0
- package/dist/src/components/VLMAnnotationDetail/VlmModal/index.d.ts +17 -0
- package/dist/src/components/VLMAnnotationDetail/index.d.ts +6 -0
- package/dist/src/constant.d.ts +1 -1
- package/dist/src/createVlmtasetAnnotation/index.d.ts +16 -0
- package/dist/src/featuresConfig.d.ts +4 -0
- package/dist/src/index.d.ts +3 -0
- package/package.json +2 -2
- package/dist/dataset-annotation.js +0 -123598
- package/dist/dataset-annotation.umd.cjs +0 -1017
- package/dist/example/DatasetAnnotationDemo.d.ts +0 -3
- package/dist/example/DemoTabs.d.ts +0 -3
- package/dist/example/DetectionDatasetDemo.d.ts +0 -5
- package/dist/example/DetectionImageDemo.d.ts +0 -5
- package/dist/example/OcrDatasetDemo.d.ts +0 -5
- package/dist/example/OcrImageDemo.d.ts +0 -5
- package/dist/example/OcrkvcDatasetDemo.d.ts +0 -5
- package/dist/example/constant.local.d.ts +0 -6
- package/dist/example/index.d.ts +0 -1
- package/dist/src/utils/reactCompatibility.d.ts +0 -5
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const A = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAMP0lEQVR4Aeyd7XmrOBCFJf7n3ibSxya92HUkt451L8n24SY2+b9aDgoBbGLASIKZOTyRwVhIM+/M4UPEuHKcSIAEfiRAgfyIhh+QgHMUCLOABG4QoEBuwOFHJECBMAdI4AaBjAK50Ss/IgEhBCgQIYGimdsQoEC24c5ehRCgQIQEimZuQ4AC2YY7exVCQKZAhMClmfIJUCDyY0gPMh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GpDrVohmWlD+Mk6ct2N0W19zrmCcMJAmKxaMH/DYnEDhtNdjw/Z6ydIdyTx973cakQBCMwGfaAsNkgTgs71DMCiSeavnnyQwxXMG6OBB6swKB8xQJKIwXiiNyMS0QIIBIDudfHgmB97srxQ3yzU8qWD6t6iM3L5AWBhKiE4qfvFfSbqdljh0E/D/wJxUGIaVABjicO55/vx7qJEGyIGlQnNMmGPgTjxQYrICvx9pvx+mKAAVyhaRbgaRBOXwJBomEgqSSVmB3Vx6e4dPx/JD1d0Y6knKXKJA7YtcmlqT5HW5yk5oABVJDsPpHv6cJUCDTjFjDMAEKxHDw6fo0AQpkmhFrGCZAgRgOPl2fJkCBTDNijeUE1GxBgagJJR3JQYACyUGVbaohQIGoCSUdyUGAAslBlW2qIUCBqAmlFUfK+kmBlOXN3oQRoECEBYzmliVAgZTlzd6EEaBAhAWM5pYlQIGU5c3e9kxgxDYKZAQKV5FAS4ACaUlwTgIjBCiQEShcRQItAQqkJcE5CYwQoEBGoHAVCbQEUgmkbY9zElBFgAJRFU46k5oABZKaKNtTRYACURVOOpOaAAWSmijbU0VAgEBU8aYzwghQIMICRnPLEqBAyvJmb8IIUCDCAkZzyxKgQMryZm/CCNgWiLBg0dzyBCiQ8szZoyACFIigYNHU8gQokPLM2aMgAhSIoGDR1PIEKJBMzNmsDgL/AwAA//9+aQWHAAAABklEQVQDALfICvoO/Ck9AAAAAElFTkSuQmCC";
|
|
2
|
+
export {
|
|
3
|
+
A as default
|
|
4
|
+
};
|
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
var Pe = Object.defineProperty, Ue = Object.defineProperties;
|
|
2
|
+
var Xe = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var le = Object.getOwnPropertySymbols;
|
|
4
|
+
var Fe = Object.prototype.hasOwnProperty, We = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var ge = (s, l, u) => l in s ? Pe(s, l, { enumerable: !0, configurable: !0, writable: !0, value: u }) : s[l] = u, q = (s, l) => {
|
|
6
|
+
for (var u in l || (l = {}))
|
|
7
|
+
Fe.call(l, u) && ge(s, u, l[u]);
|
|
8
|
+
if (le)
|
|
9
|
+
for (var u of le(l))
|
|
10
|
+
We.call(l, u) && ge(s, u, l[u]);
|
|
11
|
+
return s;
|
|
12
|
+
}, he = (s, l) => Ue(s, Xe(l));
|
|
13
|
+
import { jsxs as Re, jsx as S } from "react/jsx-runtime";
|
|
14
|
+
import { useRef as R, useState as A, useCallback as P, useEffect as h } from "react";
|
|
15
|
+
import { fabric as U } from "fabric";
|
|
16
|
+
import { useKeyPress as X } from "ahooks";
|
|
17
|
+
import Oe from "classnames";
|
|
18
|
+
import "./style.less.mjs";
|
|
19
|
+
import ye from "../components/Toolbar.mjs";
|
|
20
|
+
import { useOCRLoadingIcon as be } from "./hooks/useOCRLoadingIcon.mjs";
|
|
21
|
+
import { useRegionNameText as Ye } from "./hooks/useRegionNameText.mjs";
|
|
22
|
+
import { useCropRegionImage as je } from "./hooks/useCropRegionImage.mjs";
|
|
23
|
+
import { useDrawingMode as ze } from "./hooks/useDrawingMode.mjs";
|
|
24
|
+
import { useRegionLoader as He } from "./hooks/useRegionLoader.mjs";
|
|
25
|
+
import { useCanvasSetup as Ze } from "./hooks/useCanvasSetup.mjs";
|
|
26
|
+
import { useTextLayouts as Ke } from "./hooks/useTextLayouts.mjs";
|
|
27
|
+
import { useRegionUpdate as $e } from "./hooks/useRegionUpdate.mjs";
|
|
28
|
+
import { useCanvasDrag as Be } from "./hooks/useCanvasDrag.mjs";
|
|
29
|
+
import { useRegionSelection as Ge } from "./hooks/useRegionSelection.mjs";
|
|
30
|
+
import { useOCRRecognition as qe } from "./hooks/useOCRRecognition.mjs";
|
|
31
|
+
import { useDeleteRegion as Je } from "./hooks/useDeleteRegion.mjs";
|
|
32
|
+
import { useDeleteControl as Qe } from "./hooks/useDeleteControl.mjs";
|
|
33
|
+
import { useCanvasZoom as Ve } from "./hooks/useCanvasZoom.mjs";
|
|
34
|
+
import { useRegionHover as et } from "./hooks/useRegionHover.mjs";
|
|
35
|
+
import { canvasToImageCoords as tt, imageToCanvasCoords as ot } from "./utils/coordinateUtils.mjs";
|
|
36
|
+
import { REGION_NAME_PREFIX as rt, DEFAULT_REGION_NAME as nt, ZOOM_PRECISION_ERROR as st, TEXT_LAYOUT_RECT_FILL_COLOR as it, TEXT_LAYOUT_RECT_STROKE_COLOR as ct, TRANSPARENT_FILL as at, BASE_STROKE_WIDTH as ft } from "../constants.mjs";
|
|
37
|
+
const Wt = ({
|
|
38
|
+
sample: s,
|
|
39
|
+
labelDefinitions: l,
|
|
40
|
+
labels: u,
|
|
41
|
+
onImageLoad: pe,
|
|
42
|
+
onChange: x,
|
|
43
|
+
onRegionSelect: J,
|
|
44
|
+
onRegionChange: H,
|
|
45
|
+
ocrRecognize: Te,
|
|
46
|
+
activeLabelValue: g,
|
|
47
|
+
onClearActive: Z,
|
|
48
|
+
selectedRegion: Q,
|
|
49
|
+
onAppendTextToActive: Ee,
|
|
50
|
+
readOnly: c
|
|
51
|
+
}) => {
|
|
52
|
+
var ue, me;
|
|
53
|
+
const V = R(null), T = R(null), [ve, Ce] = A(!0), [t, Ne] = A(), [D, Ie] = A(), [p, ee] = A(1), [E, _] = A(c || !1), [v, I] = A(!1), [K, Ae] = A({
|
|
54
|
+
left: 0,
|
|
55
|
+
top: 0
|
|
56
|
+
}), F = R({
|
|
57
|
+
left: 0,
|
|
58
|
+
top: 0
|
|
59
|
+
}), xe = R({
|
|
60
|
+
width: 0,
|
|
61
|
+
height: 0
|
|
62
|
+
}), a = R(/* @__PURE__ */ new Map()), te = R(null), oe = R(void 0), re = R(!1), ne = R(!1), W = R({
|
|
63
|
+
width: 0,
|
|
64
|
+
height: 0
|
|
65
|
+
}), se = R(!1), {
|
|
66
|
+
updateOCRLoadingIcon: ke,
|
|
67
|
+
ocrLoadingIconMapRef: k
|
|
68
|
+
} = be(t), {
|
|
69
|
+
updateRegionNameText: O,
|
|
70
|
+
regionNameTextMapRef: C
|
|
71
|
+
} = Ye(t), ie = je(s == null ? void 0 : s.fileUrl), we = P((o) => {
|
|
72
|
+
t && (C.current.forEach((e, r) => {
|
|
73
|
+
const n = r.left || 0, i = r.top || 0;
|
|
74
|
+
e.set({
|
|
75
|
+
left: n,
|
|
76
|
+
// 与标注框左边对齐
|
|
77
|
+
top: i,
|
|
78
|
+
// 下边缘与标注框上边缘对齐(因为 originY 是 'bottom')
|
|
79
|
+
scaleX: 1 / o,
|
|
80
|
+
// 反向缩放,抵消画布缩放
|
|
81
|
+
scaleY: 1 / o
|
|
82
|
+
// 反向缩放,抵消画布缩放
|
|
83
|
+
});
|
|
84
|
+
}), t.renderAll());
|
|
85
|
+
}, [t]), {
|
|
86
|
+
updateCanvas: L
|
|
87
|
+
} = Ze({
|
|
88
|
+
sample: s,
|
|
89
|
+
image: D,
|
|
90
|
+
onImageLoad: pe,
|
|
91
|
+
canvasRef: V,
|
|
92
|
+
containerRef: T,
|
|
93
|
+
canvasInitializedRef: re,
|
|
94
|
+
bgImagePositionRef: F,
|
|
95
|
+
bgImageSizeRef: xe,
|
|
96
|
+
rectMapRef: a,
|
|
97
|
+
updateTextLayersRef: te,
|
|
98
|
+
onRectPositionUpdated: we,
|
|
99
|
+
setCanvas: Ne,
|
|
100
|
+
setImage: Ie,
|
|
101
|
+
setScale: ee,
|
|
102
|
+
setBgImagePosition: Ae,
|
|
103
|
+
setLoading: Ce
|
|
104
|
+
}), Me = P(() => {
|
|
105
|
+
const o = Array.from(a.current.values());
|
|
106
|
+
o.forEach((e, r) => {
|
|
107
|
+
e.name = `${rt}${r + 1}`;
|
|
108
|
+
}), a.current.forEach((e, r) => {
|
|
109
|
+
const n = C.current.get(r);
|
|
110
|
+
n && (n.set("text", e.name || nt), t == null || t.renderAll());
|
|
111
|
+
}), x && x(o);
|
|
112
|
+
}, [x, t]), {
|
|
113
|
+
zoom: Se
|
|
114
|
+
} = Ve({
|
|
115
|
+
canvas: t,
|
|
116
|
+
setScale: ee,
|
|
117
|
+
isZoomingRef: se
|
|
118
|
+
}), y = P(
|
|
119
|
+
(o, e) => tt(o, e, t, D, F),
|
|
120
|
+
[t, D, K]
|
|
121
|
+
// 添加 bgImagePosition 作为依赖,确保在图片位置更新后函数能正确工作
|
|
122
|
+
), $ = P(
|
|
123
|
+
(o, e) => ot(o, e, t, F),
|
|
124
|
+
[t, K]
|
|
125
|
+
// 添加 bgImagePosition 作为依赖,确保在图片位置更新后函数能正确工作
|
|
126
|
+
), {
|
|
127
|
+
updateTextLayers: b,
|
|
128
|
+
textLayersMapRef: m,
|
|
129
|
+
textLayoutContentMapRef: Y
|
|
130
|
+
} = Ke({
|
|
131
|
+
canvas: t,
|
|
132
|
+
imageToCanvasCoords: $,
|
|
133
|
+
activeLabelValue: g,
|
|
134
|
+
onAppendTextToActive: Ee
|
|
135
|
+
});
|
|
136
|
+
te.current = b;
|
|
137
|
+
const {
|
|
138
|
+
performOCRIfNeeded: ce,
|
|
139
|
+
ocrRecognizingRef: ut
|
|
140
|
+
} = qe({
|
|
141
|
+
ocrRecognize: Te,
|
|
142
|
+
onChange: x,
|
|
143
|
+
updateTextLayers: b,
|
|
144
|
+
canvas: t,
|
|
145
|
+
updateOCRLoadingIcon: ke,
|
|
146
|
+
rectMapRef: a,
|
|
147
|
+
textLayersMapRef: m,
|
|
148
|
+
textLayoutContentMapRef: Y
|
|
149
|
+
}), {
|
|
150
|
+
updateRegionShapeAndImage: ae
|
|
151
|
+
} = $e({
|
|
152
|
+
canvas: t,
|
|
153
|
+
image: D,
|
|
154
|
+
draggable: E,
|
|
155
|
+
canvasToImageCoords: y,
|
|
156
|
+
imageToCanvasCoords: $,
|
|
157
|
+
cropRegionImage: ie,
|
|
158
|
+
onChange: x,
|
|
159
|
+
onRegionChange: H,
|
|
160
|
+
performOCRIfNeeded: ce,
|
|
161
|
+
updateTextLayers: b,
|
|
162
|
+
rectMapRef: a,
|
|
163
|
+
regionNameTextMapRef: C,
|
|
164
|
+
ocrLoadingIconMapRef: k
|
|
165
|
+
});
|
|
166
|
+
h(() => {
|
|
167
|
+
L();
|
|
168
|
+
}, [L]), h(() => {
|
|
169
|
+
t && (m.current.forEach((o) => {
|
|
170
|
+
o.forEach((e) => {
|
|
171
|
+
e.off("mousedown"), e.off("mouseover"), e.off("mouseout"), t.remove(e), Y.current.delete(e);
|
|
172
|
+
});
|
|
173
|
+
}), m.current.clear(), C.current.forEach((o) => {
|
|
174
|
+
t.remove(o);
|
|
175
|
+
}), C.current.clear(), k.current.forEach((o) => {
|
|
176
|
+
t.remove(o);
|
|
177
|
+
}), k.current.clear(), a.current.forEach((o, e) => {
|
|
178
|
+
e.off("modified"), e.off("moved"), t.remove(e);
|
|
179
|
+
}), a.current.clear(), ne.current = !1, oe.current = void 0, t.renderAll());
|
|
180
|
+
}, [t, s == null ? void 0 : s.id]), h(() => {
|
|
181
|
+
if (!T.current)
|
|
182
|
+
return;
|
|
183
|
+
W.current = {
|
|
184
|
+
width: T.current.offsetWidth,
|
|
185
|
+
height: T.current.offsetHeight
|
|
186
|
+
};
|
|
187
|
+
const o = new ResizeObserver(() => {
|
|
188
|
+
if (!T.current || se.current)
|
|
189
|
+
return;
|
|
190
|
+
if (t) {
|
|
191
|
+
const d = t.getZoom();
|
|
192
|
+
if (Math.abs(d - p) > st)
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
const e = T.current.offsetWidth, r = T.current.offsetHeight, n = W.current.width, i = W.current.height;
|
|
196
|
+
(e !== n || r !== i) && (W.current = {
|
|
197
|
+
width: e,
|
|
198
|
+
height: r
|
|
199
|
+
}, L());
|
|
200
|
+
});
|
|
201
|
+
return o.observe(T.current), () => {
|
|
202
|
+
o.disconnect();
|
|
203
|
+
};
|
|
204
|
+
}, [L, t, p]), X("ctrl", () => {
|
|
205
|
+
c || (v && (I(!1), w()), _(!0));
|
|
206
|
+
}, {
|
|
207
|
+
events: ["keydown"]
|
|
208
|
+
}), X("ctrl", () => {
|
|
209
|
+
c || _(!1);
|
|
210
|
+
}, {
|
|
211
|
+
events: ["keyup"]
|
|
212
|
+
}), h(() => {
|
|
213
|
+
if (!t)
|
|
214
|
+
return;
|
|
215
|
+
const o = ft / p, e = /* @__PURE__ */ new Set();
|
|
216
|
+
m.current.forEach((r) => {
|
|
217
|
+
r.forEach((n) => {
|
|
218
|
+
e.add(n);
|
|
219
|
+
});
|
|
220
|
+
}), t.getObjects().forEach((r) => {
|
|
221
|
+
r instanceof U.Rect && !e.has(r) && r.set({
|
|
222
|
+
strokeWidth: o,
|
|
223
|
+
strokeUniform: !0,
|
|
224
|
+
objectCaching: !1,
|
|
225
|
+
// 禁用缓存,避免缩放时边框变虚
|
|
226
|
+
statefullCache: !1,
|
|
227
|
+
noScaleCache: !1
|
|
228
|
+
});
|
|
229
|
+
}), m.current.forEach((r) => {
|
|
230
|
+
r.forEach((n) => {
|
|
231
|
+
n.set({
|
|
232
|
+
fill: it,
|
|
233
|
+
// 确保填充色被保留
|
|
234
|
+
stroke: ct,
|
|
235
|
+
// 确保边框色被保留
|
|
236
|
+
strokeWidth: o,
|
|
237
|
+
// 根据缩放调整边框宽度,保持视觉一致
|
|
238
|
+
strokeUniform: !0,
|
|
239
|
+
// 确保边框宽度随缩放调整
|
|
240
|
+
objectCaching: !1,
|
|
241
|
+
statefullCache: !1,
|
|
242
|
+
noScaleCache: !1
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
}), C.current.forEach((r, n) => {
|
|
246
|
+
const i = n.left || 0, d = n.top || 0;
|
|
247
|
+
r.set({
|
|
248
|
+
left: i,
|
|
249
|
+
// 与标注框左边对齐
|
|
250
|
+
top: d,
|
|
251
|
+
// 下边缘与标注框上边缘对齐(因为 originY 是 'bottom')
|
|
252
|
+
scaleX: 1 / p,
|
|
253
|
+
// 反向缩放,抵消画布缩放
|
|
254
|
+
scaleY: 1 / p
|
|
255
|
+
// 反向缩放,抵消画布缩放
|
|
256
|
+
});
|
|
257
|
+
const f = k.current.get(n);
|
|
258
|
+
if (f) {
|
|
259
|
+
const N = n.getScaledWidth();
|
|
260
|
+
n.getScaledHeight(), f.set({
|
|
261
|
+
left: i,
|
|
262
|
+
// top 位置由动画控制,这里不更新
|
|
263
|
+
scaleX: 1 / p,
|
|
264
|
+
// 反向缩放,抵消画布缩放,保持固定视觉粗细
|
|
265
|
+
scaleY: 1 / p
|
|
266
|
+
// 反向缩放,抵消画布缩放,保持固定视觉粗细
|
|
267
|
+
});
|
|
268
|
+
const M = f.getObjects();
|
|
269
|
+
if (M && M.length > 0) {
|
|
270
|
+
const j = N * p;
|
|
271
|
+
M.forEach((z) => {
|
|
272
|
+
z instanceof U.Rect && z.set("width", j);
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}), t.renderAll();
|
|
277
|
+
}, [t, p]), Be({
|
|
278
|
+
canvas: t,
|
|
279
|
+
draggable: E,
|
|
280
|
+
drawingMode: v,
|
|
281
|
+
textLayersMapRef: m
|
|
282
|
+
});
|
|
283
|
+
const {
|
|
284
|
+
performDelete: B
|
|
285
|
+
} = Je({
|
|
286
|
+
canvas: t,
|
|
287
|
+
onRegionChange: H,
|
|
288
|
+
updateRegionNames: Me,
|
|
289
|
+
rectMapRef: a,
|
|
290
|
+
textLayersMapRef: m,
|
|
291
|
+
textLayoutContentMapRef: Y,
|
|
292
|
+
regionNameTextMapRef: C,
|
|
293
|
+
ocrLoadingIconMapRef: k
|
|
294
|
+
}), {
|
|
295
|
+
createDeleteControl: G
|
|
296
|
+
} = Qe({
|
|
297
|
+
performDelete: B
|
|
298
|
+
});
|
|
299
|
+
Ge({
|
|
300
|
+
canvas: t,
|
|
301
|
+
onRegionSelect: J,
|
|
302
|
+
createDeleteControl: G,
|
|
303
|
+
textLayersMapRef: m,
|
|
304
|
+
rectMapRef: a
|
|
305
|
+
});
|
|
306
|
+
const {
|
|
307
|
+
stopDraw: w
|
|
308
|
+
} = ze({
|
|
309
|
+
canvas: t,
|
|
310
|
+
drawingMode: v,
|
|
311
|
+
draggable: E,
|
|
312
|
+
setDrawingMode: I,
|
|
313
|
+
canvasToImageCoords: y,
|
|
314
|
+
labelDefinitions: l,
|
|
315
|
+
onChange: x,
|
|
316
|
+
cropRegionImage: ie,
|
|
317
|
+
updateRegionShapeAndImage: ae,
|
|
318
|
+
performOCRIfNeeded: ce,
|
|
319
|
+
createDeleteControl: G,
|
|
320
|
+
updateRegionNameText: O,
|
|
321
|
+
onRegionChange: H,
|
|
322
|
+
onRegionSelect: J,
|
|
323
|
+
rectMapRef: a,
|
|
324
|
+
textLayersMapRef: m
|
|
325
|
+
});
|
|
326
|
+
h(() => {
|
|
327
|
+
g && (I(!1), w());
|
|
328
|
+
}, [g, w]), h(() => {
|
|
329
|
+
c && (_(!0), I(!1), w());
|
|
330
|
+
}, [c, w]), h(() => {
|
|
331
|
+
if (!t)
|
|
332
|
+
return;
|
|
333
|
+
const o = () => {
|
|
334
|
+
t.getObjects().forEach((e) => {
|
|
335
|
+
e instanceof U.Rect && e.selectable && (e.set({
|
|
336
|
+
lockMovementX: c,
|
|
337
|
+
lockMovementY: c,
|
|
338
|
+
lockScalingX: c,
|
|
339
|
+
lockScalingY: c,
|
|
340
|
+
hasControls: !c
|
|
341
|
+
// 在只读模式下,如果有 activeLabelValue,我们可能希望它保持选中状态
|
|
342
|
+
// 但不允许用户通过点击来取消选中或选中其他(这个由 canvas.selection 控制)
|
|
343
|
+
}), c && e.controls);
|
|
344
|
+
}), t.requestRenderAll();
|
|
345
|
+
};
|
|
346
|
+
return o(), t.on("object:added", o), () => {
|
|
347
|
+
t.off("object:added", o);
|
|
348
|
+
};
|
|
349
|
+
}, [t, c]), He({
|
|
350
|
+
canvas: t,
|
|
351
|
+
sample: s,
|
|
352
|
+
image: D,
|
|
353
|
+
bgImagePosition: K,
|
|
354
|
+
canvasInitializedRef: re,
|
|
355
|
+
bgImagePositionRef: F,
|
|
356
|
+
sampleRef: oe,
|
|
357
|
+
labelsLoadedRef: ne,
|
|
358
|
+
rectMapRef: a,
|
|
359
|
+
textLayersMapRef: m,
|
|
360
|
+
textLayoutContentMapRef: Y,
|
|
361
|
+
regionNameTextMapRef: C,
|
|
362
|
+
ocrLoadingIconMapRef: k,
|
|
363
|
+
imageToCanvasCoords: $,
|
|
364
|
+
updateRegionShapeAndImage: ae,
|
|
365
|
+
createDeleteControl: G,
|
|
366
|
+
updateRegionNameText: O,
|
|
367
|
+
updateTextLayers: b
|
|
368
|
+
}), h(() => {
|
|
369
|
+
if (!u || u.length === 0)
|
|
370
|
+
return;
|
|
371
|
+
let o = !1;
|
|
372
|
+
a.current.forEach((e, r) => {
|
|
373
|
+
var d, f;
|
|
374
|
+
const n = u.find((N) => N.id === e.id);
|
|
375
|
+
if (!n)
|
|
376
|
+
return;
|
|
377
|
+
const i = he(q(q({}, e), n), {
|
|
378
|
+
// Keep shape from canvas to avoid desync
|
|
379
|
+
shape: e.shape,
|
|
380
|
+
image: (d = n.image) != null ? d : e.image,
|
|
381
|
+
textLayouts: (f = n.textLayouts) != null ? f : e.textLayouts
|
|
382
|
+
});
|
|
383
|
+
(i.name !== e.name || i.content !== e.content || i.image !== e.image || i.textLayouts !== e.textLayouts) && (a.current.set(r, i), i.name !== e.name && O(r, i), o = !0);
|
|
384
|
+
}), o && (t == null || t.renderAll());
|
|
385
|
+
}, [u, t, O]), et({
|
|
386
|
+
canvas: t,
|
|
387
|
+
drawingMode: v,
|
|
388
|
+
draggable: E,
|
|
389
|
+
textLayersMapRef: m
|
|
390
|
+
}), h(() => {
|
|
391
|
+
if (t && Q === null) {
|
|
392
|
+
const o = /* @__PURE__ */ new Set();
|
|
393
|
+
m.current.forEach((r) => {
|
|
394
|
+
r.forEach((n) => {
|
|
395
|
+
o.add(n);
|
|
396
|
+
});
|
|
397
|
+
}), t.getObjects().forEach((r) => {
|
|
398
|
+
r instanceof U.Rect && !o.has(r) && r.set({
|
|
399
|
+
fill: at
|
|
400
|
+
// 移除填充色
|
|
401
|
+
});
|
|
402
|
+
}), t.getActiveObject() && (t.discardActiveObject(), t.renderAll());
|
|
403
|
+
}
|
|
404
|
+
}, [t, Q]), h(() => {
|
|
405
|
+
var r;
|
|
406
|
+
if (!t)
|
|
407
|
+
return;
|
|
408
|
+
const o = (r = g == null ? void 0 : g.region) == null ? void 0 : r.id;
|
|
409
|
+
let e = !1;
|
|
410
|
+
m.current.forEach((n, i) => {
|
|
411
|
+
const d = a.current.get(i);
|
|
412
|
+
if (d && n.length > 0) {
|
|
413
|
+
const f = o === d.id;
|
|
414
|
+
n.forEach((N) => {
|
|
415
|
+
N.visible !== f && (N.set({
|
|
416
|
+
visible: f
|
|
417
|
+
}), e = !0);
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
}), e && t.renderAll();
|
|
421
|
+
}, [t, g]), h(() => {
|
|
422
|
+
var n, i;
|
|
423
|
+
if (!t)
|
|
424
|
+
return;
|
|
425
|
+
const o = (n = g == null ? void 0 : g.region) == null ? void 0 : n.id;
|
|
426
|
+
if (!o)
|
|
427
|
+
return;
|
|
428
|
+
let e = null;
|
|
429
|
+
if (a.current.forEach((d, f) => {
|
|
430
|
+
d.id === o && (e = f);
|
|
431
|
+
}), !e)
|
|
432
|
+
return;
|
|
433
|
+
e.bringToFront(), ((i = m.current.get(e)) != null ? i : []).forEach((d) => {
|
|
434
|
+
d.bringToFront();
|
|
435
|
+
}), t.renderAll();
|
|
436
|
+
}, [t, g, a, m]), h(() => {
|
|
437
|
+
if (!t || !g || !Z)
|
|
438
|
+
return;
|
|
439
|
+
const o = (e) => {
|
|
440
|
+
var de;
|
|
441
|
+
const r = (de = e.e) == null ? void 0 : de.target;
|
|
442
|
+
if ((r == null ? void 0 : r.tagName) === "INPUT" || (r == null ? void 0 : r.tagName) === "TEXTAREA")
|
|
443
|
+
return;
|
|
444
|
+
const n = t.getPointer(e.e), i = n.x, d = n.y, f = y(i, d), N = g.region, {
|
|
445
|
+
x: M,
|
|
446
|
+
y: j,
|
|
447
|
+
width: z,
|
|
448
|
+
height: Le
|
|
449
|
+
} = N.shape;
|
|
450
|
+
f.x >= M && f.x <= M + z && f.y >= j && f.y <= j + Le || Z();
|
|
451
|
+
};
|
|
452
|
+
return t.on("mouse:down", o), () => {
|
|
453
|
+
t.off("mouse:down", o);
|
|
454
|
+
};
|
|
455
|
+
}, [t, g, Z, y]);
|
|
456
|
+
const fe = P((o) => {
|
|
457
|
+
const e = o.target;
|
|
458
|
+
if ((e == null ? void 0 : e.tagName) === "INPUT" || (e == null ? void 0 : e.tagName) === "TEXTAREA" || !t || c)
|
|
459
|
+
return;
|
|
460
|
+
const r = t.getActiveObject();
|
|
461
|
+
!r || !(r instanceof U.Rect) || B(r);
|
|
462
|
+
}, [t, B]);
|
|
463
|
+
X("Delete", fe), X("Backspace", fe), X("r", (o) => {
|
|
464
|
+
const e = o.target;
|
|
465
|
+
(e == null ? void 0 : e.tagName) === "INPUT" || (e == null ? void 0 : e.tagName) === "TEXTAREA" || e != null && e.isContentEditable || c || !v && !E && I(!0);
|
|
466
|
+
}, {
|
|
467
|
+
exactMatch: !1
|
|
468
|
+
// 允许大小写
|
|
469
|
+
});
|
|
470
|
+
const De = () => {
|
|
471
|
+
c || (v && (I(!1), w()), _(!E));
|
|
472
|
+
}, _e = () => {
|
|
473
|
+
c || (E && _(!1), I(!v));
|
|
474
|
+
};
|
|
475
|
+
return h(() => () => {
|
|
476
|
+
t && t.dispose();
|
|
477
|
+
}, []), /* @__PURE__ */ Re("div", {
|
|
478
|
+
style: {
|
|
479
|
+
width: "100%",
|
|
480
|
+
height: "100%",
|
|
481
|
+
display: "flex",
|
|
482
|
+
position: "relative"
|
|
483
|
+
},
|
|
484
|
+
children: [ve && /* @__PURE__ */ S("div", {
|
|
485
|
+
className: "vlm-loading-overlay",
|
|
486
|
+
children: /* @__PURE__ */ S("div", {
|
|
487
|
+
className: "vlm-loading-spinner"
|
|
488
|
+
})
|
|
489
|
+
}), /* @__PURE__ */ S("div", {
|
|
490
|
+
className: "vlm-marker-toolbar",
|
|
491
|
+
children: /* @__PURE__ */ S(ye, {
|
|
492
|
+
drawingMode: v,
|
|
493
|
+
draggable: E,
|
|
494
|
+
scale: p,
|
|
495
|
+
onToggleDrawingMode: _e,
|
|
496
|
+
onToggleDrag: De,
|
|
497
|
+
onZoom: Se,
|
|
498
|
+
onFitToScreen: L,
|
|
499
|
+
readOnly: c
|
|
500
|
+
})
|
|
501
|
+
}), /* @__PURE__ */ Re("div", {
|
|
502
|
+
ref: T,
|
|
503
|
+
className: Oe({
|
|
504
|
+
"vlm-label-maker-wrap": !0,
|
|
505
|
+
draggable: E
|
|
506
|
+
}),
|
|
507
|
+
onContextMenu: (o) => {
|
|
508
|
+
o.preventDefault();
|
|
509
|
+
},
|
|
510
|
+
style: {
|
|
511
|
+
flex: 1,
|
|
512
|
+
position: "relative"
|
|
513
|
+
},
|
|
514
|
+
children: [(((ue = s == null ? void 0 : s.sampleFileName) == null ? void 0 : ue.originalName) || ((me = s == null ? void 0 : s.sampleFileName) == null ? void 0 : me.name)) && /* @__PURE__ */ S("div", {
|
|
515
|
+
className: "vlm-image-name",
|
|
516
|
+
children: s.sampleFileName.originalName || s.sampleFileName.name
|
|
517
|
+
}), /* @__PURE__ */ S("canvas", {
|
|
518
|
+
className: "vlm-label-maker-canvas",
|
|
519
|
+
ref: V
|
|
520
|
+
})]
|
|
521
|
+
})]
|
|
522
|
+
});
|
|
523
|
+
};
|
|
524
|
+
export {
|
|
525
|
+
Wt as default
|
|
526
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const u = (c, e, o, r, n) => {
|
|
2
|
+
if (!o || !r)
|
|
3
|
+
return {
|
|
4
|
+
x: 0,
|
|
5
|
+
y: 0
|
|
6
|
+
};
|
|
7
|
+
const t = r.getElement();
|
|
8
|
+
if (!(t != null && t.width) || !(t != null && t.height))
|
|
9
|
+
return {
|
|
10
|
+
x: 0,
|
|
11
|
+
y: 0
|
|
12
|
+
};
|
|
13
|
+
const s = c - n.current.left, a = e - n.current.top;
|
|
14
|
+
return {
|
|
15
|
+
x: s,
|
|
16
|
+
y: a
|
|
17
|
+
};
|
|
18
|
+
}, x = (c, e, o, r) => {
|
|
19
|
+
if (!o)
|
|
20
|
+
return {
|
|
21
|
+
x: 0,
|
|
22
|
+
y: 0
|
|
23
|
+
};
|
|
24
|
+
const n = c + r.current.left, t = e + r.current.top;
|
|
25
|
+
return {
|
|
26
|
+
x: n,
|
|
27
|
+
y: t
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
u as canvasToImageCoords,
|
|
32
|
+
x as imageToCanvasCoords
|
|
33
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { Tooltip as e, Button as i } from "antd";
|
|
3
|
+
import { DragOutlined as a } from "@ant-design/icons";
|
|
4
|
+
const c = ({
|
|
5
|
+
active: r,
|
|
6
|
+
onClick: o
|
|
7
|
+
}) => /* @__PURE__ */ t(e, {
|
|
8
|
+
title: "拖动-按住ctrl",
|
|
9
|
+
placement: "right",
|
|
10
|
+
children: /* @__PURE__ */ t(i, {
|
|
11
|
+
icon: /* @__PURE__ */ t(a, {}),
|
|
12
|
+
className: r ? "active" : "",
|
|
13
|
+
onClick: o
|
|
14
|
+
})
|
|
15
|
+
});
|
|
16
|
+
export {
|
|
17
|
+
c as default
|
|
18
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
};
|