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.
@@ -20,7 +20,7 @@ export declare const NextLabelme: import("../../utils/install").SFCWithInstall<i
20
20
  type: import("vue").PropType<any[]>;
21
21
  default: () => any[];
22
22
  };
23
- }, () => any, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "save" | "edit-polygon" | "prev-click" | "next-click")[], "change" | "save" | "edit-polygon" | "prev-click" | "next-click", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
23
+ }, () => any, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "save" | "edit-polygon" | "change-polygon" | "prev-click" | "next-click")[], "change" | "save" | "edit-polygon" | "change-polygon" | "prev-click" | "next-click", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
24
24
  className: {
25
25
  type: StringConstructor;
26
26
  default: string;
@@ -45,6 +45,7 @@ export declare const NextLabelme: import("../../utils/install").SFCWithInstall<i
45
45
  onChange?: (...args: any[]) => any;
46
46
  onSave?: (...args: any[]) => any;
47
47
  "onEdit-polygon"?: (...args: any[]) => any;
48
+ "onChange-polygon"?: (...args: any[]) => any;
48
49
  "onPrev-click"?: (...args: any[]) => any;
49
50
  "onNext-click"?: (...args: any[]) => any;
50
51
  }, {
@@ -1,3 +1,24 @@
1
+ import type { Ref } from 'vue';
2
+ export interface ScaleTranslate {
3
+ scale: number;
4
+ x: number;
5
+ y: number;
6
+ }
7
+ export interface ScaleTranslateManager {
8
+ scaleTranslate: Ref<ScaleTranslate>;
9
+ onChangeScaleTranslate: (scaleTranslate: ScaleTranslate) => void;
10
+ onResetScaleTranslate: () => void;
11
+ }
12
+ export interface ShapesProps {
13
+ label?: string;
14
+ points: [number, number][];
15
+ shape_type?: string;
16
+ }
17
+ export interface LabelNodeProps {
18
+ imageWidth?: number;
19
+ imageHeight?: number;
20
+ shapes?: ShapesProps[];
21
+ }
1
22
  declare const _default: {
2
23
  minContentHeight: number;
3
24
  };
@@ -1,3 +1,5 @@
1
+ import type { Ref } from 'vue';
2
+ import type { ScaleTranslate, LabelNodeProps, ShapesProps } from '../config';
1
3
  export interface CreateRectCanvasProps {
2
4
  canvasWidth: number;
3
5
  canvasHeight: number;
@@ -7,9 +9,10 @@ export interface DrawBaseCanvasProps extends CreateRectCanvasProps {
7
9
  ctx: CanvasRenderingContext2D;
8
10
  image: HTMLImageElement;
9
11
  scaleFactor?: number;
10
- paths?: any[];
12
+ labels?: LabelNodeProps;
11
13
  scaleX?: number;
12
14
  scaleY?: number;
15
+ scaleOffset?: Ref<ScaleTranslate>;
13
16
  }
14
17
  export declare const printsToPath: (vertexes: [number, number][]) => Path2D;
15
18
  export declare const isPointOnLineSegment: (px: number, py: number, vertexes: [number, number][], ctx: CanvasRenderingContext2D) => number;
@@ -20,6 +23,8 @@ export declare const isPointInCircle: (mouseX: number, mouseY: number, circleX:
20
23
  * @returns
21
24
  */
22
25
  export declare const vertexesUnique: (vertexes: [number, number][]) => any[];
26
+ export declare const vertexToScale: (vertex: [number, number], scaleX: number, scaleY: number, isMultiply?: boolean) => [number, number];
27
+ export declare const vertexesToScale: (vertexes: [number, number][], scaleX: number, scaleY: number, isMultiply?: boolean) => [number, number][];
23
28
  export declare const colors: string[];
24
29
  export declare class CreateDrawCanvas {
25
30
  canvas: HTMLCanvasElement;
@@ -27,18 +32,22 @@ export declare class CreateDrawCanvas {
27
32
  image: HTMLImageElement;
28
33
  canvasWidth: number;
29
34
  canvasHeight: number;
30
- private paths;
35
+ scaleOffset: Ref<ScaleTranslate>;
36
+ private labels;
31
37
  private scaleX;
32
38
  private scaleY;
33
39
  private editDrawPolygon;
34
40
  private createPolygonVertexes;
35
41
  private editVertexes;
36
42
  private editPolygonObservers;
43
+ private drawnPolygonObserver?;
37
44
  constructor(options: DrawBaseCanvasProps);
38
45
  private notifyObservers;
46
+ private notifyDrawnPolygonObservers;
39
47
  updatePolygon(callback: (vertexes: [number, number][]) => void): void;
40
- drawPolygons(paths: any[]): void;
41
- initCanvas: () => void;
48
+ onDrawnPolygon(callback: (vertexes: [number, number][]) => void): void;
49
+ drawPolygons(shapes: ShapesProps[]): void;
50
+ drawCanvas: () => void;
42
51
  render: () => void;
43
- destroyed(): void;
52
+ destroy(): void;
44
53
  }
@@ -20,7 +20,7 @@ declare const _default: import("vue").DefineComponent<{
20
20
  type: PropType<any[]>;
21
21
  default: () => any[];
22
22
  };
23
- }, () => any, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "save" | "edit-polygon" | "prev-click" | "next-click")[], "change" | "save" | "edit-polygon" | "prev-click" | "next-click", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
23
+ }, () => any, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "save" | "edit-polygon" | "change-polygon" | "prev-click" | "next-click")[], "change" | "save" | "edit-polygon" | "change-polygon" | "prev-click" | "next-click", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
24
24
  className: {
25
25
  type: StringConstructor;
26
26
  default: string;
@@ -45,6 +45,7 @@ declare const _default: import("vue").DefineComponent<{
45
45
  onChange?: (...args: any[]) => any;
46
46
  onSave?: (...args: any[]) => any;
47
47
  "onEdit-polygon"?: (...args: any[]) => any;
48
+ "onChange-polygon"?: (...args: any[]) => any;
48
49
  "onPrev-click"?: (...args: any[]) => any;
49
50
  "onNext-click"?: (...args: any[]) => any;
50
51
  }, {
@@ -11,7 +11,7 @@ declare const _default: import("vue").DefineComponent<{
11
11
  type: ObjectConstructor;
12
12
  default: () => {};
13
13
  };
14
- }, () => any, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "editPolygon"[], "editPolygon", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
14
+ }, () => any, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("editPolygon" | "changePolygon")[], "editPolygon" | "changePolygon", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
15
15
  classes: {
16
16
  type: ArrayConstructor;
17
17
  default: () => any[];
@@ -26,6 +26,7 @@ declare const _default: import("vue").DefineComponent<{
26
26
  };
27
27
  }>> & {
28
28
  onEditPolygon?: (...args: any[]) => any;
29
+ onChangePolygon?: (...args: any[]) => any;
29
30
  }, {
30
31
  classes: unknown[];
31
32
  contextClientHeight: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-element-vue",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "author": {
5
5
  "name": "huangteng",
6
6
  "email": "htengweb@163.com"
@@ -1,31 +0,0 @@
1
- export declare class CanvasSceneDragZoom {
2
- private canvas;
3
- private canvasWidth;
4
- private canvasHeight;
5
- private ctx;
6
- private scaleFactor;
7
- private preScaleFactor;
8
- private offset;
9
- private preOffset;
10
- private mousePositioin;
11
- private maxScale;
12
- private minScale;
13
- private scaleStep;
14
- private clickX;
15
- private clickY;
16
- private observers;
17
- constructor(canvas: HTMLCanvasElement);
18
- private notifyObservers;
19
- changeZoom(callback: (scale: number, offset: {
20
- x: number;
21
- y: number;
22
- }) => void): void;
23
- reset(): void;
24
- render(): void;
25
- zoom(): void;
26
- canvasMousewheel: (event: WheelEvent) => void;
27
- canvasMousedown(event: MouseEvent): void;
28
- canvasMousemove(event: MouseEvent): void;
29
- canvasMouseup(event: MouseEvent): void;
30
- destroy(): void;
31
- }