@leafer-in/interface 1.0.0-beta.15 → 1.0.0-beta.16
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/package.json +4 -3
- package/src/IEditor.ts +98 -0
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-in/interface",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.16",
|
|
4
4
|
"description": "@leafer-in/interface",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "src/index.ts",
|
|
8
8
|
"types": "types/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
|
+
"src",
|
|
10
11
|
"types",
|
|
11
12
|
"dist"
|
|
12
13
|
],
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
"leaferjs"
|
|
25
26
|
],
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@leafer-ui/interface": "1.0.0-beta.
|
|
28
|
-
"@leafer/interface": "1.0.0-beta.
|
|
28
|
+
"@leafer-ui/interface": "1.0.0-beta.16",
|
|
29
|
+
"@leafer/interface": "1.0.0-beta.16"
|
|
29
30
|
}
|
|
30
31
|
}
|
package/src/IEditor.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { IGroup, IUI, IRectInputData, IResizeType, IPolygon, ICursorType, IBoundsData, IPointData, IAround, IDragEvent, IEvent } from '@leafer-ui/interface'
|
|
2
|
+
|
|
3
|
+
export interface IEditor extends IGroup {
|
|
4
|
+
config: IEditorConfig
|
|
5
|
+
|
|
6
|
+
resizePoints: IUI[]
|
|
7
|
+
rotatePoints: IUI[]
|
|
8
|
+
resizeLines: IUI[]
|
|
9
|
+
|
|
10
|
+
circle: IUI
|
|
11
|
+
targetRect: IUI
|
|
12
|
+
rect: IPolygon
|
|
13
|
+
|
|
14
|
+
target: IUI
|
|
15
|
+
|
|
16
|
+
tool: IEditorTool
|
|
17
|
+
|
|
18
|
+
enterPoint: IUI
|
|
19
|
+
|
|
20
|
+
getTool(value: IUI): IEditorTool
|
|
21
|
+
update(): void
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface IEditorTool {
|
|
25
|
+
name: string
|
|
26
|
+
getMirrorData(editor: IEditor): IPointData
|
|
27
|
+
resize(e: IEditorResizeEvent): void
|
|
28
|
+
rotate(e: IEditorRotateEvent): void
|
|
29
|
+
update(editor: IEditor): void
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface IEditorConfig {
|
|
33
|
+
type?: 'pc' | 'mobile'
|
|
34
|
+
resizeType?: 'auto' | IResizeType
|
|
35
|
+
|
|
36
|
+
around?: IAround
|
|
37
|
+
lockRatio?: boolean
|
|
38
|
+
rotateGap?: number
|
|
39
|
+
|
|
40
|
+
stroke?: string
|
|
41
|
+
pointFill?: string
|
|
42
|
+
pointSize?: number
|
|
43
|
+
pointRadius?: number
|
|
44
|
+
|
|
45
|
+
point?: IRectInputData | IRectInputData[]
|
|
46
|
+
rotatePoint?: IRectInputData
|
|
47
|
+
rect?: IRectInputData
|
|
48
|
+
|
|
49
|
+
hideOnMove?: boolean
|
|
50
|
+
|
|
51
|
+
moveCursor?: ICursorType
|
|
52
|
+
resizeCursor?: ICursorType[]
|
|
53
|
+
rotateCursor?: ICursorType[]
|
|
54
|
+
|
|
55
|
+
rotateable?: boolean
|
|
56
|
+
resizeable?: boolean
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export enum IDirection8 {
|
|
60
|
+
topLeft,
|
|
61
|
+
top,
|
|
62
|
+
topRight,
|
|
63
|
+
right,
|
|
64
|
+
bottomRight,
|
|
65
|
+
bottom,
|
|
66
|
+
bottomLeft,
|
|
67
|
+
left
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface IEditorResizeEvent extends IEvent {
|
|
71
|
+
readonly target?: IUI
|
|
72
|
+
readonly editor?: IEditor
|
|
73
|
+
|
|
74
|
+
readonly resizeType?: IResizeType
|
|
75
|
+
readonly lockRatio?: boolean
|
|
76
|
+
readonly around?: IAround
|
|
77
|
+
|
|
78
|
+
readonly dragEvent?: IDragEvent
|
|
79
|
+
readonly direction?: IDirection8
|
|
80
|
+
|
|
81
|
+
// from old to bounds
|
|
82
|
+
readonly bounds?: IBoundsData
|
|
83
|
+
readonly old?: IBoundsData
|
|
84
|
+
|
|
85
|
+
// scaleOf(origin, scaleX, scaleY)
|
|
86
|
+
readonly origin?: IPointData
|
|
87
|
+
readonly scaleX?: number
|
|
88
|
+
readonly scaleY?: number
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface IEditorRotateEvent extends IEvent {
|
|
92
|
+
readonly target?: IUI
|
|
93
|
+
readonly editor?: IEditor
|
|
94
|
+
|
|
95
|
+
// rotateOf(origin, rotation)
|
|
96
|
+
readonly origin?: IPointData
|
|
97
|
+
readonly rotation?: number
|
|
98
|
+
}
|