next-element-vue 0.6.3 → 0.6.5
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 +3 -3
- package/dist/packages/components/labelme/src/config.d.ts +4 -2
- package/dist/packages/components/labelme/src/core/CreateCircle.d.ts +29 -0
- package/dist/packages/components/labelme/src/core/CreateKeypoint.d.ts +21 -0
- package/dist/packages/components/labelme/src/core/EditCircle.d.ts +34 -0
- package/dist/packages/components/labelme/src/core/EditKeypoint.d.ts +29 -0
- package/dist/packages/components/labelme/src/core/EditPolygon.d.ts +5 -1
- package/dist/packages/components/labelme/src/core/EditRectangle.d.ts +4 -0
- package/dist/packages/components/labelme/src/core/utils.d.ts +18 -0
- package/dist/packages/components/labelme/src/hooks/canvas-content-hook.d.ts +15 -2
- package/dist/packages/components/labelme/src/widgets/canvas-context.d.ts +2 -1
- package/dist/packages/components/labelme/src/widgets/right-label.d.ts +2 -1
- package/dist/packages/hooks/use-locale/index.d.ts +3 -0
- package/dist/packages/locale/lang/en.d.ts +1 -0
- package/dist/packages/locale/lang/zh-cn.d.ts +1 -0
- package/dist/packages/locale/lang/zh-tw.d.ts +1 -0
- package/package.json +1 -1
|
@@ -2,13 +2,15 @@ import type { Ref } from 'vue';
|
|
|
2
2
|
export declare enum ShapeType {
|
|
3
3
|
Polygon = "polygon",
|
|
4
4
|
Rectangle = "rectangle",
|
|
5
|
-
Circle = "circle"
|
|
5
|
+
Circle = "circle",
|
|
6
|
+
Keypoint = "keypoint"
|
|
6
7
|
}
|
|
7
8
|
export declare enum ToolsHandleType {
|
|
8
9
|
CREATE_POLYGON = "createPolygon",
|
|
9
10
|
EDIT_SHAPE = "editShape",
|
|
10
11
|
CREATE_RECTANGLE = "createRectangle",
|
|
11
|
-
CREATE_CIRCLE = "createCircle"
|
|
12
|
+
CREATE_CIRCLE = "createCircle",
|
|
13
|
+
CREATE_KEYPOINT = "createKeypoint"
|
|
12
14
|
}
|
|
13
15
|
export interface ScaleTranslate {
|
|
14
16
|
scale: number;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export default class CreateCircle {
|
|
2
|
+
canvas: HTMLCanvasElement;
|
|
3
|
+
ctx: CanvasRenderingContext2D;
|
|
4
|
+
private isDrawing;
|
|
5
|
+
private mouseOffset;
|
|
6
|
+
vertexes: [number, number][];
|
|
7
|
+
private vertexesObservers;
|
|
8
|
+
private drawCompleteCallback;
|
|
9
|
+
constructor(canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D);
|
|
10
|
+
subscribeVertexesChange(listener: (vertexes: [number, number][], mouseOffset: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
}) => void): void;
|
|
14
|
+
private notifyVertexesChange;
|
|
15
|
+
subscribeDrawComplete(callback: (vertexes: [number, number][], mouseOffset: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
}) => void): void;
|
|
19
|
+
private notifyDrawComplete;
|
|
20
|
+
private transformMousePoint;
|
|
21
|
+
start(): void;
|
|
22
|
+
reset(): void;
|
|
23
|
+
stop(): void;
|
|
24
|
+
private canvasMouseDown;
|
|
25
|
+
private canvasMouseMove;
|
|
26
|
+
private canvasMouseUp;
|
|
27
|
+
drawCircle(vertexes: [number, number][]): void;
|
|
28
|
+
destroy(): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default class CreateKeypoint {
|
|
2
|
+
canvas: HTMLCanvasElement;
|
|
3
|
+
ctx: CanvasRenderingContext2D;
|
|
4
|
+
private mouseOffset;
|
|
5
|
+
vertexes: [number, number][];
|
|
6
|
+
private drawCompleteCallback;
|
|
7
|
+
constructor(canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D);
|
|
8
|
+
subscribeDrawComplete(callback: (vertexes: [number, number][], mouseOffset: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
}) => void): void;
|
|
12
|
+
private notifyDrawComplete;
|
|
13
|
+
private transformMousePoint;
|
|
14
|
+
start(): void;
|
|
15
|
+
stop(): void;
|
|
16
|
+
reset(): void;
|
|
17
|
+
private canvasMouseClick;
|
|
18
|
+
draw(vertexes: [number, number][]): void;
|
|
19
|
+
render(): void;
|
|
20
|
+
destroy(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ShapesProps } from '../config';
|
|
2
|
+
export default class EditCircle {
|
|
3
|
+
canvas: HTMLCanvasElement;
|
|
4
|
+
ctx: CanvasRenderingContext2D;
|
|
5
|
+
shape: ShapesProps;
|
|
6
|
+
private anchorRadius;
|
|
7
|
+
private anchorVertexIndex;
|
|
8
|
+
private isMoveEditing;
|
|
9
|
+
private mouseMoveOffset;
|
|
10
|
+
private isEditing;
|
|
11
|
+
private vertexes;
|
|
12
|
+
private editingObservers;
|
|
13
|
+
private editedObserver?;
|
|
14
|
+
private contextmenuObserver?;
|
|
15
|
+
constructor(canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D);
|
|
16
|
+
onEditing(observer: (vertexes: [number, number][]) => void): void;
|
|
17
|
+
offEditing(observer: (vertexes: [number, number][]) => void): void;
|
|
18
|
+
private notifyEditing;
|
|
19
|
+
onEditCompleted(callback: (vertexes: [number, number][]) => void): void;
|
|
20
|
+
private notifyEditCompleted;
|
|
21
|
+
onContextmenu(callback: (e: MouseEvent) => void): void;
|
|
22
|
+
private notifyContextmenuObserver;
|
|
23
|
+
private getTransformPoint;
|
|
24
|
+
drawCircle(vertexes: [number, number][]): void;
|
|
25
|
+
private drawVertexAnchors;
|
|
26
|
+
private pointInVertexAnchors;
|
|
27
|
+
private updateCanvasCursor;
|
|
28
|
+
private canvasMouseDown;
|
|
29
|
+
private canvasMouseMove;
|
|
30
|
+
private canvasMouseUp;
|
|
31
|
+
private canvasMouseContextmenu;
|
|
32
|
+
render(): void;
|
|
33
|
+
destroy(): void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ShapesProps } from '../config';
|
|
2
|
+
export default class EditKeypoint {
|
|
3
|
+
canvas: HTMLCanvasElement;
|
|
4
|
+
ctx: CanvasRenderingContext2D;
|
|
5
|
+
shape: ShapesProps;
|
|
6
|
+
radius: number;
|
|
7
|
+
private isMoveEditing;
|
|
8
|
+
private mouseMoveOffset;
|
|
9
|
+
private isEditing;
|
|
10
|
+
private vertexes;
|
|
11
|
+
private editingObservers;
|
|
12
|
+
private editedObserver?;
|
|
13
|
+
private contextmenuObserver?;
|
|
14
|
+
constructor(canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D);
|
|
15
|
+
onEditing(observer: (vertexes: [number, number][]) => void): void;
|
|
16
|
+
private notifyEditing;
|
|
17
|
+
onEditCompleted(callback: (vertexes: [number, number][]) => void): void;
|
|
18
|
+
private notifyEditCompleted;
|
|
19
|
+
onContextmenu(callback: (e: MouseEvent) => void): void;
|
|
20
|
+
private notifyContextmenuObserver;
|
|
21
|
+
private getTransformPoint;
|
|
22
|
+
private canvasMouseDown;
|
|
23
|
+
private canvasMouseMove;
|
|
24
|
+
private canvasMouseUp;
|
|
25
|
+
private canvasMouseContextmenu;
|
|
26
|
+
draw(vertexes: [number, number][]): void;
|
|
27
|
+
render(): void;
|
|
28
|
+
destroy(): void;
|
|
29
|
+
}
|
|
@@ -15,9 +15,12 @@ export default class EditPolygon {
|
|
|
15
15
|
private pointRecover;
|
|
16
16
|
private observers;
|
|
17
17
|
private editPolygonObserver?;
|
|
18
|
+
private contextmenuObserver?;
|
|
18
19
|
constructor(canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D, imageScaleX: number, imageScaleY: number);
|
|
19
20
|
private notifyEditPolygonObserver;
|
|
20
21
|
onEditPolygon(callback: (vertexes: [number, number][]) => void): void;
|
|
22
|
+
onContextmenu(callback: (e: MouseEvent) => void): void;
|
|
23
|
+
private notifyContextmenuObserver;
|
|
21
24
|
private getTransformPoint;
|
|
22
25
|
drawPolygonPath(vertexes: [number, number][], mouseX?: number, mouseY?: number): void;
|
|
23
26
|
drawPolygonEdgeCentre(vertexes: [number, number][]): void;
|
|
@@ -33,8 +36,9 @@ export default class EditPolygon {
|
|
|
33
36
|
private notifyObservers;
|
|
34
37
|
updatePolygon(callback: (vertexes: [number, number][]) => void): void;
|
|
35
38
|
canvasMousedown(e: MouseEvent): void;
|
|
36
|
-
canvasMouseup(e: MouseEvent): void;
|
|
37
39
|
canvasMousemove(e: MouseEvent): void;
|
|
40
|
+
canvasMouseup(e: MouseEvent): void;
|
|
38
41
|
canvasMouseClick(e: MouseEvent): void;
|
|
42
|
+
canvasMouseContextmenu(e: MouseEvent): void;
|
|
39
43
|
destroy(): void;
|
|
40
44
|
}
|
|
@@ -11,12 +11,15 @@ export default class EditRectangle {
|
|
|
11
11
|
private vertexes;
|
|
12
12
|
private editingObservers;
|
|
13
13
|
private editedObserver?;
|
|
14
|
+
private contextmenuObserver?;
|
|
14
15
|
constructor(canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D);
|
|
15
16
|
onEditing(observer: (vertexes: [number, number][]) => void): void;
|
|
16
17
|
offEditing(observer: (vertexes: [number, number][]) => void): void;
|
|
17
18
|
private notifyEditing;
|
|
18
19
|
onEditCompleted(callback: (vertexes: [number, number][]) => void): void;
|
|
19
20
|
private notifyEditCompleted;
|
|
21
|
+
onContextmenu(callback: (e: MouseEvent) => void): void;
|
|
22
|
+
private notifyContextmenuObserver;
|
|
20
23
|
private getTransformPoint;
|
|
21
24
|
drawRectangle(vertexes: [number, number][]): void;
|
|
22
25
|
private drawVertexAnchors;
|
|
@@ -26,6 +29,7 @@ export default class EditRectangle {
|
|
|
26
29
|
private canvasMouseMove;
|
|
27
30
|
private canvasMouseUp;
|
|
28
31
|
private canvasMouseClick;
|
|
32
|
+
private canvasMouseContextmenu;
|
|
29
33
|
render(): void;
|
|
30
34
|
destroy(): void;
|
|
31
35
|
}
|
|
@@ -23,6 +23,24 @@ export declare const isPointInPath: (px: number, py: number, vertexes: [number,
|
|
|
23
23
|
* @returns
|
|
24
24
|
*/
|
|
25
25
|
export declare const isPointInRectangle: (px: number, py: number, vertexes: [number, number][], ctx: CanvasRenderingContext2D) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* 点是否在图形圆内
|
|
28
|
+
* @param px 鼠标x坐标
|
|
29
|
+
* @param py 鼠标y坐标
|
|
30
|
+
* @param vertexes 点位数据
|
|
31
|
+
* @param ctx 上下文
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
export declare const isPointInCircleShape: (px: number, py: number, vertexes: [number, number][], ctx: CanvasRenderingContext2D) => boolean;
|
|
35
|
+
/**
|
|
36
|
+
* 点是否在点位内
|
|
37
|
+
* @param px 鼠标x坐标
|
|
38
|
+
* @param py 鼠标y坐标
|
|
39
|
+
* @param vertexes 点位数据
|
|
40
|
+
* @param ctx 上下文
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
export declare const isPointInKeypointShape: (px: number, py: number, vertexes: [number, number][], ctx: CanvasRenderingContext2D) => boolean;
|
|
26
44
|
/**
|
|
27
45
|
* 点是否在折线内
|
|
28
46
|
* @param px 鼠标x坐标
|
|
@@ -25,11 +25,17 @@ export declare class CreateDrawCanvas {
|
|
|
25
25
|
private editDrawPolygon;
|
|
26
26
|
private createRectangle;
|
|
27
27
|
private editDrawRectangle;
|
|
28
|
+
private createCircle;
|
|
29
|
+
private editDrawCircle;
|
|
30
|
+
private createKeypoint;
|
|
31
|
+
private editDrawKeypoint;
|
|
28
32
|
private addVertexes;
|
|
29
33
|
private createCompleteSubscribers;
|
|
30
34
|
private editingShape;
|
|
31
35
|
private editVertexes;
|
|
32
36
|
private editingSubscribers;
|
|
37
|
+
private activeShapeObserver;
|
|
38
|
+
private contextmenuShapeObserver;
|
|
33
39
|
constructor(options: DrawBaseCanvasProps);
|
|
34
40
|
subscribeCreateComplete(callback: (vertexes: [number, number][], mouseOffset: {
|
|
35
41
|
x: number;
|
|
@@ -44,17 +50,23 @@ export declare class CreateDrawCanvas {
|
|
|
44
50
|
subscribeEditing(callback: (vertexes: [number, number][], shape: ShapesProps) => void): void;
|
|
45
51
|
unsubscribeEditing(callback: (vertexes: [number, number][], shape: ShapesProps) => void): void;
|
|
46
52
|
private notifyEditing;
|
|
53
|
+
subscribeActiveShape(callback: (shape: ShapesProps | null) => void): void;
|
|
54
|
+
unsubscribeActiveShape(): void;
|
|
55
|
+
private notifyActiveShape;
|
|
56
|
+
subscribeContextmenuShape(callback: (e: MouseEvent, shape: ShapesProps | null) => void): void;
|
|
57
|
+
private notifyContextmenuShape;
|
|
47
58
|
onStartCreateRectangle(): void;
|
|
59
|
+
onStartCreateCircle(): void;
|
|
60
|
+
onStartCreateKeypoint(): void;
|
|
48
61
|
resetAllInstance(): void;
|
|
49
62
|
closeCreateOrEditor(): void;
|
|
50
63
|
drawShapes(shapes: ShapesProps[]): void;
|
|
51
64
|
updateTransform(scaleOffseet: ScaleTranslate): void;
|
|
52
65
|
updateLabelInfo(labelInfo: LabelNodeProps): void;
|
|
53
|
-
addShape(shape: ShapesProps): void;
|
|
54
|
-
deleteShape(shape: ShapesProps): void;
|
|
55
66
|
render: () => void;
|
|
56
67
|
private mouseHitShape;
|
|
57
68
|
triggerShapeEdit(shape: ShapesProps): void;
|
|
69
|
+
onSelectShape(shape: ShapesProps): void;
|
|
58
70
|
private onResetHitShape;
|
|
59
71
|
private onMouseDoubleClick;
|
|
60
72
|
private onMouseClick;
|
|
@@ -63,5 +75,6 @@ export declare class CreateDrawCanvas {
|
|
|
63
75
|
private onMouseUp;
|
|
64
76
|
onEditorStart(): void;
|
|
65
77
|
onEditorEnd(): void;
|
|
78
|
+
onCreateEnd(): void;
|
|
66
79
|
destroy(): void;
|
|
67
80
|
}
|
|
@@ -7,7 +7,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
7
7
|
type: ObjectConstructor;
|
|
8
8
|
default: () => {};
|
|
9
9
|
};
|
|
10
|
-
}>, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("editPolygon" | "changePolygon" | "updateLabelInfo")[], "editPolygon" | "changePolygon" | "updateLabelInfo", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
10
|
+
}>, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("editPolygon" | "changePolygon" | "updateLabelInfo" | "selectShape")[], "editPolygon" | "changePolygon" | "updateLabelInfo" | "selectShape", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
11
11
|
contextClientHeight: {
|
|
12
12
|
type: NumberConstructor;
|
|
13
13
|
default: any;
|
|
@@ -20,6 +20,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
20
20
|
onEditPolygon?: (...args: any[]) => any;
|
|
21
21
|
onChangePolygon?: (...args: any[]) => any;
|
|
22
22
|
onUpdateLabelInfo?: (...args: any[]) => any;
|
|
23
|
+
onSelectShape?: (...args: any[]) => any;
|
|
23
24
|
}>, {
|
|
24
25
|
contextClientHeight: number;
|
|
25
26
|
labelInfo: Record<string, any>;
|
|
@@ -5,7 +5,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
5
5
|
type: PropType<ShapesProps[]>;
|
|
6
6
|
default: () => any[];
|
|
7
7
|
};
|
|
8
|
-
}>, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("delete" | "update")[], "delete" | "update", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
8
|
+
}>, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("delete" | "update" | "select")[], "delete" | "update" | "select", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
9
9
|
shapes: {
|
|
10
10
|
type: PropType<ShapesProps[]>;
|
|
11
11
|
default: () => any[];
|
|
@@ -13,6 +13,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
13
13
|
}>> & Readonly<{
|
|
14
14
|
onDelete?: (...args: any[]) => any;
|
|
15
15
|
onUpdate?: (...args: any[]) => any;
|
|
16
|
+
onSelect?: (...args: any[]) => any;
|
|
16
17
|
}>, {
|
|
17
18
|
shapes: ShapesProps[];
|
|
18
19
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -92,6 +92,7 @@ export declare const localeLang: {
|
|
|
92
92
|
deletePolyton: string;
|
|
93
93
|
createRectangle: string;
|
|
94
94
|
createCircle: string;
|
|
95
|
+
createKeypoint: string;
|
|
95
96
|
selectClasses: string;
|
|
96
97
|
emptyClassesText: string;
|
|
97
98
|
deleteClasses: string;
|
|
@@ -187,6 +188,7 @@ export declare const localeLang: {
|
|
|
187
188
|
deletePolygon: string;
|
|
188
189
|
createRectangle: string;
|
|
189
190
|
createCircle: string;
|
|
191
|
+
createKeypoint: string;
|
|
190
192
|
selectClasses: string;
|
|
191
193
|
emptyClassesText: string;
|
|
192
194
|
deleteClasses: string;
|
|
@@ -282,6 +284,7 @@ export declare const localeLang: {
|
|
|
282
284
|
deletePolygon: string;
|
|
283
285
|
createRectangle: string;
|
|
284
286
|
createCircle: string;
|
|
287
|
+
createKeypoint: string;
|
|
285
288
|
selectClasses: string;
|
|
286
289
|
emptyClassesText: string;
|
|
287
290
|
deleteClasses: string;
|