next-element-vue 0.3.7 → 0.3.8
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/index.css +1 -1
- package/dist/index.js +141 -56
- package/dist/index.min.js +3 -3
- package/dist/index.umd.js +141 -56
- package/dist/index.umd.min.js +3 -3
- package/dist/packages/components/labelme/index.d.ts +2 -1
- package/dist/packages/components/labelme/src/config.d.ts +21 -0
- package/dist/packages/components/labelme/src/hooks/{canvas-content.d.ts → canvas-content-hook.d.ts} +14 -5
- package/dist/packages/components/labelme/src/index.d.ts +2 -1
- package/dist/packages/components/labelme/src/widgets/canvas-context.d.ts +2 -1
- package/package.json +1 -1
- package/dist/packages/components/labelme/src/hooks/canvas-drag-zoom.d.ts +0 -31
package/dist/index.umd.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* 作 者:huangteng
|
|
4
4
|
* 邮 箱:htengweb@163.com
|
|
5
|
-
* 当前版本:0.3.
|
|
6
|
-
* 发布日期:2024-09-
|
|
5
|
+
* 当前版本:0.3.8 v
|
|
6
|
+
* 发布日期:2024-09-26
|
|
7
7
|
* 地 址:https://www.npmjs.com/package/next-element-vue
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -3808,7 +3808,11 @@
|
|
|
3808
3808
|
const {operationsBtnPlain: operationsBtnPlain, operationsBtnText: operationsBtnText} = options;
|
|
3809
3809
|
return operationsBtnText || operationsBtnPlain;
|
|
3810
3810
|
})), renderContent = () => {
|
|
3811
|
-
const btnText = options.operationsBtnText, btnPlain = options.operationsBtnPlain, btnSize = options.operationsBtnSize
|
|
3811
|
+
const btnText = options.operationsBtnText, btnPlain = options.operationsBtnPlain, btnSize = options.operationsBtnSize, btnCfg = {
|
|
3812
|
+
text: btnText,
|
|
3813
|
+
plain: btnPlain,
|
|
3814
|
+
size: btnSize
|
|
3815
|
+
};
|
|
3812
3816
|
return vue.createVNode(elementPlus.ElTableColumn, {
|
|
3813
3817
|
fixed: "right",
|
|
3814
3818
|
label: t("next.table.operation"),
|
|
@@ -3816,10 +3820,9 @@
|
|
|
3816
3820
|
headerAlign: valueExist(options.operationsHeaderAlign, options.headerAlign),
|
|
3817
3821
|
align: valueExist(options.operationsColumnAlign, options.cellAlign)
|
|
3818
3822
|
}, {
|
|
3819
|
-
default: scoped => vue.createVNode(vue.Fragment, null, [ slots["operation-column-prefix"]?.(
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
size: btnSize
|
|
3823
|
+
default: scoped => vue.createVNode(vue.Fragment, null, [ slots["operation-column-prefix"]?.({
|
|
3824
|
+
scoped: scoped,
|
|
3825
|
+
btn: btnCfg
|
|
3823
3826
|
}), options.editBtn ? vue.createVNode(elementPlus.ElTooltip, {
|
|
3824
3827
|
enterable: !1,
|
|
3825
3828
|
effect: "dark",
|
|
@@ -3899,10 +3902,9 @@
|
|
|
3899
3902
|
}),
|
|
3900
3903
|
default: () => t("next.table.delete")
|
|
3901
3904
|
}) ]
|
|
3902
|
-
}) : null, slots["operation-column-suffix"]?.(
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
size: btnSize
|
|
3905
|
+
}) : null, slots["operation-column-suffix"]?.({
|
|
3906
|
+
scoped: scoped,
|
|
3907
|
+
btn: btnCfg
|
|
3906
3908
|
}) ])
|
|
3907
3909
|
});
|
|
3908
3910
|
};
|
|
@@ -6356,12 +6358,14 @@
|
|
|
6356
6358
|
canvas.width = canvasWidth, scaleOffset.value && (ctx.save(), ctx.translate(scaleOffset.value.x, scaleOffset.value.y),
|
|
6357
6359
|
ctx.scale(scaleOffset.value.scale, scaleOffset.value.scale)), ctx.clearRect(0, 0, canvasWidth, canvasHeight),
|
|
6358
6360
|
ctx.drawImage(image, 0, 0, canvasWidth, canvasHeight);
|
|
6361
|
+
const scale = scaleOffset.value?.scale || 1, fontSize = 14 / scale, fontPadding = 6 / scale, lineWidth = 2 / scale;
|
|
6359
6362
|
for (let i = 0; i < labels.length; i++) {
|
|
6360
6363
|
const rect = labels[i], {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight, type: type} = rect, color = colors$1[type % colors$1.length];
|
|
6361
|
-
if (ctx.font =
|
|
6362
|
-
ctx.strokeRect(startX, startY, rectWidth, rectHeight),
|
|
6364
|
+
if (ctx.font = `bold ${fontSize}px serif`, ctx.textBaseline = "top", ctx.save(),
|
|
6365
|
+
ctx.strokeStyle = color, ctx.lineWidth = lineWidth, ctx.strokeRect(startX, startY, rectWidth, rectHeight),
|
|
6366
|
+
isValueExist(rect.typeName) || isValueExist(rect.type)) {
|
|
6363
6367
|
const text = rect.typeName || rect.type;
|
|
6364
|
-
ctx.fillStyle = color, ctx.fillText(text, startX +
|
|
6368
|
+
ctx.fillStyle = color, ctx.fillText(text, startX + fontPadding, startY + fontPadding);
|
|
6365
6369
|
}
|
|
6366
6370
|
ctx.restore();
|
|
6367
6371
|
}
|
|
@@ -6369,8 +6373,10 @@
|
|
|
6369
6373
|
return updateLabels(), {
|
|
6370
6374
|
updateLabels: updateLabels,
|
|
6371
6375
|
addDrawRect: (rect, color = "#f30635") => {
|
|
6372
|
-
const {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight} = rect;
|
|
6373
|
-
ctx.save()
|
|
6376
|
+
const scale = scaleOffset.value?.scale || 1, {startX: startX, startY: startY, rectWidth: rectWidth, rectHeight: rectHeight} = rect;
|
|
6377
|
+
ctx.save();
|
|
6378
|
+
const lineWidth = 2 / scale;
|
|
6379
|
+
ctx.lineWidth = lineWidth, ctx.strokeStyle = color, ctx.strokeRect(startX, startY, rectWidth, rectHeight),
|
|
6374
6380
|
ctx.restore();
|
|
6375
6381
|
},
|
|
6376
6382
|
hitCanvasLabel: (x, y) => {
|
|
@@ -7025,7 +7031,10 @@
|
|
|
7025
7031
|
}, null) ]) ]);
|
|
7026
7032
|
}
|
|
7027
7033
|
});
|
|
7028
|
-
const NextLabelimg = withInstall(Element$1), NextLabelimgPreview = withInstall(preview), isPointInCircle = (mouseX, mouseY, circleX, circleY, radius) => Math.sqrt(Math.pow(mouseX - circleX, 2) + Math.pow(mouseY - circleY, 2)) < radius, vertexesUnique = vertexes => Array.from(new Set(vertexes.map((item => JSON.stringify(item))))).map((item => JSON.parse(item))),
|
|
7034
|
+
const NextLabelimg = withInstall(Element$1), NextLabelimgPreview = withInstall(preview), isPointInCircle = (mouseX, mouseY, circleX, circleY, radius) => Math.sqrt(Math.pow(mouseX - circleX, 2) + Math.pow(mouseY - circleY, 2)) < radius, vertexesUnique = vertexes => Array.from(new Set(vertexes.map((item => JSON.stringify(item))))).map((item => JSON.parse(item))), vertexesToScale = (vertexes, scaleX, scaleY, isMultiply = !0) => vertexes?.length ? vertexes.map((item => ((vertex, scaleX, scaleY, isMultiply = !0) => {
|
|
7035
|
+
const [x, y] = vertex;
|
|
7036
|
+
return isMultiply ? [ x * scaleX, y * scaleY ] : [ x / scaleX, y / scaleY ];
|
|
7037
|
+
})(item, scaleX, scaleY, isMultiply))) : [], {hexToRgba: hexToRgba} = useChangeColor(), colors = [ "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba272", "#fc8452", "#9a60b4", "#ea7ccc" ];
|
|
7029
7038
|
class CreatePolygonVertexes {
|
|
7030
7039
|
canvas;
|
|
7031
7040
|
ctx;
|
|
@@ -7081,9 +7090,9 @@
|
|
|
7081
7090
|
canvasMouseDblclick(e) {
|
|
7082
7091
|
e.stopPropagation(), this.isDrawing && (this.canvas.style.cursor = "unset", this.mouseOffset.x = e.offsetX,
|
|
7083
7092
|
this.mouseOffset.y = e.offsetY, this.vertexes.push([ e.offsetX, e.offsetY ]), this.vertexes = vertexesUnique(this.vertexes)),
|
|
7084
|
-
this.notifyDestryedListerers(), this.
|
|
7093
|
+
this.notifyDestryedListerers(), this.destroy();
|
|
7085
7094
|
}
|
|
7086
|
-
|
|
7095
|
+
destroy() {
|
|
7087
7096
|
this.isDrawing = !1, this.vertexes = [], this.vertexesObservers = [], this.destroyedObservers = () => {
|
|
7088
7097
|
this.canvas.removeEventListener("click", this.canvasMouseClick);
|
|
7089
7098
|
}, this.canvas.removeEventListener("mousemove", this.canvasMousemove), this.canvas.removeEventListener("dblclick", this.canvasMouseDblclick);
|
|
@@ -7102,11 +7111,18 @@
|
|
|
7102
7111
|
edgeCentreRadius;
|
|
7103
7112
|
pointRecover;
|
|
7104
7113
|
observers=[];
|
|
7114
|
+
editPolygonObserver;
|
|
7105
7115
|
constructor(canvas, ctx) {
|
|
7106
7116
|
this.canvas = canvas, this.ctx = ctx, this.vertexes = [], this.isEditing = !1, this.canClickEvent = !0,
|
|
7107
7117
|
this.isMoveEditing = !1, this.pointVertexIndex = -1, this.pointCentreIndex = -1,
|
|
7108
7118
|
this.vertexRadius = 8, this.edgeCentreRadius = 5, this.pointRecover = [];
|
|
7109
7119
|
}
|
|
7120
|
+
notifyEditPolygonObserver() {
|
|
7121
|
+
this.editPolygonObserver?.(this.vertexes);
|
|
7122
|
+
}
|
|
7123
|
+
onEditPolygon(callback) {
|
|
7124
|
+
this.editPolygonObserver = callback;
|
|
7125
|
+
}
|
|
7110
7126
|
drawPolygonPath(vertexes, mouseX, mouseY) {
|
|
7111
7127
|
const ctx = this.ctx;
|
|
7112
7128
|
if (!vertexes.length) return;
|
|
@@ -7211,7 +7227,7 @@
|
|
|
7211
7227
|
this.pointVertexIndex > -1 && this.vertexes.splice(this.pointVertexIndex, 1, [ x, y ]),
|
|
7212
7228
|
this.pointCentreIndex > -1 && this.vertexes.splice(this.pointCentreIndex, 1, [ x, y ]),
|
|
7213
7229
|
this.isMoveEditing = !1, this.pointVertexIndex = -1, this.pointCentreIndex = -1,
|
|
7214
|
-
this.drawPolygon(this.vertexes), this.notifyObservers();
|
|
7230
|
+
this.drawPolygon(this.vertexes), this.notifyObservers(), this.notifyEditPolygonObserver();
|
|
7215
7231
|
}
|
|
7216
7232
|
canvasMouseClick(e) {
|
|
7217
7233
|
e.stopPropagation();
|
|
@@ -7220,7 +7236,8 @@
|
|
|
7220
7236
|
const i = this.pointInVertexes(x, y);
|
|
7221
7237
|
if (isValueExist(i)) {
|
|
7222
7238
|
if (this.vertexes.length <= 3) return;
|
|
7223
|
-
this.vertexes.splice(i, 1), this.drawPolygon(this.vertexes), this.notifyObservers()
|
|
7239
|
+
this.vertexes.splice(i, 1), this.drawPolygon(this.vertexes), this.notifyObservers(),
|
|
7240
|
+
this.notifyEditPolygonObserver();
|
|
7224
7241
|
}
|
|
7225
7242
|
}
|
|
7226
7243
|
}
|
|
@@ -7231,7 +7248,7 @@
|
|
|
7231
7248
|
this.pointCentreIndex > -1 && this.vertexes.splice(this.pointCentreIndex, 1, [ x, y ]),
|
|
7232
7249
|
this.notifyObservers());
|
|
7233
7250
|
}
|
|
7234
|
-
|
|
7251
|
+
destroy() {
|
|
7235
7252
|
this.vertexes = [], this.observers = [], this.isEditing = !1, this.canvas.removeEventListener("mousedown", this.canvasMousedown),
|
|
7236
7253
|
this.canvas.removeEventListener("mouseup", this.canvasMouseup), this.canvas.removeEventListener("click", this.canvasMouseClick),
|
|
7237
7254
|
this.canvas.removeEventListener("mousemove", this.canvasMousemove);
|
|
@@ -7243,26 +7260,32 @@
|
|
|
7243
7260
|
image;
|
|
7244
7261
|
canvasWidth;
|
|
7245
7262
|
canvasHeight;
|
|
7246
|
-
|
|
7263
|
+
scaleOffset;
|
|
7264
|
+
labels;
|
|
7247
7265
|
scaleX;
|
|
7248
7266
|
scaleY;
|
|
7249
7267
|
editDrawPolygon;
|
|
7250
7268
|
createPolygonVertexes;
|
|
7251
7269
|
editVertexes;
|
|
7252
7270
|
editPolygonObservers=[];
|
|
7271
|
+
drawnPolygonObserver;
|
|
7253
7272
|
constructor(options) {
|
|
7254
|
-
const {canvas: canvas, ctx: ctx, image: image, canvasWidth: canvasWidth, canvasHeight: canvasHeight,
|
|
7273
|
+
const {canvas: canvas, ctx: ctx, image: image, canvasWidth: canvasWidth, canvasHeight: canvasHeight, labels: labels, scaleX: scaleX, scaleY: scaleY, scaleOffset: scaleOffset} = options;
|
|
7255
7274
|
this.canvas = canvas, this.ctx = ctx, this.image = image, this.canvasWidth = canvasWidth,
|
|
7256
|
-
this.canvasHeight = canvasHeight, this.
|
|
7257
|
-
this.scaleY = scaleY || 1, this.editVertexes = [], this.render(),
|
|
7258
|
-
this.
|
|
7275
|
+
this.canvasHeight = canvasHeight, this.scaleOffset = scaleOffset, this.labels = labels || {},
|
|
7276
|
+
this.scaleX = scaleX || 1, this.scaleY = scaleY || 1, this.editVertexes = [], this.render(),
|
|
7277
|
+
this.createPolygonVertexes = new CreatePolygonVertexes(canvas, ctx), this.editDrawPolygon = new EditPolygonPath(canvas, ctx),
|
|
7278
|
+
this.createPolygonVertexes.vertexesChangeEventListener(((vertexes, mouseOffset) => {
|
|
7259
7279
|
this.render(), this.editDrawPolygon.drawPolygon(vertexes, mouseOffset), this.editVertexes = vertexes,
|
|
7260
7280
|
this.notifyObservers();
|
|
7261
7281
|
})), this.createPolygonVertexes.onDestroyed((vertexes => {
|
|
7262
|
-
this.render(), this.editDrawPolygon.drawPolygon(vertexes),
|
|
7282
|
+
this.editVertexes = vertexes, this.render(), this.editDrawPolygon.drawPolygon(vertexes),
|
|
7283
|
+
this.editDrawPolygon.updatePolygon((vertexes => {
|
|
7263
7284
|
this.render(), this.editDrawPolygon.drawPolygon(vertexes), this.editVertexes = vertexes,
|
|
7264
7285
|
this.notifyObservers();
|
|
7265
|
-
}))
|
|
7286
|
+
})), this.editDrawPolygon.onEditPolygon((vertexes => {
|
|
7287
|
+
this.editVertexes = vertexes, this.notifyDrawnPolygonObservers();
|
|
7288
|
+
})), this.notifyDrawnPolygonObservers();
|
|
7266
7289
|
}));
|
|
7267
7290
|
}
|
|
7268
7291
|
notifyObservers() {
|
|
@@ -7270,17 +7293,22 @@
|
|
|
7270
7293
|
listener(this.editVertexes);
|
|
7271
7294
|
}));
|
|
7272
7295
|
}
|
|
7296
|
+
notifyDrawnPolygonObservers() {
|
|
7297
|
+
this.drawnPolygonObserver?.(this.editVertexes);
|
|
7298
|
+
}
|
|
7273
7299
|
updatePolygon(callback) {
|
|
7274
7300
|
this.editPolygonObservers.push(callback);
|
|
7275
7301
|
}
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7302
|
+
onDrawnPolygon(callback) {
|
|
7303
|
+
this.drawnPolygonObserver = callback;
|
|
7304
|
+
}
|
|
7305
|
+
drawPolygons(shapes) {
|
|
7306
|
+
const ctx = this.ctx, {scale: scale} = this.scaleOffset.value, scaleX = this.scaleX, scaleY = this.scaleY;
|
|
7307
|
+
for (let i = 0; i < shapes.length; i++) {
|
|
7308
|
+
const item = shapes[i], path = vertexesToScale(item.points, scaleX, scaleY);
|
|
7281
7309
|
if (!path.length) return;
|
|
7282
7310
|
const color = colors[i % colors.length];
|
|
7283
|
-
ctx.beginPath(), ctx.lineWidth = 2, ctx.strokeStyle = color, ctx.fillStyle = hexToRgba(color, .2);
|
|
7311
|
+
ctx.beginPath(), ctx.lineWidth = 2 / scale, ctx.strokeStyle = color, ctx.fillStyle = hexToRgba(color, .2);
|
|
7284
7312
|
const startX = path[0][0], startY = path[0][1];
|
|
7285
7313
|
ctx.moveTo(startX, startY);
|
|
7286
7314
|
for (let i = 1; i < path.length; i++) {
|
|
@@ -7290,15 +7318,18 @@
|
|
|
7290
7318
|
ctx.closePath(), ctx.stroke(), ctx.fill();
|
|
7291
7319
|
}
|
|
7292
7320
|
}
|
|
7293
|
-
|
|
7321
|
+
drawCanvas=() => {
|
|
7294
7322
|
this.ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight), this.ctx.drawImage(this.image, 0, 0, this.canvasWidth, this.canvasHeight),
|
|
7295
|
-
this.ctx.save()
|
|
7323
|
+
this.ctx.save();
|
|
7324
|
+
const shapes = this.labels.shapes;
|
|
7325
|
+
this.drawPolygons(shapes), this.ctx.restore();
|
|
7296
7326
|
};
|
|
7297
7327
|
render=() => {
|
|
7298
|
-
this.
|
|
7328
|
+
this.canvas.width = this.canvasWidth, this.scaleOffset.value && (this.ctx.translate(this.scaleOffset.value.x, this.scaleOffset.value.y),
|
|
7329
|
+
this.ctx.scale(this.scaleOffset.value.scale, this.scaleOffset.value.scale)), this.drawCanvas();
|
|
7299
7330
|
};
|
|
7300
|
-
|
|
7301
|
-
this.
|
|
7331
|
+
destroy() {
|
|
7332
|
+
this.labels = {}, this.editDrawPolygon.destroy(), this.createPolygonVertexes.destroy();
|
|
7302
7333
|
}
|
|
7303
7334
|
}
|
|
7304
7335
|
var CanvasContext = vue.defineComponent({
|
|
@@ -7316,9 +7347,9 @@
|
|
|
7316
7347
|
default: () => ({})
|
|
7317
7348
|
}
|
|
7318
7349
|
},
|
|
7319
|
-
emits: [ "editPolygon" ],
|
|
7350
|
+
emits: [ "editPolygon", "changePolygon" ],
|
|
7320
7351
|
setup(props, {emit: emit, expose: expose}) {
|
|
7321
|
-
const ns = vue.inject("ns", {}), mainBasaeRef = vue.ref(), canvasMainRef = vue.ref(), canvasBaseRef = vue.ref(), drawCanvas = vue.ref(), setContainerWidthHeight = (canvasWidth, canvasHeight) => {
|
|
7352
|
+
const ns = vue.inject("ns", {}), scaleTranslateManager = vue.inject("scaleTranslateManager", {}), mainBasaeRef = vue.ref(), canvasMainRef = vue.ref(), canvasBaseRef = vue.ref(), drawCanvas = vue.ref(), canvasDragZoom = vue.ref(), setContainerWidthHeight = (canvasWidth, canvasHeight) => {
|
|
7322
7353
|
canvasMainRef.value.style.width = canvasWidth + "px", canvasMainRef.value.style.height = canvasHeight + "px",
|
|
7323
7354
|
canvasBaseRef.value.width = canvasWidth, canvasBaseRef.value.height = canvasHeight,
|
|
7324
7355
|
canvasBaseRef.value.style.width = canvasWidth + "px", canvasBaseRef.value.style.height = canvasHeight + "px";
|
|
@@ -7328,7 +7359,7 @@
|
|
|
7328
7359
|
const image = new Image;
|
|
7329
7360
|
image.src = rowInfo.imageSrc, loadingImage.value = !0, image.onload = () => {
|
|
7330
7361
|
loadingImage.value = !1;
|
|
7331
|
-
const {canvasWidth: canvasWidth, canvasHeight: canvasHeight, scaleFactor: scaleFactor, scaleX: scaleX, scaleY: scaleY} = (image => {
|
|
7362
|
+
const {canvasWidth: canvasWidth, canvasHeight: canvasHeight, scaleFactor: scaleFactor, scaleX: scaleX, scaleY: scaleY, originWidth: originWidth, originHeight: originHeight} = (image => {
|
|
7332
7363
|
const clientWidth = mainBasaeRef.value?.elementInstance.clientWidth, clientHeight = mainBasaeRef.value?.elementInstance.clientHeight;
|
|
7333
7364
|
let {width: width, height: height} = image, scaleFactor = 1;
|
|
7334
7365
|
const aspect_ratio = width / height;
|
|
@@ -7348,7 +7379,9 @@
|
|
|
7348
7379
|
canvasHeight: canvasHeight,
|
|
7349
7380
|
scaleFactor: scaleFactor,
|
|
7350
7381
|
scaleX: Number(scaleX),
|
|
7351
|
-
scaleY: Number(scaleY)
|
|
7382
|
+
scaleY: Number(scaleY),
|
|
7383
|
+
originWidth: image.width,
|
|
7384
|
+
originHeight: image.height
|
|
7352
7385
|
};
|
|
7353
7386
|
})(image);
|
|
7354
7387
|
image.style.width = canvasWidth + "px", image.style.height = canvasHeight + "px",
|
|
@@ -7359,15 +7392,25 @@
|
|
|
7359
7392
|
canvasWidth: canvasWidth,
|
|
7360
7393
|
canvasHeight: canvasHeight,
|
|
7361
7394
|
scaleFactor: scaleFactor,
|
|
7362
|
-
|
|
7395
|
+
labels: rowInfo.labels,
|
|
7363
7396
|
scaleX: scaleX,
|
|
7364
|
-
scaleY: scaleY
|
|
7397
|
+
scaleY: scaleY,
|
|
7398
|
+
scaleOffset: scaleTranslateManager.scaleTranslate
|
|
7365
7399
|
}), drawCanvas.value.updatePolygon((vertexes => {
|
|
7366
|
-
emit("
|
|
7400
|
+
emit("changePolygon", {
|
|
7367
7401
|
vertexes: vertexes,
|
|
7368
7402
|
canvasWidth: canvasWidth,
|
|
7369
7403
|
canvasHeight: canvasHeight
|
|
7370
7404
|
});
|
|
7405
|
+
})), drawCanvas.value.onDrawnPolygon((vertexes => {
|
|
7406
|
+
const new_vertexes = vertexesToScale(vertexes, scaleX, scaleY, !1);
|
|
7407
|
+
emit("editPolygon", {
|
|
7408
|
+
vertexes: new_vertexes,
|
|
7409
|
+
originWidth: originWidth,
|
|
7410
|
+
originHeight: originHeight
|
|
7411
|
+
});
|
|
7412
|
+
})), canvasDragZoom.value = new CanvasSceneDragZoom(canvasBaseRef.value), canvasDragZoom.value.changeZoom((scaleOffset => {
|
|
7413
|
+
scaleTranslateManager.onChangeScaleTranslate(scaleOffset), drawCanvas.value.render();
|
|
7371
7414
|
}));
|
|
7372
7415
|
}, image.onerror = () => {
|
|
7373
7416
|
loadingImage.value = !1;
|
|
@@ -7388,6 +7431,8 @@
|
|
|
7388
7431
|
renderImageLabel(rowInfo);
|
|
7389
7432
|
}
|
|
7390
7433
|
}));
|
|
7434
|
+
})), vue.onUnmounted((() => {
|
|
7435
|
+
drawCanvas.value.destroy(), canvasDragZoom.value.destroy();
|
|
7391
7436
|
}));
|
|
7392
7437
|
return expose({
|
|
7393
7438
|
rerenderImage: () => {
|
|
@@ -7395,6 +7440,9 @@
|
|
|
7395
7440
|
const rowInfo = vue.toRaw(props.rowInfo);
|
|
7396
7441
|
renderImageLabel(rowInfo);
|
|
7397
7442
|
}));
|
|
7443
|
+
},
|
|
7444
|
+
resetScaleOffset: () => {
|
|
7445
|
+
canvasDragZoom.value.reset();
|
|
7398
7446
|
}
|
|
7399
7447
|
}), () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(NextSpinLoading, {
|
|
7400
7448
|
ref: mainBasaeRef,
|
|
@@ -7430,7 +7478,7 @@
|
|
|
7430
7478
|
},
|
|
7431
7479
|
emits: [ "fullscreen", "save" ],
|
|
7432
7480
|
setup(props, {emit: emit}) {
|
|
7433
|
-
const _ns = vue.inject("ns", {}), {t: t} = useLocale(), switchFillscreen = val => {
|
|
7481
|
+
const _ns = vue.inject("ns", {}), scaleTranslateManager = vue.inject("scaleTranslateManager", {}), scaleTranslate = scaleTranslateManager.scaleTranslate, {t: t} = useLocale(), switchFillscreen = val => {
|
|
7434
7482
|
emit("fullscreen", val), document.body.style.overflow = val ? "hidden" : "auto";
|
|
7435
7483
|
};
|
|
7436
7484
|
return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode(vue.Fragment, null, [ vue.createVNode("ul", {
|
|
@@ -7511,7 +7559,28 @@
|
|
|
7511
7559
|
class: "label-text"
|
|
7512
7560
|
}, [ t("next.labelme.deletePolyton") ]) ]) ]), vue.createVNode("ul", {
|
|
7513
7561
|
class: [ _ns.be("header", "tool") ]
|
|
7514
|
-
}, [
|
|
7562
|
+
}, [ vue.createVNode("li", {
|
|
7563
|
+
class: "hover",
|
|
7564
|
+
onClick: () => scaleTranslateManager.onResetScaleTranslate()
|
|
7565
|
+
}, [ vue.createVNode("svg", {
|
|
7566
|
+
t: "1725840994827",
|
|
7567
|
+
class: "icon",
|
|
7568
|
+
viewBox: "0 0 1024 1024",
|
|
7569
|
+
version: "1.1",
|
|
7570
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7571
|
+
"p-id": "6051",
|
|
7572
|
+
width: "18",
|
|
7573
|
+
height: "18"
|
|
7574
|
+
}, [ vue.createVNode("path", {
|
|
7575
|
+
d: "M322.794667 445.205333a34.133333 34.133333 0 0 1 2.218666 45.824l-2.218666 2.432a34.133333 34.133333 0 0 1-45.824 2.218667l-2.432-2.218667-149.333334-149.333333a34.133333 34.133333 0 0 1-2.218666-45.824l2.218666-2.432 149.333334-149.333333a34.133333 34.133333 0 0 1 50.474666 45.824l-2.218666 2.432-91.050667 91.050666L640 285.866667c160.234667 0 290.133333 129.898667 290.133333 290.133333 0 158.016-126.314667 286.506667-283.477333 290.048L640 866.133333H234.666667a34.133333 34.133333 0 0 1-3.114667-68.117333L234.666667 797.866667h405.333333c122.538667 0 221.866667-99.328 221.866667-221.866667 0-120.533333-96.106667-218.602667-215.850667-221.781333L640 354.133333l-408.256-0.021333 91.050667 91.093333z",
|
|
7576
|
+
"p-id": "6052"
|
|
7577
|
+
}, null) ]), vue.createVNode("span", {
|
|
7578
|
+
style: "padding-left: 3px"
|
|
7579
|
+
}, [ t("next.labelimg.zoomRestore") ]) ]), vue.createVNode("li", null, [ vue.createVNode("span", null, [ vue.createTextVNode("缩放比例") ]), vue.createVNode("span", null, [ parseInt((100 * scaleTranslate.value.scale).toString()), vue.createTextVNode("%") ]), vue.createVNode("span", {
|
|
7580
|
+
style: "padding: 0 10px;"
|
|
7581
|
+
}, [ vue.createTextVNode("偏移量") ]), vue.createVNode("span", {
|
|
7582
|
+
style: "min-width: 120px; text-align: left;"
|
|
7583
|
+
}, [ vue.createTextVNode("X: "), scaleTranslate.value.x, vue.createTextVNode(", Y: "), scaleTranslate.value.y ]) ]), props.imageLength ? vue.createVNode("li", null, [ vue.createVNode("span", null, [ vue.createTextVNode("第 "), props.imageIndex + 1, vue.createTextVNode(" 张") ]), vue.createVNode("em", {
|
|
7515
7584
|
style: "padding: 0 5px;"
|
|
7516
7585
|
}, [ vue.createTextVNode("/") ]), vue.createVNode("span", null, [ vue.createTextVNode("共 "), props.imageLength, vue.createTextVNode(" 张") ]) ]) : null, vue.createVNode("li", {
|
|
7517
7586
|
style: "margin-right: 30px;",
|
|
@@ -7603,7 +7672,7 @@
|
|
|
7603
7672
|
default: () => []
|
|
7604
7673
|
}
|
|
7605
7674
|
},
|
|
7606
|
-
emits: [ "change", "save", "edit-polygon", "prev-click", "next-click" ],
|
|
7675
|
+
emits: [ "change", "save", "edit-polygon", "change-polygon", "prev-click", "next-click" ],
|
|
7607
7676
|
setup(props, {emit: emit, slots: slots}) {
|
|
7608
7677
|
const _config = deepClone(defaultConfig), _options = vue.computed((() => {
|
|
7609
7678
|
const cfg = vue.unref(props.options);
|
|
@@ -7663,14 +7732,29 @@
|
|
|
7663
7732
|
isFullscreen.value = val, updateMainContentHeight(), vue.nextTick((() => {
|
|
7664
7733
|
canvasContextRef.value.rerenderImage();
|
|
7665
7734
|
}));
|
|
7666
|
-
},
|
|
7667
|
-
currentNode.value.labels =
|
|
7735
|
+
}, onChangePolygon = node => {
|
|
7736
|
+
currentNode.value.labels = node, emit("change-polygon", node);
|
|
7737
|
+
}, onEditPlygon = node => {
|
|
7738
|
+
currentNode.value.labels = node, emit("edit-polygon", node);
|
|
7668
7739
|
}, onToolHeaderSave = () => {
|
|
7669
7740
|
onChangeActivateNode(activateNodeIndex.value) || elementPlus.ElMessage({
|
|
7670
7741
|
type: "info",
|
|
7671
7742
|
message: t("next.labelimg.labelNoUpdate")
|
|
7672
7743
|
});
|
|
7673
|
-
}
|
|
7744
|
+
}, scaleTranslate = vue.ref({
|
|
7745
|
+
scale: 1,
|
|
7746
|
+
x: 0,
|
|
7747
|
+
y: 0
|
|
7748
|
+
});
|
|
7749
|
+
vue.provide("scaleTranslateManager", {
|
|
7750
|
+
scaleTranslate: scaleTranslate,
|
|
7751
|
+
onChangeScaleTranslate: val => {
|
|
7752
|
+
scaleTranslate.value = val;
|
|
7753
|
+
},
|
|
7754
|
+
onResetScaleTranslate: () => {
|
|
7755
|
+
canvasContextRef.value.resetScaleOffset();
|
|
7756
|
+
}
|
|
7757
|
+
});
|
|
7674
7758
|
return () => vue.createVNode(vue.Fragment, null, [ vue.createVNode("div", {
|
|
7675
7759
|
ref: layoutLabelRef,
|
|
7676
7760
|
class: [ ns.b(), props.className, isFullscreen.value ? ns.b("fullscreen") : "" ],
|
|
@@ -7703,7 +7787,8 @@
|
|
|
7703
7787
|
}, [ vue.createVNode(CanvasContext, {
|
|
7704
7788
|
ref: canvasContextRef,
|
|
7705
7789
|
rowInfo: currentNode.value,
|
|
7706
|
-
onEditPolygon:
|
|
7790
|
+
onEditPolygon: onEditPlygon,
|
|
7791
|
+
onChangePolygon: onChangePolygon
|
|
7707
7792
|
}, null) ]) ]), vue.createVNode("footer", {
|
|
7708
7793
|
ref: footerRef,
|
|
7709
7794
|
class: [ ns.b("footer") ]
|
|
@@ -7809,7 +7894,7 @@
|
|
|
7809
7894
|
})(app);
|
|
7810
7895
|
};
|
|
7811
7896
|
var index = {
|
|
7812
|
-
version: "0.3.
|
|
7897
|
+
version: "0.3.8",
|
|
7813
7898
|
install: install
|
|
7814
7899
|
};
|
|
7815
7900
|
exports.NextContainer = NextContainer, exports.NextCrudTable = NextCrudTable, exports.NextCrudTableVirtualized = NextCrudTableVirtualized,
|
|
@@ -7856,7 +7941,7 @@
|
|
|
7856
7941
|
}), exports.useGetDerivedNamespace = useGetDerivedNamespace, exports.useLanguage = (locale, lang) => {
|
|
7857
7942
|
const localeRef = vue.isRef(locale) ? locale : vue.ref(locale), nextLang = localeLang[lang] || localeLang["zh-cn"];
|
|
7858
7943
|
localeRef.value.name = lang, localeRef.value.next = nextLang.next;
|
|
7859
|
-
}, exports.useLocale = useLocale, exports.useNamespace = useNamespace, exports.version = "0.3.
|
|
7944
|
+
}, exports.useLocale = useLocale, exports.useNamespace = useNamespace, exports.version = "0.3.8",
|
|
7860
7945
|
Object.defineProperty(exports, "__esModule", {
|
|
7861
7946
|
value: !0
|
|
7862
7947
|
});
|