luo-image-annotator 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -19
- package/dist/luo-image-annotator.css +1 -1
- package/dist/luo-image-annotator.es.js +603 -623
- package/dist/luo-image-annotator.umd.js +33 -1
- package/package.json +2 -5
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { defineComponent as
|
|
5
|
-
const
|
|
1
|
+
var rt = Object.defineProperty;
|
|
2
|
+
var ct = (v, t, e) => t in v ? rt(v, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : v[t] = e;
|
|
3
|
+
var b = (v, t, e) => ct(v, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { defineComponent as R, ref as C, watchEffect as ht, openBlock as p, createElementBlock as x, normalizeClass as T, computed as gt, onMounted as dt, watch as q, createElementVNode as h, createVNode as S, Fragment as P, renderList as D, createCommentVNode as H, normalizeStyle as j, toDisplayString as z, createTextVNode as F, withDirectives as N, vModelText as J, createBlock as Y, nextTick as vt } from "vue";
|
|
5
|
+
const W = (v, t) => Math.sqrt(Math.pow(v.x - t.x, 2) + Math.pow(v.y - t.y, 2)), ut = (v, t) => {
|
|
6
6
|
let e = !1;
|
|
7
|
-
for (let
|
|
8
|
-
const
|
|
9
|
-
o >
|
|
7
|
+
for (let s = 0, a = t.length - 1; s < t.length; a = s++) {
|
|
8
|
+
const n = t[s].x, o = t[s].y, i = t[a].x, r = t[a].y;
|
|
9
|
+
o > v.y != r > v.y && v.x < (i - n) * (v.y - o) / (r - o) + n && (e = !e);
|
|
10
10
|
}
|
|
11
11
|
return e;
|
|
12
|
-
},
|
|
13
|
-
const
|
|
12
|
+
}, K = (v, t, e) => {
|
|
13
|
+
const s = e * (Math.PI / 180), a = Math.cos(s), n = Math.sin(s), o = v.x - t.x, i = v.y - t.y;
|
|
14
14
|
return {
|
|
15
|
-
x: t.x + (o * a -
|
|
16
|
-
y: t.y + (o *
|
|
15
|
+
x: t.x + (o * a - i * n),
|
|
16
|
+
y: t.y + (o * n + i * a)
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
|
-
class
|
|
19
|
+
class mt {
|
|
20
20
|
constructor(t) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
b(this, "canvas");
|
|
22
|
+
b(this, "ctx");
|
|
23
|
+
b(this, "img");
|
|
24
|
+
b(this, "annotations", []);
|
|
25
25
|
// 状态
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
b(this, "currentTool", null);
|
|
27
|
+
b(this, "activeAnnotation", null);
|
|
28
|
+
b(this, "hoverAnnotation", null);
|
|
29
|
+
b(this, "isDrawing", !1);
|
|
30
|
+
b(this, "isDragging", !1);
|
|
31
|
+
b(this, "isPanning", !1);
|
|
32
32
|
// 平移模式
|
|
33
|
-
|
|
33
|
+
b(this, "panStartPoint", null);
|
|
34
34
|
// 平移起点
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
b(this, "dragStartPoint", null);
|
|
36
|
+
b(this, "dragStartAnnotation", null);
|
|
37
37
|
// 快照用于撤销/diff
|
|
38
|
-
|
|
38
|
+
b(this, "lastMouseMovePoint", null);
|
|
39
39
|
// 用于绘制辅助线
|
|
40
|
-
|
|
40
|
+
b(this, "isHoveringStartPoint", !1);
|
|
41
41
|
// 多边形闭合吸附状态
|
|
42
42
|
// 设置
|
|
43
|
-
|
|
43
|
+
b(this, "currentLabelColor", "#FF4081");
|
|
44
44
|
// 当前选中标签颜色
|
|
45
|
-
|
|
45
|
+
b(this, "visibleLabels", /* @__PURE__ */ new Set());
|
|
46
46
|
// 可见标签集合 (如果为空则全部可见,或者由外部控制渲染列表)
|
|
47
47
|
// 交互
|
|
48
|
-
|
|
48
|
+
b(this, "selectedHandleIndex", -1);
|
|
49
49
|
// -1: 主体, >=0: 顶点索引, -2: 旋转手柄
|
|
50
|
-
|
|
50
|
+
b(this, "hoverHandleIndex", -1);
|
|
51
51
|
// 视口
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
b(this, "scale", 1);
|
|
53
|
+
b(this, "offset", { x: 0, y: 0 });
|
|
54
|
+
b(this, "listeners", {});
|
|
55
|
+
b(this, "imageUrl", "");
|
|
56
56
|
this.canvas = t;
|
|
57
57
|
const e = t.getContext("2d");
|
|
58
58
|
if (!e) throw new Error("Could not get 2d context");
|
|
@@ -65,7 +65,7 @@ class kt {
|
|
|
65
65
|
this.listeners[t] || (this.listeners[t] = []), this.listeners[t].push(e);
|
|
66
66
|
}
|
|
67
67
|
emit(t, e) {
|
|
68
|
-
this.listeners[t] && this.listeners[t].forEach((
|
|
68
|
+
this.listeners[t] && this.listeners[t].forEach((s) => s(e));
|
|
69
69
|
}
|
|
70
70
|
loadImage(t) {
|
|
71
71
|
this.imageUrl = t, this.img.src = t, this.activeAnnotation = null, this.isDrawing = !1;
|
|
@@ -86,10 +86,10 @@ class kt {
|
|
|
86
86
|
this.visibleLabels = new Set(t), this.render();
|
|
87
87
|
}
|
|
88
88
|
zoom(t) {
|
|
89
|
-
const
|
|
90
|
-
if (
|
|
91
|
-
const a = this.canvas.width / 2,
|
|
92
|
-
this.scale =
|
|
89
|
+
const s = t > 0 ? this.scale * 1.1 : this.scale / 1.1;
|
|
90
|
+
if (s < 0.1 || s > 10) return;
|
|
91
|
+
const a = this.canvas.width / 2, n = this.canvas.height / 2, o = this.toImageCoords(a, n);
|
|
92
|
+
this.scale = s, this.offset.x = a - o.x * this.scale, this.offset.y = n - o.y * this.scale, this.render();
|
|
93
93
|
}
|
|
94
94
|
resize() {
|
|
95
95
|
this.fitImageToCanvas(), this.render();
|
|
@@ -111,8 +111,8 @@ class kt {
|
|
|
111
111
|
const t = this.canvas.parentElement;
|
|
112
112
|
if (t) {
|
|
113
113
|
if (this.canvas.width = t.clientWidth, this.canvas.height = t.clientHeight, this.img.width === 0) return;
|
|
114
|
-
const e = this.canvas.width / this.img.width,
|
|
115
|
-
this.scale = Math.min(e,
|
|
114
|
+
const e = this.canvas.width / this.img.width, s = this.canvas.height / this.img.height;
|
|
115
|
+
this.scale = Math.min(e, s), this.offset.x = (this.canvas.width - this.img.width * this.scale) / 2, this.offset.y = (this.canvas.height - this.img.height * this.scale) / 2;
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
// --- 事件处理 ---
|
|
@@ -123,82 +123,82 @@ class kt {
|
|
|
123
123
|
(t.key === "Delete" || t.key === "Backspace") && this.activeAnnotation && this.deleteAnnotation(this.activeAnnotation.id);
|
|
124
124
|
}
|
|
125
125
|
deleteAnnotation(t) {
|
|
126
|
-
const e = this.annotations.findIndex((
|
|
126
|
+
const e = this.annotations.findIndex((s) => s.id === t);
|
|
127
127
|
if (e > -1) {
|
|
128
|
-
const
|
|
128
|
+
const s = this.annotations[e];
|
|
129
129
|
this.annotations.splice(e, 1), this.activeAnnotation = null, this.emit("annotationChange", {
|
|
130
130
|
action: "delete",
|
|
131
|
-
changedItem:
|
|
131
|
+
changedItem: s,
|
|
132
132
|
imageUrl: this.imageUrl
|
|
133
133
|
}), this.render();
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
handleMouseDown(t) {
|
|
137
|
-
const e = this.canvas.getBoundingClientRect(),
|
|
137
|
+
const e = this.canvas.getBoundingClientRect(), s = t.clientX - e.left, a = t.clientY - e.top, n = this.toImageCoords(s, a);
|
|
138
138
|
if (this.canvas.style.cursor === "grab" || this.canvas.style.cursor === "grabbing") {
|
|
139
|
-
this.isPanning = !0, this.panStartPoint = { x:
|
|
139
|
+
this.isPanning = !0, this.panStartPoint = { x: s, y: a }, this.canvas.style.cursor = "grabbing";
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
142
142
|
if (this.activeAnnotation) {
|
|
143
|
-
const r = this.getHitHandle(
|
|
143
|
+
const r = this.getHitHandle(s, a, this.activeAnnotation);
|
|
144
144
|
if (r !== -100) {
|
|
145
|
-
this.isDragging = !0, this.dragStartPoint =
|
|
145
|
+
this.isDragging = !0, this.dragStartPoint = n, this.selectedHandleIndex = r, this.dragStartAnnotation = JSON.parse(JSON.stringify(this.activeAnnotation));
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
const o = this.getHitCategory(
|
|
149
|
+
const o = this.getHitCategory(s, a);
|
|
150
150
|
if (o) {
|
|
151
151
|
this.activeAnnotation = o, this.isDragging = !1, this.selectedHandleIndex = -1, this.emit("annotationChange", { action: "select", changedItem: o, imageUrl: this.imageUrl }), this.render();
|
|
152
152
|
return;
|
|
153
153
|
}
|
|
154
|
-
const
|
|
154
|
+
const i = this.getHitAnnotation(n);
|
|
155
155
|
if (this.currentTool) {
|
|
156
156
|
if (this.isDrawing && this.currentTool === "polygon" && this.activeAnnotation) {
|
|
157
157
|
const r = this.activeAnnotation.coordinates;
|
|
158
|
-
if (r.points.length > 2 &&
|
|
158
|
+
if (r.points.length > 2 && W(n, r.points[0]) < 20 / this.scale) {
|
|
159
159
|
this.finishDrawing();
|
|
160
160
|
return;
|
|
161
161
|
}
|
|
162
|
-
this.startDrawing(
|
|
162
|
+
this.startDrawing(n);
|
|
163
163
|
return;
|
|
164
164
|
}
|
|
165
165
|
if (this.currentTool) {
|
|
166
166
|
if (this.currentTool === "polygon" && !this.isDrawing) {
|
|
167
|
-
this.startDrawing(
|
|
167
|
+
this.startDrawing(n);
|
|
168
168
|
return;
|
|
169
169
|
}
|
|
170
|
-
if (
|
|
171
|
-
this.activeAnnotation =
|
|
170
|
+
if (i) {
|
|
171
|
+
this.activeAnnotation = i, this.isDragging = !0, this.dragStartPoint = n, this.selectedHandleIndex = -1, this.dragStartAnnotation = JSON.parse(JSON.stringify(i)), this.emit("annotationChange", { action: "select", changedItem: i, imageUrl: this.imageUrl }), this.render();
|
|
172
172
|
return;
|
|
173
173
|
}
|
|
174
|
-
this.startDrawing(
|
|
175
|
-
} else
|
|
176
|
-
} else if (
|
|
177
|
-
if (!(this.visibleLabels.size > 0 && !this.visibleLabels.has(
|
|
178
|
-
this.activeAnnotation =
|
|
174
|
+
this.startDrawing(n);
|
|
175
|
+
} else i ? (this.activeAnnotation = i, this.isDragging = !0, this.dragStartPoint = n, this.selectedHandleIndex = -1, this.dragStartAnnotation = JSON.parse(JSON.stringify(i)), this.emit("annotationChange", { action: "select", changedItem: i, imageUrl: this.imageUrl }), this.render()) : (this.activeAnnotation = null, this.render());
|
|
176
|
+
} else if (i) {
|
|
177
|
+
if (!(this.visibleLabels.size > 0 && !this.visibleLabels.has(i.label))) {
|
|
178
|
+
this.activeAnnotation = i, this.isDragging = !0, this.dragStartPoint = n, this.selectedHandleIndex = -1, this.dragStartAnnotation = JSON.parse(JSON.stringify(i)), this.emit("annotationChange", { action: "select", changedItem: i, imageUrl: this.imageUrl }), this.render();
|
|
179
179
|
return;
|
|
180
180
|
}
|
|
181
181
|
} else
|
|
182
182
|
this.activeAnnotation = null, this.render();
|
|
183
183
|
}
|
|
184
184
|
handleMouseMove(t) {
|
|
185
|
-
const e = this.canvas.getBoundingClientRect(),
|
|
185
|
+
const e = this.canvas.getBoundingClientRect(), s = t.clientX - e.left, a = t.clientY - e.top, n = this.toImageCoords(s, a);
|
|
186
186
|
if (this.isPanning && this.panStartPoint) {
|
|
187
|
-
const o =
|
|
188
|
-
this.offset.x += o, this.offset.y +=
|
|
187
|
+
const o = s - this.panStartPoint.x, i = a - this.panStartPoint.y;
|
|
188
|
+
this.offset.x += o, this.offset.y += i, this.panStartPoint = { x: s, y: a }, this.render();
|
|
189
189
|
return;
|
|
190
190
|
}
|
|
191
|
-
if (this.lastMouseMovePoint =
|
|
191
|
+
if (this.lastMouseMovePoint = n, this.isDrawing) {
|
|
192
192
|
if (this.currentTool === "polygon" && this.activeAnnotation) {
|
|
193
193
|
const o = this.activeAnnotation.coordinates;
|
|
194
194
|
if (o.points.length > 2) {
|
|
195
|
-
const
|
|
195
|
+
const i = o.points[0], r = W(n, i);
|
|
196
196
|
this.isHoveringStartPoint = r < 20 / this.scale;
|
|
197
197
|
} else
|
|
198
198
|
this.isHoveringStartPoint = !1;
|
|
199
199
|
}
|
|
200
|
-
this.updateDrawing(
|
|
201
|
-
} else this.isDragging && this.activeAnnotation && this.dragStartPoint ? this.updateDragging(
|
|
200
|
+
this.updateDrawing(n);
|
|
201
|
+
} else this.isDragging && this.activeAnnotation && this.dragStartPoint ? this.updateDragging(n) : this.checkHover(s, a, n);
|
|
202
202
|
this.render();
|
|
203
203
|
}
|
|
204
204
|
handleMouseUp(t) {
|
|
@@ -223,8 +223,8 @@ class kt {
|
|
|
223
223
|
// 辅助函数:将 hex 转换为 rgba
|
|
224
224
|
hexToRgba(t, e) {
|
|
225
225
|
if (!t.startsWith("#")) return t;
|
|
226
|
-
const
|
|
227
|
-
return `rgba(${
|
|
226
|
+
const s = parseInt(t.slice(1, 3), 16), a = parseInt(t.slice(3, 5), 16), n = parseInt(t.slice(5, 7), 16);
|
|
227
|
+
return `rgba(${s}, ${a}, ${n}, ${e})`;
|
|
228
228
|
}
|
|
229
229
|
startDrawing(t) {
|
|
230
230
|
if (!this.currentTool) return;
|
|
@@ -239,14 +239,14 @@ class kt {
|
|
|
239
239
|
style: { strokeColor: this.currentLabelColor }
|
|
240
240
|
};
|
|
241
241
|
else if (this.currentTool === "point") {
|
|
242
|
-
const
|
|
242
|
+
const s = {
|
|
243
243
|
id: e,
|
|
244
244
|
type: "point",
|
|
245
245
|
label: "",
|
|
246
246
|
coordinates: { points: [t] },
|
|
247
247
|
style: { strokeColor: this.currentLabelColor }
|
|
248
248
|
};
|
|
249
|
-
this.annotations.push(
|
|
249
|
+
this.annotations.push(s), this.emit("annotationChange", { action: "add", changedItem: s, imageUrl: this.imageUrl }), this.activeAnnotation = s;
|
|
250
250
|
} else if (this.currentTool === "polygon")
|
|
251
251
|
this.activeAnnotation && this.activeAnnotation.type === "polygon" && this.isDrawing ? this.activeAnnotation.coordinates.points.push(t) : (this.isDrawing = !0, this.activeAnnotation = {
|
|
252
252
|
id: e,
|
|
@@ -256,7 +256,7 @@ class kt {
|
|
|
256
256
|
style: { strokeColor: this.currentLabelColor }
|
|
257
257
|
});
|
|
258
258
|
else if (this.currentTool === "category") {
|
|
259
|
-
const
|
|
259
|
+
const s = {
|
|
260
260
|
id: e,
|
|
261
261
|
type: "category",
|
|
262
262
|
label: "",
|
|
@@ -265,7 +265,7 @@ class kt {
|
|
|
265
265
|
// 或位置?
|
|
266
266
|
style: { strokeColor: this.currentLabelColor }
|
|
267
267
|
};
|
|
268
|
-
this.annotations.push(
|
|
268
|
+
this.annotations.push(s), this.emit("annotationChange", { action: "add", changedItem: s, imageUrl: this.imageUrl }), this.activeAnnotation = s;
|
|
269
269
|
} else this.currentTool === "rotatedRect" && (this.isDrawing = !0, this.dragStartPoint = t, this.activeAnnotation = {
|
|
270
270
|
id: e,
|
|
271
271
|
type: "rotatedRect",
|
|
@@ -280,8 +280,8 @@ class kt {
|
|
|
280
280
|
const e = this.activeAnnotation.coordinates;
|
|
281
281
|
e.x2 = t.x, e.y2 = t.y;
|
|
282
282
|
} else if (this.activeAnnotation.type === "rotatedRect" && this.dragStartPoint) {
|
|
283
|
-
const e = this.activeAnnotation.coordinates,
|
|
284
|
-
e.width =
|
|
283
|
+
const e = this.activeAnnotation.coordinates, s = Math.abs(t.x - this.dragStartPoint.x), a = Math.abs(t.y - this.dragStartPoint.y);
|
|
284
|
+
e.width = s * 2, e.height = a * 2;
|
|
285
285
|
} else this.activeAnnotation.type;
|
|
286
286
|
}
|
|
287
287
|
finishDrawing() {
|
|
@@ -292,8 +292,8 @@ class kt {
|
|
|
292
292
|
this.activeAnnotation = null, this.isDrawing = !1;
|
|
293
293
|
return;
|
|
294
294
|
}
|
|
295
|
-
const e = Math.min(t.x1, t.x2),
|
|
296
|
-
t.x1 = e, t.x2 =
|
|
295
|
+
const e = Math.min(t.x1, t.x2), s = Math.max(t.x1, t.x2), a = Math.min(t.y1, t.y2), n = Math.max(t.y1, t.y2);
|
|
296
|
+
t.x1 = e, t.x2 = s, t.y1 = a, t.y2 = n, this.annotations.push(this.activeAnnotation), this.emit("annotationChange", { action: "add", changedItem: this.activeAnnotation, imageUrl: this.imageUrl });
|
|
297
297
|
} else if (this.activeAnnotation.type === "polygon") {
|
|
298
298
|
if (this.activeAnnotation.coordinates.points.length < 3) {
|
|
299
299
|
this.activeAnnotation = null, this.isDrawing = !1;
|
|
@@ -314,75 +314,75 @@ class kt {
|
|
|
314
314
|
}
|
|
315
315
|
updateDragging(t) {
|
|
316
316
|
if (!this.activeAnnotation || !this.dragStartPoint || !this.dragStartAnnotation) return;
|
|
317
|
-
const e = t.x - this.dragStartPoint.x,
|
|
318
|
-
this.selectedHandleIndex === -1 ? this.moveAnnotation(this.activeAnnotation, this.dragStartAnnotation, e,
|
|
317
|
+
const e = t.x - this.dragStartPoint.x, s = t.y - this.dragStartPoint.y;
|
|
318
|
+
this.selectedHandleIndex === -1 ? this.moveAnnotation(this.activeAnnotation, this.dragStartAnnotation, e, s) : this.resizeAnnotation(this.activeAnnotation, this.dragStartAnnotation, this.selectedHandleIndex, t);
|
|
319
319
|
}
|
|
320
|
-
moveAnnotation(t, e,
|
|
320
|
+
moveAnnotation(t, e, s, a) {
|
|
321
321
|
if (t.type === "rectangle") {
|
|
322
|
-
const
|
|
323
|
-
o.x1 =
|
|
322
|
+
const n = e.coordinates, o = t.coordinates;
|
|
323
|
+
o.x1 = n.x1 + s, o.x2 = n.x2 + s, o.y1 = n.y1 + a, o.y2 = n.y2 + a;
|
|
324
324
|
} else if (t.type === "point") {
|
|
325
|
-
const
|
|
326
|
-
o.points =
|
|
325
|
+
const n = e.coordinates, o = t.coordinates;
|
|
326
|
+
o.points = n.points.map((i) => ({ x: i.x + s, y: i.y + a }));
|
|
327
327
|
} else if (t.type === "rotatedRect") {
|
|
328
|
-
const
|
|
329
|
-
o.x =
|
|
328
|
+
const n = e.coordinates, o = t.coordinates;
|
|
329
|
+
o.x = n.x + s, o.y = n.y + a;
|
|
330
330
|
} else if (t.type === "polygon") {
|
|
331
|
-
const
|
|
332
|
-
o.points =
|
|
331
|
+
const n = e.coordinates, o = t.coordinates;
|
|
332
|
+
o.points = n.points.map((i) => ({ x: i.x + s, y: i.y + a }));
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
-
resizeAnnotation(t, e,
|
|
335
|
+
resizeAnnotation(t, e, s, a) {
|
|
336
336
|
if (t.type === "rectangle") {
|
|
337
|
-
const
|
|
338
|
-
|
|
337
|
+
const n = t.coordinates;
|
|
338
|
+
s === 0 && (n.x1 = a.x, n.y1 = a.y), s === 1 && (n.x2 = a.x, n.y1 = a.y), s === 2 && (n.x2 = a.x, n.y2 = a.y), s === 3 && (n.x1 = a.x, n.y2 = a.y);
|
|
339
339
|
} else if (t.type === "polygon") {
|
|
340
|
-
const
|
|
341
|
-
|
|
340
|
+
const n = t.coordinates;
|
|
341
|
+
s >= 0 && s < n.points.length && (n.points[s] = a);
|
|
342
342
|
} else if (t.type === "point") {
|
|
343
|
-
const
|
|
344
|
-
|
|
343
|
+
const n = t.coordinates;
|
|
344
|
+
s >= 0 && s < n.points.length && (n.points[s] = a);
|
|
345
345
|
} else if (t.type === "rotatedRect") {
|
|
346
|
-
const
|
|
347
|
-
if (
|
|
348
|
-
const o =
|
|
349
|
-
let d = Math.atan2(
|
|
350
|
-
d += 90,
|
|
346
|
+
const n = t.coordinates;
|
|
347
|
+
if (s === -2) {
|
|
348
|
+
const o = n.x, i = n.y, r = a.x - o, m = a.y - i;
|
|
349
|
+
let d = Math.atan2(m, r) * 180 / Math.PI;
|
|
350
|
+
d += 90, n.angle = d;
|
|
351
351
|
} else {
|
|
352
|
-
const o =
|
|
353
|
-
(
|
|
352
|
+
const o = n.angle * Math.PI / 180, i = Math.cos(-o), r = Math.sin(-o), m = a.x - n.x, d = a.y - n.y, u = m * i - d * r, f = m * r + d * i;
|
|
353
|
+
(s === 0 || s === 3) && (n.width / 2, n.width = Math.abs(u) * 2), (s === 1 || s === 2) && (n.width = Math.abs(u) * 2), (s === 0 || s === 1) && (n.height = Math.abs(f) * 2), (s === 2 || s === 3) && (n.height = Math.abs(f) * 2);
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
357
|
// --- 命中测试和渲染辅助函数 ---
|
|
358
358
|
getHitAnnotation(t) {
|
|
359
359
|
for (let e = this.annotations.length - 1; e >= 0; e--) {
|
|
360
|
-
const
|
|
361
|
-
if (this.isPointInAnnotation(t,
|
|
362
|
-
return
|
|
360
|
+
const s = this.annotations[e];
|
|
361
|
+
if (this.isPointInAnnotation(t, s))
|
|
362
|
+
return s;
|
|
363
363
|
}
|
|
364
364
|
return null;
|
|
365
365
|
}
|
|
366
366
|
isPointInAnnotation(t, e) {
|
|
367
367
|
if (e.type === "rectangle") {
|
|
368
|
-
const
|
|
369
|
-
return t.x >=
|
|
368
|
+
const s = e.coordinates;
|
|
369
|
+
return t.x >= s.x1 && t.x <= s.x2 && t.y >= s.y1 && t.y <= s.y2;
|
|
370
370
|
} else if (e.type === "polygon") {
|
|
371
|
-
const
|
|
372
|
-
return
|
|
371
|
+
const s = e.coordinates;
|
|
372
|
+
return ut(t, s.points);
|
|
373
373
|
} else if (e.type === "rotatedRect") {
|
|
374
|
-
const
|
|
375
|
-
return a.x >=
|
|
374
|
+
const s = e.coordinates, a = K(t, { x: s.x, y: s.y }, -s.angle), n = s.width / 2, o = s.height / 2;
|
|
375
|
+
return a.x >= s.x - n && a.x <= s.x + n && a.y >= s.y - o && a.y <= s.y + o;
|
|
376
376
|
} else if (e.type === "point")
|
|
377
|
-
return e.coordinates.points.some((a) =>
|
|
377
|
+
return e.coordinates.points.some((a) => W(t, a) < 10 / this.scale);
|
|
378
378
|
return !1;
|
|
379
379
|
}
|
|
380
|
-
getHitHandle(t, e,
|
|
381
|
-
const a = this.getAnnotationHandles(
|
|
380
|
+
getHitHandle(t, e, s) {
|
|
381
|
+
const a = this.getAnnotationHandles(s), n = 6;
|
|
382
382
|
for (let o = 0; o < a.length; o++) {
|
|
383
|
-
const
|
|
384
|
-
if (Math.abs(t - r.x) <
|
|
385
|
-
return
|
|
383
|
+
const i = a[o], r = this.toScreenCoords(i.x, i.y);
|
|
384
|
+
if (Math.abs(t - r.x) < n && Math.abs(e - r.y) < n)
|
|
385
|
+
return s.type === "rotatedRect" && o === 4 ? -2 : o;
|
|
386
386
|
}
|
|
387
387
|
return -100;
|
|
388
388
|
}
|
|
@@ -405,13 +405,13 @@ class kt {
|
|
|
405
405
|
if (t.type === "point")
|
|
406
406
|
return t.coordinates.points;
|
|
407
407
|
if (t.type === "rotatedRect") {
|
|
408
|
-
const e = t.coordinates,
|
|
409
|
-
return [o,
|
|
408
|
+
const e = t.coordinates, s = { x: e.x, y: e.y }, a = e.width / 2, n = e.height / 2, o = { x: e.x - a, y: e.y - n }, i = { x: e.x + a, y: e.y - n }, r = { x: e.x + a, y: e.y + n }, m = { x: e.x - a, y: e.y + n }, d = { x: e.x, y: e.y - n - 20 / this.scale };
|
|
409
|
+
return [o, i, r, m, d].map((u) => K(u, s, e.angle));
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
412
|
return [];
|
|
413
413
|
}
|
|
414
|
-
checkHover(t, e,
|
|
414
|
+
checkHover(t, e, s) {
|
|
415
415
|
const a = this.getHitCategory(t, e);
|
|
416
416
|
if (a) {
|
|
417
417
|
this.canvas.style.cursor = "pointer", this.hoverAnnotation = a;
|
|
@@ -421,8 +421,8 @@ class kt {
|
|
|
421
421
|
this.canvas.style.cursor = "pointer";
|
|
422
422
|
return;
|
|
423
423
|
}
|
|
424
|
-
const
|
|
425
|
-
|
|
424
|
+
const n = this.getHitAnnotation(s);
|
|
425
|
+
n ? (this.canvas.style.cursor = "move", this.hoverAnnotation = n) : (this.canvas.style.cursor = "default", this.hoverAnnotation = null);
|
|
426
426
|
}
|
|
427
427
|
render() {
|
|
428
428
|
this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height), this.img.complete && this.img.width > 0 && this.ctx.drawImage(this.img, this.offset.x, this.offset.y, this.img.width * this.scale, this.img.height * this.scale), this.annotations.forEach((t) => {
|
|
@@ -434,38 +434,38 @@ class kt {
|
|
|
434
434
|
if (t.length === 0) return;
|
|
435
435
|
this.ctx.save(), this.ctx.font = "14px sans-serif", this.ctx.textBaseline = "top";
|
|
436
436
|
let e = 10;
|
|
437
|
-
const
|
|
437
|
+
const s = 10, a = 8, n = 4, o = 24, i = 8;
|
|
438
438
|
t.forEach((r) => {
|
|
439
|
-
const
|
|
440
|
-
this.ctx.fillStyle =
|
|
439
|
+
const m = r.label || "Unlabeled", d = this.ctx.measureText(m).width + a * 2, u = this.activeAnnotation === r, f = this.hoverAnnotation === r;
|
|
440
|
+
this.ctx.fillStyle = u ? "#E3F2FD" : f ? "#F5F5F5" : "rgba(255, 255, 255, 0.9)", this.ctx.strokeStyle = u ? "#2196F3" : "#666", this.ctx.lineWidth = u ? 2 : 1, this.ctx.beginPath(), this.ctx.rect(e, s, d, o), this.ctx.fill(), this.ctx.stroke(), this.ctx.fillStyle = u ? "#1976D2" : "#333", this.ctx.fillText(m, e + a, s + n), e += d + i;
|
|
441
441
|
}), this.ctx.restore();
|
|
442
442
|
}
|
|
443
443
|
getHitCategory(t, e) {
|
|
444
|
-
const
|
|
445
|
-
if (
|
|
444
|
+
const s = this.annotations.filter((d) => d.type === "category");
|
|
445
|
+
if (s.length === 0) return null;
|
|
446
446
|
this.ctx.save(), this.ctx.font = "14px sans-serif";
|
|
447
447
|
let a = 10;
|
|
448
|
-
const
|
|
449
|
-
let
|
|
450
|
-
for (const d of
|
|
451
|
-
const
|
|
452
|
-
if (t >= a && t <= a + f && e >=
|
|
453
|
-
|
|
448
|
+
const n = 10, o = 8, i = 24, r = 8;
|
|
449
|
+
let m = null;
|
|
450
|
+
for (const d of s) {
|
|
451
|
+
const u = d.label || "Unlabeled", f = this.ctx.measureText(u).width + o * 2;
|
|
452
|
+
if (t >= a && t <= a + f && e >= n && e <= n + i) {
|
|
453
|
+
m = d;
|
|
454
454
|
break;
|
|
455
455
|
}
|
|
456
456
|
a += f + r;
|
|
457
457
|
}
|
|
458
|
-
return this.ctx.restore(),
|
|
458
|
+
return this.ctx.restore(), m;
|
|
459
459
|
}
|
|
460
460
|
drawItem(t, e) {
|
|
461
|
-
var
|
|
461
|
+
var n;
|
|
462
462
|
if (this.visibleLabels.size > 0 && !this.visibleLabels.has(t.label) && !e)
|
|
463
463
|
return;
|
|
464
464
|
this.ctx.save();
|
|
465
|
-
const
|
|
466
|
-
if (this.ctx.strokeStyle = a, this.ctx.lineWidth = 2, e ? this.ctx.fillStyle = "rgba(0, 229, 255, 0.2)" : this.ctx.fillStyle = this.hexToRgba(
|
|
467
|
-
const o = t.coordinates,
|
|
468
|
-
this.ctx.strokeRect(
|
|
465
|
+
const s = ((n = t.style) == null ? void 0 : n.strokeColor) || "#FF4081", a = e ? "#00E5FF" : s;
|
|
466
|
+
if (this.ctx.strokeStyle = a, this.ctx.lineWidth = 2, e ? this.ctx.fillStyle = "rgba(0, 229, 255, 0.2)" : this.ctx.fillStyle = this.hexToRgba(s, 0.2), t.type === "rectangle") {
|
|
467
|
+
const o = t.coordinates, i = this.toScreenCoords(o.x1, o.y1), r = this.toScreenCoords(o.x2, o.y2), m = Math.min(i.x, r.x), d = Math.min(i.y, r.y), u = Math.abs(i.x - r.x), f = Math.abs(i.y - r.y);
|
|
468
|
+
this.ctx.strokeRect(m, d, u, f), this.ctx.fillStyle = e ? "rgba(0, 229, 255, 0.2)" : "rgba(255, 64, 129, 0.2)", this.ctx.fillRect(m, d, u, f), e && this.drawHandles(this.getAnnotationHandles(t));
|
|
469
469
|
} else if (t.type === "polygon") {
|
|
470
470
|
const o = t.coordinates;
|
|
471
471
|
if (o.points.length === 0) {
|
|
@@ -473,11 +473,11 @@ class kt {
|
|
|
473
473
|
return;
|
|
474
474
|
}
|
|
475
475
|
this.ctx.beginPath();
|
|
476
|
-
const
|
|
477
|
-
this.ctx.moveTo(
|
|
476
|
+
const i = this.toScreenCoords(o.points[0].x, o.points[0].y);
|
|
477
|
+
this.ctx.moveTo(i.x, i.y);
|
|
478
478
|
for (let r = 1; r < o.points.length; r++) {
|
|
479
|
-
const
|
|
480
|
-
this.ctx.lineTo(
|
|
479
|
+
const m = this.toScreenCoords(o.points[r].x, o.points[r].y);
|
|
480
|
+
this.ctx.lineTo(m.x, m.y);
|
|
481
481
|
}
|
|
482
482
|
if (!this.isDrawing || t !== this.activeAnnotation)
|
|
483
483
|
this.ctx.closePath();
|
|
@@ -488,47 +488,100 @@ class kt {
|
|
|
488
488
|
const d = this.toScreenCoords(o.points[0].x, o.points[0].y);
|
|
489
489
|
this.ctx.save(), this.ctx.beginPath(), this.ctx.arc(d.x, d.y, 10, 0, Math.PI * 2), this.ctx.fillStyle = "rgba(255, 215, 0, 0.6)", this.ctx.strokeStyle = "#FFFFFF", this.ctx.lineWidth = 2, this.ctx.fill(), this.ctx.stroke(), this.ctx.restore();
|
|
490
490
|
}
|
|
491
|
-
const
|
|
492
|
-
this.ctx.lineTo(
|
|
491
|
+
const m = this.toScreenCoords(r.x, r.y);
|
|
492
|
+
this.ctx.lineTo(m.x, m.y);
|
|
493
493
|
}
|
|
494
494
|
this.ctx.stroke(), this.ctx.fillStyle = e ? "rgba(0, 229, 255, 0.2)" : "rgba(255, 64, 129, 0.2)", this.ctx.fill(), e && this.drawHandles(this.getAnnotationHandles(t));
|
|
495
495
|
} else if (t.type === "rotatedRect") {
|
|
496
496
|
const o = t.coordinates;
|
|
497
497
|
this.ctx.translate(this.toScreenCoords(o.x, o.y).x, this.toScreenCoords(o.x, o.y).y), this.ctx.rotate(o.angle * Math.PI / 180);
|
|
498
|
-
const
|
|
499
|
-
this.ctx.strokeRect(-
|
|
500
|
-
} else t.type === "point" && t.coordinates.points.forEach((
|
|
501
|
-
const r = this.toScreenCoords(
|
|
502
|
-
this.ctx.beginPath(), this.ctx.arc(r.x, r.y, 5, 0, Math.PI * 2), this.ctx.fillStyle = e ? "#00E5FF" :
|
|
498
|
+
const i = o.width * this.scale, r = o.height * this.scale;
|
|
499
|
+
this.ctx.strokeRect(-i / 2, -r / 2, i, r), this.ctx.fillStyle = e ? "rgba(0, 229, 255, 0.2)" : "rgba(255, 64, 129, 0.2)", this.ctx.fillRect(-i / 2, -r / 2, i, r), this.ctx.rotate(-o.angle * Math.PI / 180), this.ctx.translate(-this.toScreenCoords(o.x, o.y).x, -this.toScreenCoords(o.x, o.y).y), e && this.drawHandles(this.getAnnotationHandles(t));
|
|
500
|
+
} else t.type === "point" && t.coordinates.points.forEach((i) => {
|
|
501
|
+
const r = this.toScreenCoords(i.x, i.y);
|
|
502
|
+
this.ctx.beginPath(), this.ctx.arc(r.x, r.y, 5, 0, Math.PI * 2), this.ctx.fillStyle = e ? "#00E5FF" : s, this.ctx.fill(), this.ctx.stroke();
|
|
503
503
|
});
|
|
504
504
|
this.ctx.restore();
|
|
505
505
|
}
|
|
506
506
|
drawHandles(t) {
|
|
507
507
|
this.ctx.fillStyle = "#FFFFFF", this.ctx.strokeStyle = "#000000", this.ctx.lineWidth = 1, t.forEach((e) => {
|
|
508
|
-
const
|
|
509
|
-
this.ctx.fillRect(
|
|
508
|
+
const s = this.toScreenCoords(e.x, e.y);
|
|
509
|
+
this.ctx.fillRect(s.x - 4, s.y - 4, 8, 8), this.ctx.strokeRect(s.x - 4, s.y - 4, 8, 8);
|
|
510
510
|
});
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
|
-
const
|
|
513
|
+
const ft = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="1em" height="1em">\r
|
|
514
|
+
<path d="M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z m0-320a64 64 0 1 0 0-128 64 64 0 0 0 0 128z m0 64a128 128 0 1 1 0-256 128 128 0 0 1 0 256z" fill="currentColor"/>\r
|
|
515
|
+
</svg>`, yt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="1em" height="1em">\r
|
|
516
|
+
<path d="M609.408 149.376l-277.76 277.76a96 96 0 0 0 0 135.68l277.76 277.76a32 32 0 1 0 45.248-45.248L376.96 512l277.76-277.76a32 32 0 0 0-45.248-45.248z" fill="currentColor"/>\r
|
|
517
|
+
</svg>`, pt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="1em" height="1em">\r
|
|
518
|
+
<path d="M704 192h160v160h-160z m-64-64v288h288V128H640zM160 672h160v160H160z m-64-64v288h288V608H96z m256-320h320v64H352z" fill="currentColor"/>\r
|
|
519
|
+
</svg>`, xt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="1em" height="1em">\r
|
|
520
|
+
<path d="M256 256h512v512H256z m-64-64v640h640V192H192z" fill="currentColor"/>\r
|
|
521
|
+
</svg>`, bt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="1em" height="1em">\r
|
|
522
|
+
<path d="M160 256h704a32 32 0 1 1 0 64h-64v608a32 32 0 0 1-32 32H256a32 32 0 0 1-32-32V320h-64a32 32 0 1 1 0-64zm128 64v576h448V320H288z m128 0v512a32 32 0 1 1-64 0V320a32 32 0 1 1 64 0zm256 0v512a32 32 0 1 1-64 0V320a32 32 0 1 1 64 0zM352 128h320a32 32 0 0 1 32 32v64H320v-64a32 32 0 0 1 32-32z" fill="currentColor"/>\r
|
|
523
|
+
</svg>`, wt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="1em" height="1em">\r
|
|
524
|
+
<path d="M512 666.56l-186.88-186.88a32 32 0 0 0-45.248 45.248l209.536 209.536a96 96 0 0 0 135.68 0l209.536-209.536a32 32 0 1 0-45.248-45.248L544 666.56V128a32 32 0 0 0-64 0v538.56zM192 832h640a32 32 0 1 1 0 64H192a32 32 0 1 1 0-64z" fill="currentColor"/>\r
|
|
525
|
+
</svg>`, Ct = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="1em" height="1em">\r
|
|
526
|
+
<path d="M832 512a32 32 0 1 1 64 0v352a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h352a32 32 0 0 1 0 64H192v640h640V512z m-144-320l-480 480v160h160l480-480-160-160z m-114.56 480H256v-117.76L653.44 236.8l117.76 117.76L573.44 672z m208-208l-117.76-117.76 66.56-66.56a32 32 0 0 1 45.248 0l72.512 72.512a32 32 0 0 1 0 45.248l-66.56 66.56z" fill="currentColor"/>\r
|
|
527
|
+
</svg>`, _t = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="1em" height="1em">\r
|
|
528
|
+
<path d="M940.48 876.16L148.16 83.84a32 32 0 1 0-45.12 45.12L236.8 262.4C163.52 337.28 107.52 429.12 82.56 528.96a32 32 0 0 0 0 20.48C144.384 727.68 314.88 840.96 512 840.96c103.04 0 199.36-30.72 283.52-83.84l99.84 99.84a32 32 0 1 0 45.12-45.12zM512 776.96c-176.64 0-333.44-98.56-402.56-248.96 25.6-56.32 63.36-107.52 110.08-151.04L364.8 522.24a128 128 0 0 0 147.2 147.2l123.52 123.52A445.44 445.44 0 0 1 512 776.96z m373.12-32.64l-64-64C857.6 627.84 879.616 572.16 879.616 512c0-176.64-156.8-328.96-367.616-328.96-58.24 0-113.6 11.52-164.48 32.64l-55.68-55.68C346.88 136.96 427.52 119.04 512 119.04c229.76 0 425.216 142.08 493.44 346.24a32 32 0 0 1 0 20.48 450.56 450.56 0 0 1-120.32 258.56z m-309.12-309.12l-128-128A128 128 0 0 1 576 435.2z" fill="currentColor"/>\r
|
|
529
|
+
</svg>`, At = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="1em" height="1em">\r
|
|
530
|
+
<path d="M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 832a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm-48-384H320a32 32 0 0 1 0-64h144V304a32 32 0 1 1 64 0v144h144a32 32 0 1 1 0 64H528v144a32 32 0 1 1-64 0V512z" fill="currentColor"/>\r
|
|
531
|
+
</svg>`, kt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="1em" height="1em">\r
|
|
532
|
+
<path d="M224 448a32 32 0 0 0 9.536 22.592l416 416a32 32 0 0 0 45.248 0l226.24-226.24a32 32 0 0 0 0-45.248l-416-416A32 32 0 0 0 482.432 192H256a64 64 0 0 0-64 64v192z m64-192h160l384 384-160 160-384-384V256z m64 128a64 64 0 1 0 0-128 64 64 0 0 0 0 128z" fill="currentColor"/>\r
|
|
533
|
+
</svg>`, St = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="1em" height="1em">\r
|
|
534
|
+
<path d="M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64zm0-704h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64zm0 352h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64z" fill="currentColor"/>\r
|
|
535
|
+
</svg>`, It = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="1em" height="1em">\r
|
|
536
|
+
<path d="M784.512 230.272v-50.56a32 32 0 1 1 64 0v149.056a32 32 0 0 1-32 32H667.52a32 32 0 1 1 0-64h92.992A320 320 0 1 0 524.8 833.152a320 320 0 0 0 320-320h64a384 384 0 0 1-384 384 384 384 0 0 1-384-384 384 384 0 0 1 643.712-282.88z" fill="currentColor"/>\r
|
|
537
|
+
</svg>`, zt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="1em" height="1em">\r
|
|
538
|
+
<path d="M340.864 149.376a32 32 0 0 0-45.248 45.248L573.44 512l-277.76 317.376a32 32 0 0 0 45.248 45.248l277.76-277.76a96 96 0 0 0 0-135.68L340.864 149.376z" fill="currentColor"/>\r
|
|
539
|
+
</svg>`, Mt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="1em" height="1em">\r
|
|
540
|
+
<path d="M512 192c229.76 0 425.216 142.08 493.44 346.24a32 32 0 0 1 0 20.48C937.216 762.88 741.76 904.96 512 904.96S86.784 762.88 18.56 558.72a32 32 0 0 1 0-20.48C86.784 334.08 282.24 192 512 192zm0 64c-197.12 0-367.616 120.32-428.16 296.32C144.384 727.68 314.88 840.96 512 840.96s367.616-113.28 428.16-288.64C879.616 376.32 709.12 256 512 256zm0 160a128 128 0 1 1 0 256 128 128 0 0 1 0-256zm0 64a64 64 0 1 0 0 128 64 64 0 0 0 0-128z" fill="currentColor"/>\r
|
|
541
|
+
</svg>`, Ht = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="1em" height="1em">\r
|
|
542
|
+
<path d="M637.12 693.376l182.208 182.208a32 32 0 1 1-45.248 45.248L591.872 738.624a352 352 0 1 1 45.248-45.248z m-45.248-45.248A288 288 0 1 0 183.872 240.128a288 288 0 0 0 408 408zM416 448h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64h96v-96a32 32 0 0 1 64 0v96z" fill="currentColor"/>\r
|
|
543
|
+
</svg>`, Lt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="1em" height="1em">\r
|
|
544
|
+
<path d="M637.12 693.376l182.208 182.208a32 32 0 1 1-45.248 45.248L591.872 738.624a352 352 0 1 1 45.248-45.248z m-45.248-45.248A288 288 0 1 0 183.872 240.128a288 288 0 0 0 408 408zM256 448h320a32 32 0 1 1 0 64H256a32 32 0 1 1 0-64z" fill="currentColor"/>\r
|
|
545
|
+
</svg>`, Pt = ["innerHTML"], Tt = /* @__PURE__ */ R({
|
|
546
|
+
__name: "SvgIcon",
|
|
547
|
+
props: {
|
|
548
|
+
name: {},
|
|
549
|
+
size: {}
|
|
550
|
+
},
|
|
551
|
+
setup(v) {
|
|
552
|
+
const t = v, e = C(""), s = /* @__PURE__ */ Object.assign({ "../assets/svg/aim.svg": ft, "../assets/svg/back.svg": yt, "../assets/svg/connection.svg": pt, "../assets/svg/crop.svg": xt, "../assets/svg/delete.svg": bt, "../assets/svg/download.svg": wt, "../assets/svg/edit.svg": Ct, "../assets/svg/hide.svg": _t, "../assets/svg/pointer.svg": At, "../assets/svg/price-tag.svg": kt, "../assets/svg/rank.svg": St, "../assets/svg/refresh-right.svg": It, "../assets/svg/right.svg": zt, "../assets/svg/view.svg": Mt, "../assets/svg/zoom-in.svg": Ht, "../assets/svg/zoom-out.svg": Lt });
|
|
553
|
+
return ht(() => {
|
|
554
|
+
const a = `../assets/svg/${t.name}.svg`, n = s[a];
|
|
555
|
+
n ? e.value = n : (console.warn(`Icon ${t.name} not found at path ${a}`), e.value = "");
|
|
556
|
+
}), (a, n) => (p(), x("i", {
|
|
557
|
+
class: T(["svg-icon", [v.size ? `size-${v.size}` : ""]]),
|
|
558
|
+
innerHTML: e.value
|
|
559
|
+
}, null, 10, Pt));
|
|
560
|
+
}
|
|
561
|
+
}), B = (v, t) => {
|
|
562
|
+
const e = v.__vccOpts || v;
|
|
563
|
+
for (const [s, a] of t)
|
|
564
|
+
e[s] = a;
|
|
565
|
+
return e;
|
|
566
|
+
}, k = /* @__PURE__ */ B(Tt, [["__scopeId", "data-v-3928607b"]]), Dt = {
|
|
514
567
|
key: 0,
|
|
515
568
|
class: "left-sidebar"
|
|
516
|
-
},
|
|
569
|
+
}, $t = ["onClick", "title"], Ut = { class: "center-area" }, Ft = {
|
|
517
570
|
key: 0,
|
|
518
571
|
class: "top-bar"
|
|
519
|
-
},
|
|
572
|
+
}, Rt = { class: "label-selector" }, Bt = { class: "tags-row" }, Ot = ["onClick"], Vt = {
|
|
520
573
|
key: 0,
|
|
521
574
|
class: "no-labels"
|
|
522
|
-
},
|
|
575
|
+
}, Et = {
|
|
523
576
|
key: 1,
|
|
524
577
|
class: "batch-nav"
|
|
525
|
-
},
|
|
578
|
+
}, Nt = ["disabled"], Jt = ["disabled"], Wt = {
|
|
526
579
|
key: 1,
|
|
527
580
|
class: "right-sidebar"
|
|
528
|
-
},
|
|
581
|
+
}, jt = { class: "label-list" }, Xt = { class: "label-row" }, Yt = ["onUpdate:modelValue", "onChange"], Kt = ["title"], qt = ["onClick"], Gt = { class: "action-icon more-actions" }, Qt = ["onClick"], Zt = {
|
|
529
582
|
key: 2,
|
|
530
583
|
class: "modal-overlay"
|
|
531
|
-
},
|
|
584
|
+
}, te = { class: "modal-content" }, ee = { class: "form-group" }, se = { class: "form-group" }, ne = { class: "color-input-wrapper" }, ie = /* @__PURE__ */ R({
|
|
532
585
|
__name: "ImageAnnotator",
|
|
533
586
|
props: {
|
|
534
587
|
annotationTypes: { default: () => ["rectangle", "polygon", "point", "rotatedRect"] },
|
|
@@ -539,68 +592,68 @@ const St = {
|
|
|
539
592
|
readOnly: { type: Boolean, default: !1 }
|
|
540
593
|
},
|
|
541
594
|
emits: ["annotationChange", "batchChange", "labelChange"],
|
|
542
|
-
setup(
|
|
543
|
-
const
|
|
544
|
-
rectangle: "
|
|
545
|
-
polygon: "
|
|
546
|
-
point: "
|
|
547
|
-
rotatedRect: "
|
|
548
|
-
category: "
|
|
549
|
-
})[l] || l,
|
|
595
|
+
setup(v, { expose: t, emit: e }) {
|
|
596
|
+
const s = v, a = e, n = C(null), o = C(null), i = C(null), r = C(null), m = C(0), d = C([]), u = C(""), f = C(!1), y = C({ name: "", color: "#FF0000" }), w = gt(() => s.annotationTypes.filter((l) => l !== "category")), A = (l) => ({
|
|
597
|
+
rectangle: "crop",
|
|
598
|
+
polygon: "connection",
|
|
599
|
+
point: "aim",
|
|
600
|
+
rotatedRect: "refresh-right",
|
|
601
|
+
category: "price-tag"
|
|
602
|
+
})[l] || l, I = (l) => ({
|
|
550
603
|
rectangle: "矩形框",
|
|
551
604
|
polygon: "多边形",
|
|
552
605
|
point: "关键点",
|
|
553
606
|
rotatedRect: "旋转矩形",
|
|
554
607
|
category: "分类标签"
|
|
555
608
|
})[l] || l;
|
|
556
|
-
|
|
557
|
-
if (
|
|
558
|
-
|
|
609
|
+
dt(() => {
|
|
610
|
+
if (n.value) {
|
|
611
|
+
i.value = new mt(n.value), i.value.on("annotationChange", (c) => {
|
|
559
612
|
if (c.action === "add" && c.changedItem) {
|
|
560
|
-
const
|
|
561
|
-
|
|
613
|
+
const g = d.value.find((_) => _.id === u.value);
|
|
614
|
+
g && (c.changedItem.label = g.name);
|
|
562
615
|
}
|
|
563
616
|
a("annotationChange", c);
|
|
564
|
-
}),
|
|
617
|
+
}), $(), L();
|
|
565
618
|
const l = new ResizeObserver(() => {
|
|
566
619
|
var c;
|
|
567
|
-
(c =
|
|
620
|
+
(c = i.value) == null || c.resize();
|
|
568
621
|
});
|
|
569
622
|
o.value && l.observe(o.value);
|
|
570
623
|
}
|
|
571
624
|
});
|
|
572
|
-
const
|
|
573
|
-
if (!
|
|
574
|
-
const l = d.value.find((
|
|
575
|
-
l &&
|
|
576
|
-
const c = d.value.filter((
|
|
577
|
-
|
|
578
|
-
},
|
|
579
|
-
if (
|
|
580
|
-
const l =
|
|
581
|
-
|
|
625
|
+
const L = () => {
|
|
626
|
+
if (!i.value) return;
|
|
627
|
+
const l = d.value.find((g) => g.id === u.value);
|
|
628
|
+
l && i.value.setLabelStyle(l.color);
|
|
629
|
+
const c = d.value.filter((g) => g.visible).map((g) => g.name);
|
|
630
|
+
i.value.setVisibleLabels(c);
|
|
631
|
+
}, $ = () => {
|
|
632
|
+
if (i.value && s.batchImages.length > 0) {
|
|
633
|
+
const l = s.batchImages[m.value];
|
|
634
|
+
i.value.loadImage(l.imageUrl), l.annotations && i.value.setAnnotations(l.annotations);
|
|
582
635
|
}
|
|
583
|
-
},
|
|
584
|
-
var c,
|
|
636
|
+
}, O = (l) => {
|
|
637
|
+
var c, g;
|
|
585
638
|
if (r.value = l, l !== "pan" && l !== "select" && d.value.length === 0) {
|
|
586
639
|
alert("请先创建标签!");
|
|
587
640
|
return;
|
|
588
641
|
}
|
|
589
|
-
l === "pan" || l === "select" ? (c =
|
|
590
|
-
},
|
|
591
|
-
var l;
|
|
592
|
-
(l = s.value) != null && l.activeAnnotation && s.value.deleteAnnotation(s.value.activeAnnotation.id);
|
|
593
|
-
}, z = () => {
|
|
642
|
+
l === "pan" || l === "select" ? (c = i.value) == null || c.setTool(l) : (g = i.value) == null || g.setTool(l);
|
|
643
|
+
}, G = () => {
|
|
594
644
|
var l;
|
|
595
|
-
|
|
645
|
+
(l = i.value) != null && l.activeAnnotation && i.value.deleteAnnotation(i.value.activeAnnotation.id);
|
|
596
646
|
}, Q = () => {
|
|
597
647
|
var l;
|
|
598
|
-
return (l =
|
|
599
|
-
},
|
|
600
|
-
|
|
648
|
+
return (l = i.value) == null ? void 0 : l.zoom(1);
|
|
649
|
+
}, Z = () => {
|
|
650
|
+
var l;
|
|
651
|
+
return (l = i.value) == null ? void 0 : l.zoom(-1);
|
|
601
652
|
}, tt = () => {
|
|
653
|
+
y.value = { name: "", color: "#2196F3" }, f.value = !0;
|
|
654
|
+
}, X = () => {
|
|
602
655
|
f.value = !1;
|
|
603
|
-
},
|
|
656
|
+
}, et = () => {
|
|
604
657
|
if (!y.value.name.trim()) {
|
|
605
658
|
alert("请输入标签名称");
|
|
606
659
|
return;
|
|
@@ -611,328 +664,273 @@ const St = {
|
|
|
611
664
|
color: y.value.color,
|
|
612
665
|
visible: !0
|
|
613
666
|
};
|
|
614
|
-
d.value.push(c), a("labelChange", d.value), d.value.length === 1 &&
|
|
615
|
-
},
|
|
667
|
+
d.value.push(c), a("labelChange", d.value), d.value.length === 1 && U(c), X();
|
|
668
|
+
}, U = (l) => {
|
|
616
669
|
var c;
|
|
617
|
-
|
|
618
|
-
},
|
|
670
|
+
u.value = l.id, (c = i.value) == null || c.setLabelStyle(l.color);
|
|
671
|
+
}, st = (l, c) => {
|
|
619
672
|
if (!l.startsWith("#")) return l;
|
|
620
|
-
let
|
|
621
|
-
return l.length === 4 ? (
|
|
622
|
-
},
|
|
673
|
+
let g = 0, _ = 0, M = 0;
|
|
674
|
+
return l.length === 4 ? (g = parseInt(l[1] + l[1], 16), _ = parseInt(l[2] + l[2], 16), M = parseInt(l[3] + l[3], 16)) : l.length === 7 && (g = parseInt(l.slice(1, 3), 16), _ = parseInt(l.slice(3, 5), 16), M = parseInt(l.slice(5, 7), 16)), `rgba(${g}, ${_}, ${M}, ${c})`;
|
|
675
|
+
}, nt = (l) => {
|
|
623
676
|
var c;
|
|
624
|
-
if (l.id ===
|
|
625
|
-
const
|
|
626
|
-
let
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
}),
|
|
677
|
+
if (l.id === u.value && ((c = i.value) == null || c.setLabelStyle(l.color)), i.value) {
|
|
678
|
+
const g = i.value.getAnnotations();
|
|
679
|
+
let _ = !1;
|
|
680
|
+
g.forEach((M) => {
|
|
681
|
+
M.label === l.name && (M.style || (M.style = {}), M.style.strokeColor = l.color, M.style.fillColor = st(l.color, 0.2), _ = !0);
|
|
682
|
+
}), _ && i.value.render();
|
|
630
683
|
}
|
|
631
684
|
a("labelChange", d.value);
|
|
632
|
-
},
|
|
633
|
-
l.visible = !l.visible,
|
|
634
|
-
},
|
|
635
|
-
const c = d.value.findIndex((
|
|
636
|
-
c > -1 && (d.value.splice(c, 1), a("labelChange", d.value),
|
|
685
|
+
}, it = (l) => {
|
|
686
|
+
l.visible = !l.visible, L();
|
|
687
|
+
}, ot = (l) => {
|
|
688
|
+
const c = d.value.findIndex((g) => g.id === l);
|
|
689
|
+
c > -1 && (d.value.splice(c, 1), a("labelChange", d.value), u.value === l && (u.value = d.value.length > 0 ? d.value[0].id : "", u.value && U(d.value[0])), L());
|
|
637
690
|
};
|
|
638
|
-
|
|
691
|
+
q(() => s.labels, (l) => {
|
|
639
692
|
const c = JSON.parse(JSON.stringify(l || []));
|
|
640
693
|
if (d.value = c, d.value.length > 0)
|
|
641
|
-
if (!
|
|
642
|
-
|
|
694
|
+
if (!u.value || !d.value.find((g) => g.id === u.value))
|
|
695
|
+
U(d.value[0]);
|
|
643
696
|
else {
|
|
644
|
-
const
|
|
645
|
-
|
|
697
|
+
const g = d.value.find((_) => _.id === u.value);
|
|
698
|
+
g && U(g);
|
|
646
699
|
}
|
|
647
700
|
else
|
|
648
|
-
|
|
649
|
-
|
|
701
|
+
u.value = "";
|
|
702
|
+
L();
|
|
650
703
|
}, { immediate: !0, deep: !0 });
|
|
651
|
-
const
|
|
652
|
-
|
|
653
|
-
},
|
|
654
|
-
|
|
655
|
-
}, W = () => {
|
|
656
|
-
if (s.value) {
|
|
657
|
-
const l = s.value.getAnnotations();
|
|
658
|
-
n.batchImages[v.value].annotations = l;
|
|
659
|
-
}
|
|
704
|
+
const at = () => {
|
|
705
|
+
m.value > 0 && (V(), m.value--, $(), E());
|
|
706
|
+
}, lt = () => {
|
|
707
|
+
m.value < s.batchImages.length - 1 && (V(), m.value++, $(), E());
|
|
660
708
|
}, V = () => {
|
|
661
|
-
|
|
709
|
+
if (i.value) {
|
|
710
|
+
const l = i.value.getAnnotations();
|
|
711
|
+
s.batchImages[m.value].annotations = l;
|
|
712
|
+
}
|
|
713
|
+
}, E = () => {
|
|
714
|
+
const l = s.batchImages[m.value];
|
|
662
715
|
a("batchChange", {
|
|
663
|
-
currentIndex:
|
|
664
|
-
total:
|
|
716
|
+
currentIndex: m.value,
|
|
717
|
+
total: s.batchImages.length,
|
|
665
718
|
currentImageUrl: l.imageUrl,
|
|
666
719
|
currentAnnotations: l.annotations || []
|
|
667
720
|
});
|
|
668
721
|
};
|
|
669
722
|
return t({
|
|
670
723
|
jumpTo: (l) => {
|
|
671
|
-
l >= 0 && l <
|
|
724
|
+
l >= 0 && l < s.batchImages.length && (V(), m.value = l, $(), E());
|
|
672
725
|
},
|
|
673
|
-
getAllAnnotations: () =>
|
|
726
|
+
getAllAnnotations: () => s.batchImages,
|
|
674
727
|
getCurrentAnnotation: () => {
|
|
675
728
|
var l;
|
|
676
729
|
return {
|
|
677
|
-
imageUrl:
|
|
678
|
-
annotations: ((l =
|
|
730
|
+
imageUrl: s.batchImages[m.value].imageUrl,
|
|
731
|
+
annotations: ((l = i.value) == null ? void 0 : l.getAnnotations()) || []
|
|
679
732
|
};
|
|
680
733
|
}
|
|
681
|
-
}), (l, c) => {
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
_: 1
|
|
748
|
-
})
|
|
749
|
-
]),
|
|
750
|
-
c[6] || (c[6] = h("div", { class: "divider" }, null, -1)),
|
|
751
|
-
h("div", {
|
|
752
|
-
class: "tool-btn",
|
|
753
|
-
onClick: H,
|
|
754
|
-
title: "删除选中"
|
|
755
|
-
}, [
|
|
756
|
-
b(w, null, {
|
|
757
|
-
default: I(() => [
|
|
758
|
-
b(et)
|
|
759
|
-
]),
|
|
760
|
-
_: 1
|
|
761
|
-
})
|
|
734
|
+
}), (l, c) => (p(), x("div", {
|
|
735
|
+
class: T(["annotation-container", v.theme])
|
|
736
|
+
}, [
|
|
737
|
+
v.readOnly ? H("", !0) : (p(), x("div", Dt, [
|
|
738
|
+
h("div", {
|
|
739
|
+
class: T(["tool-btn", { active: r.value === "pan" }]),
|
|
740
|
+
onClick: c[0] || (c[0] = (g) => O("pan")),
|
|
741
|
+
title: "拖动"
|
|
742
|
+
}, [
|
|
743
|
+
S(k, { name: "rank" })
|
|
744
|
+
], 2),
|
|
745
|
+
h("div", {
|
|
746
|
+
class: T(["tool-btn", { active: r.value === "select" }]),
|
|
747
|
+
onClick: c[1] || (c[1] = (g) => O("select")),
|
|
748
|
+
title: "选择"
|
|
749
|
+
}, [
|
|
750
|
+
S(k, { name: "pointer" })
|
|
751
|
+
], 2),
|
|
752
|
+
c[4] || (c[4] = h("div", { class: "divider" }, null, -1)),
|
|
753
|
+
(p(!0), x(P, null, D(w.value, (g) => (p(), x("div", {
|
|
754
|
+
key: g,
|
|
755
|
+
class: T(["tool-btn", { active: r.value === g }]),
|
|
756
|
+
onClick: (_) => O(g),
|
|
757
|
+
title: I(g)
|
|
758
|
+
}, [
|
|
759
|
+
S(k, {
|
|
760
|
+
name: A(g)
|
|
761
|
+
}, null, 8, ["name"])
|
|
762
|
+
], 10, $t))), 128)),
|
|
763
|
+
c[5] || (c[5] = h("div", { class: "divider" }, null, -1)),
|
|
764
|
+
h("div", {
|
|
765
|
+
class: "tool-btn",
|
|
766
|
+
onClick: Q,
|
|
767
|
+
title: "放大"
|
|
768
|
+
}, [
|
|
769
|
+
S(k, { name: "zoom-in" })
|
|
770
|
+
]),
|
|
771
|
+
h("div", {
|
|
772
|
+
class: "tool-btn",
|
|
773
|
+
onClick: Z,
|
|
774
|
+
title: "缩小"
|
|
775
|
+
}, [
|
|
776
|
+
S(k, { name: "zoom-out" })
|
|
777
|
+
]),
|
|
778
|
+
c[6] || (c[6] = h("div", { class: "divider" }, null, -1)),
|
|
779
|
+
h("div", {
|
|
780
|
+
class: "tool-btn",
|
|
781
|
+
onClick: G,
|
|
782
|
+
title: "删除选中"
|
|
783
|
+
}, [
|
|
784
|
+
S(k, { name: "delete" })
|
|
785
|
+
])
|
|
786
|
+
])),
|
|
787
|
+
h("div", Ut, [
|
|
788
|
+
v.readOnly ? H("", !0) : (p(), x("div", Ft, [
|
|
789
|
+
h("div", Rt, [
|
|
790
|
+
c[7] || (c[7] = h("span", { class: "label-text" }, "当前标签:", -1)),
|
|
791
|
+
h("div", Bt, [
|
|
792
|
+
(p(!0), x(P, null, D(d.value, (g) => (p(), x("div", {
|
|
793
|
+
key: g.id,
|
|
794
|
+
class: T(["tag-chip", { active: u.value === g.id }]),
|
|
795
|
+
style: j({ backgroundColor: g.color, borderColor: g.color }),
|
|
796
|
+
onClick: (_) => U(g)
|
|
797
|
+
}, z(g.name), 15, Ot))), 128)),
|
|
798
|
+
d.value.length === 0 ? (p(), x("div", Vt, "请在右侧创建标签")) : H("", !0)
|
|
799
|
+
])
|
|
762
800
|
])
|
|
763
801
|
])),
|
|
764
|
-
h("div",
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
])),
|
|
779
|
-
h("div", {
|
|
780
|
-
class: "canvas-wrapper",
|
|
781
|
-
ref_key: "canvasWrapper",
|
|
782
|
-
ref: o
|
|
802
|
+
h("div", {
|
|
803
|
+
class: "canvas-wrapper",
|
|
804
|
+
ref_key: "canvasWrapper",
|
|
805
|
+
ref: o
|
|
806
|
+
}, [
|
|
807
|
+
h("canvas", {
|
|
808
|
+
ref_key: "canvasRef",
|
|
809
|
+
ref: n
|
|
810
|
+
}, null, 512)
|
|
811
|
+
], 512),
|
|
812
|
+
v.batchImages && v.batchImages.length > 0 ? (p(), x("div", Et, [
|
|
813
|
+
h("button", {
|
|
814
|
+
onClick: at,
|
|
815
|
+
disabled: m.value <= 0
|
|
783
816
|
}, [
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
onClick: dt,
|
|
805
|
-
disabled: v.value >= u.batchImages.length - 1
|
|
806
|
-
}, [
|
|
807
|
-
c[9] || (c[9] = J(" 下一张 ", -1)),
|
|
808
|
-
b(w, null, {
|
|
809
|
-
default: I(() => [
|
|
810
|
-
b(ft)
|
|
811
|
-
]),
|
|
812
|
-
_: 1
|
|
813
|
-
})
|
|
814
|
-
], 8, Ut)
|
|
815
|
-
])) : L("", !0)
|
|
817
|
+
S(k, { name: "back" }),
|
|
818
|
+
c[8] || (c[8] = F(" 上一张 ", -1))
|
|
819
|
+
], 8, Nt),
|
|
820
|
+
h("span", null, z(m.value + 1) + " / " + z(v.batchImages.length), 1),
|
|
821
|
+
h("button", {
|
|
822
|
+
onClick: lt,
|
|
823
|
+
disabled: m.value >= v.batchImages.length - 1
|
|
824
|
+
}, [
|
|
825
|
+
c[9] || (c[9] = F(" 下一张 ", -1)),
|
|
826
|
+
S(k, { name: "right" })
|
|
827
|
+
], 8, Jt)
|
|
828
|
+
])) : H("", !0)
|
|
829
|
+
]),
|
|
830
|
+
v.readOnly ? H("", !0) : (p(), x("div", Wt, [
|
|
831
|
+
h("div", { class: "sidebar-header" }, [
|
|
832
|
+
c[10] || (c[10] = h("h3", null, "标签管理", -1)),
|
|
833
|
+
h("button", {
|
|
834
|
+
class: "add-btn",
|
|
835
|
+
onClick: tt
|
|
836
|
+
}, "添加标签")
|
|
816
837
|
]),
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
}
|
|
838
|
+
h("div", jt, [
|
|
839
|
+
(p(!0), x(P, null, D(d.value, (g) => (p(), x("div", {
|
|
840
|
+
key: g.id,
|
|
841
|
+
class: "label-item"
|
|
842
|
+
}, [
|
|
843
|
+
h("div", Xt, [
|
|
844
|
+
h("label", {
|
|
845
|
+
class: "color-wrapper",
|
|
846
|
+
style: j({ backgroundColor: g.color })
|
|
847
|
+
}, [
|
|
848
|
+
N(h("input", {
|
|
849
|
+
type: "color",
|
|
850
|
+
"onUpdate:modelValue": (_) => g.color = _,
|
|
851
|
+
onChange: (_) => nt(g),
|
|
852
|
+
style: { visibility: "hidden", width: "0", height: "0" }
|
|
853
|
+
}, null, 40, Yt), [
|
|
854
|
+
[J, g.color]
|
|
855
|
+
])
|
|
856
|
+
], 4),
|
|
857
|
+
h("span", {
|
|
858
|
+
class: "label-name",
|
|
859
|
+
title: g.name
|
|
860
|
+
}, z(g.name), 9, Kt),
|
|
861
|
+
h("span", {
|
|
862
|
+
class: "action-icon eye",
|
|
863
|
+
onClick: (_) => it(g)
|
|
864
|
+
}, [
|
|
865
|
+
g.visible ? (p(), Y(k, {
|
|
866
|
+
key: 0,
|
|
867
|
+
name: "view"
|
|
868
|
+
})) : (p(), Y(k, {
|
|
869
|
+
key: 1,
|
|
870
|
+
name: "hide"
|
|
871
|
+
}))
|
|
872
|
+
], 8, qt),
|
|
873
|
+
h("div", Gt, [
|
|
874
|
+
c[11] || (c[11] = h("span", { class: "dots" }, "•••", -1)),
|
|
848
875
|
h("span", {
|
|
849
|
-
class: "
|
|
850
|
-
onClick: (
|
|
876
|
+
class: "delete-btn",
|
|
877
|
+
onClick: (_) => ot(g.id),
|
|
878
|
+
title: "删除"
|
|
851
879
|
}, [
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
b(yt)
|
|
855
|
-
]),
|
|
856
|
-
_: 1
|
|
857
|
-
})) : (m(), X(w, { key: 1 }, {
|
|
858
|
-
default: I(() => [
|
|
859
|
-
b(mt)
|
|
860
|
-
]),
|
|
861
|
-
_: 1
|
|
862
|
-
}))
|
|
863
|
-
], 8, Nt),
|
|
864
|
-
h("div", Jt, [
|
|
865
|
-
c[11] || (c[11] = h("span", { class: "dots" }, "•••", -1)),
|
|
866
|
-
h("span", {
|
|
867
|
-
class: "delete-btn",
|
|
868
|
-
onClick: (U) => ct(p.id),
|
|
869
|
-
title: "删除"
|
|
870
|
-
}, [
|
|
871
|
-
b(w, null, {
|
|
872
|
-
default: I(() => [
|
|
873
|
-
b(et)
|
|
874
|
-
]),
|
|
875
|
-
_: 1
|
|
876
|
-
})
|
|
877
|
-
], 8, Wt)
|
|
878
|
-
])
|
|
880
|
+
S(k, { name: "delete" })
|
|
881
|
+
], 8, Qt)
|
|
879
882
|
])
|
|
880
|
-
])
|
|
881
|
-
])
|
|
882
|
-
])
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
883
|
+
])
|
|
884
|
+
]))), 128))
|
|
885
|
+
])
|
|
886
|
+
])),
|
|
887
|
+
f.value ? (p(), x("div", Zt, [
|
|
888
|
+
h("div", te, [
|
|
889
|
+
c[14] || (c[14] = h("h3", null, "新增标签", -1)),
|
|
890
|
+
h("div", ee, [
|
|
891
|
+
c[12] || (c[12] = h("label", null, "名称", -1)),
|
|
892
|
+
N(h("input", {
|
|
893
|
+
"onUpdate:modelValue": c[2] || (c[2] = (g) => y.value.name = g),
|
|
894
|
+
placeholder: "请输入标签名称",
|
|
895
|
+
class: "modal-input"
|
|
896
|
+
}, null, 512), [
|
|
897
|
+
[J, y.value.name]
|
|
898
|
+
])
|
|
899
|
+
]),
|
|
900
|
+
h("div", se, [
|
|
901
|
+
c[13] || (c[13] = h("label", null, "颜色", -1)),
|
|
902
|
+
h("div", ne, [
|
|
903
|
+
N(h("input", {
|
|
904
|
+
type: "color",
|
|
905
|
+
"onUpdate:modelValue": c[3] || (c[3] = (g) => y.value.color = g),
|
|
906
|
+
class: "modal-color-picker"
|
|
892
907
|
}, null, 512), [
|
|
893
|
-
[
|
|
894
|
-
])
|
|
895
|
-
|
|
896
|
-
h("div", Yt, [
|
|
897
|
-
c[13] || (c[13] = h("label", null, "颜色", -1)),
|
|
898
|
-
h("div", Zt, [
|
|
899
|
-
j(h("input", {
|
|
900
|
-
type: "color",
|
|
901
|
-
"onUpdate:modelValue": c[3] || (c[3] = (p) => y.value.color = p),
|
|
902
|
-
class: "modal-color-picker"
|
|
903
|
-
}, null, 512), [
|
|
904
|
-
[Y, y.value.color]
|
|
905
|
-
]),
|
|
906
|
-
h("span", null, D(y.value.color), 1)
|
|
907
|
-
])
|
|
908
|
-
]),
|
|
909
|
-
h("div", { class: "modal-actions" }, [
|
|
910
|
-
h("button", {
|
|
911
|
-
onClick: tt,
|
|
912
|
-
class: "cancel-btn"
|
|
913
|
-
}, "取消"),
|
|
914
|
-
h("button", {
|
|
915
|
-
onClick: ot,
|
|
916
|
-
class: "confirm-btn"
|
|
917
|
-
}, "确认")
|
|
908
|
+
[J, y.value.color]
|
|
909
|
+
]),
|
|
910
|
+
h("span", null, z(y.value.color), 1)
|
|
918
911
|
])
|
|
912
|
+
]),
|
|
913
|
+
h("div", { class: "modal-actions" }, [
|
|
914
|
+
h("button", {
|
|
915
|
+
onClick: X,
|
|
916
|
+
class: "cancel-btn"
|
|
917
|
+
}, "取消"),
|
|
918
|
+
h("button", {
|
|
919
|
+
onClick: et,
|
|
920
|
+
class: "confirm-btn"
|
|
921
|
+
}, "确认")
|
|
919
922
|
])
|
|
920
|
-
])
|
|
921
|
-
],
|
|
922
|
-
|
|
923
|
+
])
|
|
924
|
+
])) : H("", !0)
|
|
925
|
+
], 2));
|
|
923
926
|
}
|
|
924
|
-
}),
|
|
925
|
-
const e = u.__vccOpts || u;
|
|
926
|
-
for (const [n, a] of t)
|
|
927
|
-
e[n] = a;
|
|
928
|
-
return e;
|
|
929
|
-
}, qt = /* @__PURE__ */ G(Kt, [["__scopeId", "data-v-d3dc5a63"]]), Gt = {
|
|
927
|
+
}), oe = /* @__PURE__ */ B(ie, [["__scopeId", "data-v-fe1b36c0"]]), ae = {
|
|
930
928
|
class: "thumbnail-wrapper",
|
|
931
929
|
ref: "wrapper"
|
|
932
|
-
},
|
|
930
|
+
}, le = ["src", "alt"], re = ["viewBox"], ce = ["x", "y", "width", "height", "stroke"], he = ["points", "stroke"], ge = ["x", "y", "fill"], de = {
|
|
933
931
|
key: 1,
|
|
934
932
|
class: "loading-placeholder"
|
|
935
|
-
},
|
|
933
|
+
}, ve = /* @__PURE__ */ R({
|
|
936
934
|
__name: "AnnotationThumbnail",
|
|
937
935
|
props: {
|
|
938
936
|
src: {},
|
|
@@ -940,213 +938,195 @@ const St = {
|
|
|
940
938
|
alt: {},
|
|
941
939
|
labels: {}
|
|
942
940
|
},
|
|
943
|
-
setup(
|
|
944
|
-
const t =
|
|
945
|
-
e.value && (a.value = e.value.naturalWidth,
|
|
946
|
-
},
|
|
941
|
+
setup(v) {
|
|
942
|
+
const t = v, e = C(null), s = C(!1), a = C(0), n = C(0), o = () => {
|
|
943
|
+
e.value && (a.value = e.value.naturalWidth, n.value = e.value.naturalHeight, s.value = !0);
|
|
944
|
+
}, i = (u) => {
|
|
947
945
|
var f;
|
|
948
|
-
if ((f =
|
|
946
|
+
if ((f = u.style) != null && f.strokeColor) return u.style.strokeColor;
|
|
949
947
|
if (t.labels) {
|
|
950
|
-
const y = t.labels.find((
|
|
948
|
+
const y = t.labels.find((w) => w.name === u.label);
|
|
951
949
|
if (y) return y.color;
|
|
952
950
|
}
|
|
953
951
|
return "#FF0000";
|
|
954
|
-
}, r = (
|
|
955
|
-
const f =
|
|
956
|
-
return { x: y, y:
|
|
957
|
-
},
|
|
958
|
-
if (
|
|
959
|
-
const f = r(
|
|
952
|
+
}, r = (u) => {
|
|
953
|
+
const f = u.coordinates, y = Math.min(f.x1, f.x2), w = Math.min(f.y1, f.y2), A = Math.abs(f.x1 - f.x2), I = Math.abs(f.y1 - f.y2);
|
|
954
|
+
return { x: y, y: w, width: A, height: I };
|
|
955
|
+
}, m = (u) => u.coordinates.points.map((y) => `${y.x},${y.y}`).join(" "), d = (u) => {
|
|
956
|
+
if (u.type === "rectangle") {
|
|
957
|
+
const f = r(u);
|
|
960
958
|
return { x: f.x, y: f.y - 5 };
|
|
961
|
-
} else if (
|
|
962
|
-
const f =
|
|
959
|
+
} else if (u.type === "polygon") {
|
|
960
|
+
const f = u.coordinates.points;
|
|
963
961
|
if (f.length > 0) return { x: f[0].x, y: f[0].y - 5 };
|
|
964
962
|
}
|
|
965
963
|
return { x: 0, y: 0 };
|
|
966
964
|
};
|
|
967
|
-
return (
|
|
965
|
+
return (u, f) => (p(), x("div", ae, [
|
|
968
966
|
h("img", {
|
|
969
967
|
ref_key: "img",
|
|
970
968
|
ref: e,
|
|
971
|
-
src:
|
|
969
|
+
src: v.src,
|
|
972
970
|
class: "thumbnail-image",
|
|
973
971
|
onLoad: o,
|
|
974
|
-
alt:
|
|
975
|
-
}, null, 40,
|
|
976
|
-
|
|
972
|
+
alt: v.alt
|
|
973
|
+
}, null, 40, le),
|
|
974
|
+
s.value ? (p(), x("svg", {
|
|
977
975
|
key: 0,
|
|
978
976
|
class: "annotation-overlay",
|
|
979
|
-
viewBox: `0 0 ${a.value} ${
|
|
977
|
+
viewBox: `0 0 ${a.value} ${n.value}`,
|
|
980
978
|
preserveAspectRatio: "none"
|
|
981
979
|
}, [
|
|
982
|
-
(
|
|
980
|
+
(p(!0), x(P, null, D(v.annotations, (y) => (p(), x(P, {
|
|
983
981
|
key: y.id
|
|
984
982
|
}, [
|
|
985
|
-
y.type === "rectangle" ? (
|
|
983
|
+
y.type === "rectangle" ? (p(), x("rect", {
|
|
986
984
|
key: 0,
|
|
987
985
|
x: r(y).x,
|
|
988
986
|
y: r(y).y,
|
|
989
987
|
width: r(y).width,
|
|
990
988
|
height: r(y).height,
|
|
991
|
-
stroke:
|
|
989
|
+
stroke: i(y),
|
|
992
990
|
"stroke-width": "2",
|
|
993
991
|
fill: "transparent"
|
|
994
|
-
}, null, 8,
|
|
995
|
-
y.type === "polygon" ? (
|
|
992
|
+
}, null, 8, ce)) : H("", !0),
|
|
993
|
+
y.type === "polygon" ? (p(), x("polygon", {
|
|
996
994
|
key: 1,
|
|
997
|
-
points:
|
|
998
|
-
stroke:
|
|
995
|
+
points: m(y),
|
|
996
|
+
stroke: i(y),
|
|
999
997
|
"stroke-width": "2",
|
|
1000
998
|
fill: "transparent"
|
|
1001
|
-
}, null, 8,
|
|
1002
|
-
y.label ? (
|
|
999
|
+
}, null, 8, he)) : H("", !0),
|
|
1000
|
+
y.label ? (p(), x("text", {
|
|
1003
1001
|
key: 2,
|
|
1004
1002
|
x: d(y).x,
|
|
1005
1003
|
y: d(y).y,
|
|
1006
|
-
fill:
|
|
1004
|
+
fill: i(y),
|
|
1007
1005
|
"font-size": "14",
|
|
1008
1006
|
"font-weight": "bold",
|
|
1009
1007
|
class: "anno-label"
|
|
1010
|
-
},
|
|
1008
|
+
}, z(y.label), 9, ge)) : H("", !0)
|
|
1011
1009
|
], 64))), 128))
|
|
1012
|
-
], 8,
|
|
1010
|
+
], 8, re)) : (p(), x("div", de, "Loading..."))
|
|
1013
1011
|
], 512));
|
|
1014
1012
|
}
|
|
1015
|
-
}),
|
|
1013
|
+
}), ue = /* @__PURE__ */ B(ve, [["__scopeId", "data-v-78bcbe0c"]]), me = { class: "batch-annotator" }, fe = {
|
|
1016
1014
|
key: 0,
|
|
1017
1015
|
class: "gallery-view"
|
|
1018
|
-
},
|
|
1016
|
+
}, ye = { class: "gallery-header" }, pe = { class: "label-summary" }, xe = { class: "gallery-grid" }, be = ["onClick"], we = { class: "thumbnail-wrapper" }, Ce = { class: "img-meta" }, _e = { class: "img-index" }, Ae = { class: "anno-count" }, ke = { class: "bottom-bar" }, Se = {
|
|
1019
1017
|
key: 1,
|
|
1020
1018
|
class: "editor-view"
|
|
1021
|
-
},
|
|
1019
|
+
}, Ie = { class: "editor-header" }, ze = { class: "header-left" }, Me = { class: "editor-title" }, He = { class: "editor-content" }, Le = /* @__PURE__ */ R({
|
|
1022
1020
|
__name: "BatchAnnotator",
|
|
1023
1021
|
props: {
|
|
1024
1022
|
images: {},
|
|
1025
1023
|
labels: {}
|
|
1026
1024
|
},
|
|
1027
1025
|
emits: ["export", "update:images"],
|
|
1028
|
-
setup(
|
|
1029
|
-
const e =
|
|
1030
|
-
|
|
1031
|
-
|
|
1026
|
+
setup(v, { emit: t }) {
|
|
1027
|
+
const e = v, s = t, a = C("gallery"), n = C([]), o = C(0), i = C(null);
|
|
1028
|
+
q(() => e.images, (w) => {
|
|
1029
|
+
n.value = JSON.parse(JSON.stringify(w));
|
|
1032
1030
|
}, { immediate: !0, deep: !0 });
|
|
1033
|
-
const r = (
|
|
1034
|
-
o.value =
|
|
1035
|
-
|
|
1031
|
+
const r = (w) => {
|
|
1032
|
+
o.value = w, a.value = "editor", vt(() => {
|
|
1033
|
+
i.value && i.value.jumpTo && i.value.jumpTo(w);
|
|
1036
1034
|
});
|
|
1037
|
-
},
|
|
1038
|
-
if (
|
|
1039
|
-
const
|
|
1040
|
-
|
|
1035
|
+
}, m = () => {
|
|
1036
|
+
if (i.value && i.value.getCurrentAnnotation) {
|
|
1037
|
+
const w = i.value.getCurrentAnnotation();
|
|
1038
|
+
n.value[o.value] && (n.value[o.value].annotations = w.annotations);
|
|
1041
1039
|
}
|
|
1042
1040
|
a.value = "gallery";
|
|
1043
1041
|
}, d = () => {
|
|
1044
|
-
|
|
1045
|
-
},
|
|
1046
|
-
o.value =
|
|
1047
|
-
}, f = (
|
|
1048
|
-
if (
|
|
1049
|
-
const
|
|
1050
|
-
|
|
1042
|
+
s("export", n.value);
|
|
1043
|
+
}, u = (w) => {
|
|
1044
|
+
o.value = w.currentIndex, n.value[w.currentIndex] && (n.value[w.currentIndex].annotations = w.currentAnnotations);
|
|
1045
|
+
}, f = (w) => {
|
|
1046
|
+
if (i.value && i.value.getCurrentAnnotation) {
|
|
1047
|
+
const A = i.value.getCurrentAnnotation();
|
|
1048
|
+
n.value[o.value] && (n.value[o.value].annotations = A.annotations, s("update:images", n.value));
|
|
1051
1049
|
}
|
|
1052
|
-
}, y = (
|
|
1050
|
+
}, y = (w) => {
|
|
1053
1051
|
};
|
|
1054
|
-
return (
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
h("div",
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1052
|
+
return (w, A) => (p(), x("div", me, [
|
|
1053
|
+
a.value === "gallery" ? (p(), x("div", fe, [
|
|
1054
|
+
h("div", ye, [
|
|
1055
|
+
h("h3", null, "批量查看与标注 (" + z(n.value.length) + " 张)", 1),
|
|
1056
|
+
h("div", pe, [
|
|
1057
|
+
(p(!0), x(P, null, D(v.labels, (I) => (p(), x("span", {
|
|
1058
|
+
key: I.id,
|
|
1059
|
+
class: "label-badge",
|
|
1060
|
+
style: j({ backgroundColor: I.color })
|
|
1061
|
+
}, z(I.name), 5))), 128))
|
|
1062
|
+
])
|
|
1063
|
+
]),
|
|
1064
|
+
h("div", xe, [
|
|
1065
|
+
(p(!0), x(P, null, D(n.value, (I, L) => (p(), x("div", {
|
|
1066
|
+
key: L,
|
|
1067
|
+
class: "gallery-item",
|
|
1068
|
+
onClick: ($) => r(L)
|
|
1069
|
+
}, [
|
|
1070
|
+
h("div", we, [
|
|
1071
|
+
S(ue, {
|
|
1072
|
+
src: I.imageUrl,
|
|
1073
|
+
annotations: I.annotations || [],
|
|
1074
|
+
labels: v.labels
|
|
1075
|
+
}, null, 8, ["src", "annotations", "labels"])
|
|
1076
|
+
]),
|
|
1077
|
+
h("div", Ce, [
|
|
1078
|
+
h("span", _e, "#" + z(L + 1), 1),
|
|
1079
|
+
h("span", Ae, z((I.annotations || []).length) + " 标注", 1)
|
|
1066
1080
|
])
|
|
1081
|
+
], 8, be))), 128))
|
|
1082
|
+
]),
|
|
1083
|
+
h("div", ke, [
|
|
1084
|
+
h("button", {
|
|
1085
|
+
class: "action-btn primary",
|
|
1086
|
+
onClick: A[0] || (A[0] = (I) => r(0))
|
|
1087
|
+
}, [
|
|
1088
|
+
S(k, { name: "edit" }),
|
|
1089
|
+
A[1] || (A[1] = F(" 手动标注 ", -1))
|
|
1067
1090
|
]),
|
|
1068
|
-
h("
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
}, null, 8, ["src", "annotations", "labels"])
|
|
1080
|
-
]),
|
|
1081
|
-
h("div", ve, [
|
|
1082
|
-
h("span", fe, "#" + D(z + 1), 1),
|
|
1083
|
-
h("span", ye, D((H.annotations || []).length) + " 标注", 1)
|
|
1084
|
-
])
|
|
1085
|
-
], 8, ge))), 128))
|
|
1086
|
-
]),
|
|
1087
|
-
h("div", me, [
|
|
1091
|
+
h("button", {
|
|
1092
|
+
class: "action-btn success",
|
|
1093
|
+
onClick: d
|
|
1094
|
+
}, [
|
|
1095
|
+
S(k, { name: "download" }),
|
|
1096
|
+
A[2] || (A[2] = F(" 导出 ", -1))
|
|
1097
|
+
])
|
|
1098
|
+
])
|
|
1099
|
+
])) : (p(), x("div", Se, [
|
|
1100
|
+
h("div", Ie, [
|
|
1101
|
+
h("div", ze, [
|
|
1088
1102
|
h("button", {
|
|
1089
|
-
class: "
|
|
1090
|
-
onClick:
|
|
1103
|
+
class: "back-btn",
|
|
1104
|
+
onClick: m
|
|
1091
1105
|
}, [
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
b(O)
|
|
1095
|
-
]),
|
|
1096
|
-
_: 1
|
|
1097
|
-
}),
|
|
1098
|
-
S[1] || (S[1] = J(" 手动标注 ", -1))
|
|
1106
|
+
S(k, { name: "back" }),
|
|
1107
|
+
A[3] || (A[3] = F(" 返回列表 ", -1))
|
|
1099
1108
|
]),
|
|
1100
|
-
h("
|
|
1101
|
-
class: "action-btn success",
|
|
1102
|
-
onClick: d
|
|
1103
|
-
}, [
|
|
1104
|
-
b(M, null, {
|
|
1105
|
-
default: I(() => [
|
|
1106
|
-
b(R)
|
|
1107
|
-
]),
|
|
1108
|
-
_: 1
|
|
1109
|
-
}),
|
|
1110
|
-
S[2] || (S[2] = J(" 导出 ", -1))
|
|
1111
|
-
])
|
|
1109
|
+
h("span", Me, "正在标注: " + z(o.value + 1) + " / " + z(n.value.length), 1)
|
|
1112
1110
|
])
|
|
1113
|
-
])
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
h("span", Ae, "正在标注: " + D(o.value + 1) + " / " + D(i.value.length), 1)
|
|
1129
|
-
])
|
|
1130
|
-
]),
|
|
1131
|
-
h("div", Ce, [
|
|
1132
|
-
b(qt, {
|
|
1133
|
-
ref_key: "annotatorRef",
|
|
1134
|
-
ref: s,
|
|
1135
|
-
batchImages: i.value,
|
|
1136
|
-
labels: u.labels,
|
|
1137
|
-
annotationTypes: ["rectangle", "polygon", "point", "rotatedRect"],
|
|
1138
|
-
onBatchChange: g,
|
|
1139
|
-
onAnnotationChange: f,
|
|
1140
|
-
onLabelChange: y
|
|
1141
|
-
}, null, 8, ["batchImages", "labels"])
|
|
1142
|
-
])
|
|
1143
|
-
]))
|
|
1144
|
-
]);
|
|
1145
|
-
};
|
|
1111
|
+
]),
|
|
1112
|
+
h("div", He, [
|
|
1113
|
+
S(oe, {
|
|
1114
|
+
ref_key: "annotatorRef",
|
|
1115
|
+
ref: i,
|
|
1116
|
+
batchImages: n.value,
|
|
1117
|
+
labels: v.labels,
|
|
1118
|
+
annotationTypes: ["rectangle", "polygon", "point", "rotatedRect"],
|
|
1119
|
+
onBatchChange: u,
|
|
1120
|
+
onAnnotationChange: f,
|
|
1121
|
+
onLabelChange: y
|
|
1122
|
+
}, null, 8, ["batchImages", "labels"])
|
|
1123
|
+
])
|
|
1124
|
+
]))
|
|
1125
|
+
]));
|
|
1146
1126
|
}
|
|
1147
|
-
}),
|
|
1127
|
+
}), $e = /* @__PURE__ */ B(Le, [["__scopeId", "data-v-87f3e002"]]);
|
|
1148
1128
|
export {
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1129
|
+
$e as BatchAnnotator,
|
|
1130
|
+
oe as ImageAnnotator,
|
|
1131
|
+
$e as default
|
|
1152
1132
|
};
|