@leafer-in/interface 1.0.0-rc.20 → 1.0.0-rc.22

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-in/interface",
3
- "version": "1.0.0-rc.20",
3
+ "version": "1.0.0-rc.22",
4
4
  "description": "@leafer-in/interface",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -25,7 +25,7 @@
25
25
  "leaferjs"
26
26
  ],
27
27
  "dependencies": {
28
- "@leafer-ui/interface": "1.0.0-rc.20",
29
- "@leafer/interface": "1.0.0-rc.20"
28
+ "@leafer-ui/interface": "1.0.0-rc.22",
29
+ "@leafer/interface": "1.0.0-rc.22"
30
30
  }
31
31
  }
@@ -1,30 +1,7 @@
1
- import { IGroup, IRect, IBoundsData, IKeyEvent } from '@leafer-ui/interface'
1
+ import { IEditBoxBase } from '@leafer-ui/interface'
2
2
  import { IEditor } from './IEditor'
3
- import { IEditPoint } from './IEditPoint'
4
-
5
- export interface IEditBox extends IGroup {
3
+ export interface IEditBox extends IEditBoxBase {
6
4
 
7
5
  editor: IEditor
8
- dragging: boolean
9
- moving: boolean
10
-
11
- circle: IEditPoint
12
- rect: IRect
13
-
14
- buttons: IGroup
15
-
16
- resizePoints: IEditPoint[]
17
- rotatePoints: IEditPoint[]
18
- resizeLines: IEditPoint[]
19
-
20
- readonly flipped: boolean
21
- readonly flippedX: boolean
22
- readonly flippedY: boolean
23
- readonly flippedOne: boolean
24
-
25
- enterPoint: IEditPoint
26
-
27
- update(bounds: IBoundsData): void
28
- onArrow(e: IKeyEvent): void
29
6
 
30
7
  }
@@ -1,4 +1,4 @@
1
- import { IGroup, IBounds } from '@leafer-ui/interface'
1
+ import { IGroup, IUI, IBounds, IPointerEvent } from '@leafer-ui/interface'
2
2
 
3
3
  import { IStroker } from './IStroker'
4
4
  import { ISelectArea } from './ISelectArea'
@@ -16,5 +16,7 @@ export interface IEditSelect extends IGroup {
16
16
  selectArea: ISelectArea
17
17
  bounds: IBounds
18
18
 
19
+ findUI(e: IPointerEvent): IUI
20
+ findDeepOne(e: IPointerEvent): IUI
19
21
  update(): void
20
22
  }
@@ -1,42 +1,59 @@
1
- import { IUI, IPointData, IAround, IDragEvent, IEvent, IEventListenerId, ILeafList, IMatrixData, IEditorBase } from '@leafer-ui/interface'
1
+ import { IUI, IPointData, IAround, IDragEvent, IEvent, IEventListenerId, IMatrixData, IEditorBase, IGroup } from '@leafer-ui/interface'
2
+
2
3
  import { IEditBox } from './IEditBox'
3
4
  import { IEditSelect } from './IEditSelect'
4
5
 
5
6
 
6
7
  export interface IEditor extends IEditorBase {
7
- leafList: ILeafList
8
-
9
8
  simulateTarget: IUI
10
9
 
11
10
  selector: IEditSelect
12
11
  editBox: IEditBox
13
12
  editTool: IEditTool
13
+ innerEditor: IInnerEditor
14
14
 
15
+ dragStartPoint: IPointData
15
16
  targetEventIds: IEventListenerId[]
16
17
 
18
+ checkOpenedGroups(): void
19
+
17
20
  listenTargetEvents(): void
18
21
  removeTargetEvents(): void
19
22
  }
20
23
 
21
- export interface IEditTool {
22
- tag: string
24
+ export interface IEditTool extends IInnerEditor {
25
+ // 操作
23
26
  onMove(e: IEditorMoveEvent): void
24
27
  onScale(e: IEditorScaleEvent): void
25
28
  onScaleWithDrag?(e: IEditorScaleEvent): void
26
29
  onRotate(e: IEditorRotateEvent): void
27
30
  onSkew(e: IEditorSkewEvent): void
28
- update(editor: IEditor): void
29
31
  }
30
32
 
31
- export enum IDirection8 {
32
- topLeft,
33
- top,
34
- topRight,
35
- right,
36
- bottomRight,
37
- bottom,
38
- bottomLeft,
39
- left
33
+ export interface IInnerEditor {
34
+ tag: string
35
+
36
+ editor: IEditor
37
+ editBox: IEditBox
38
+ view: IGroup
39
+
40
+ eventIds: IEventListenerId[]
41
+
42
+ onCreate(): void
43
+ create(): void
44
+
45
+ // 状态
46
+ onLoad(): void
47
+ load(): void
48
+
49
+ onLoad(): void
50
+ unload(): void
51
+
52
+ onUpdate(): void
53
+ update(): void
54
+
55
+ onDestroy(): void
56
+ destroy(): void
40
57
  }
41
58
 
42
59
  export interface IEditorEvent extends IEvent {
@@ -62,7 +79,7 @@ export interface IEditorScaleEvent extends IEditorEvent {
62
79
  readonly scaleY?: number
63
80
  transform?: IMatrixData
64
81
 
65
- readonly direction?: IDirection8
82
+ readonly direction?: number
66
83
  readonly lockRatio?: boolean | 'corner'
67
84
  readonly around?: IAround
68
85
 
package/src/index.ts CHANGED
@@ -1,12 +1,11 @@
1
1
  export * from '@leafer-ui/interface'
2
2
 
3
3
  // editor
4
- export { IEditor, IEditTool, IDirection8, IEditorScaleEvent, IEditorRotateEvent, IEditorSkewEvent, IEditorEvent, IEditorMoveEvent } from './editor/IEditor'
4
+ export { IEditor, IEditTool, IInnerEditor, IEditorScaleEvent, IEditorRotateEvent, IEditorSkewEvent, IEditorEvent, IEditorMoveEvent } from './editor/IEditor'
5
5
  export { IStroker } from './editor/IStroker'
6
6
  export { IEditBox } from './editor/IEditBox'
7
7
  export { ISelectArea } from './editor/ISelectArea'
8
8
  export { IEditSelect } from './editor/IEditSelect'
9
- export { IEditPoint, IEditPointType } from './editor/IEditPoint'
10
9
 
11
10
  // html
12
11
 
package/types/index.d.ts CHANGED
@@ -1,29 +1,8 @@
1
- import { IBox, IGroup, IRect, IBoundsData, IKeyEvent, IUI, IRectInputData, IBounds, IEditorBase, ILeafList, IEventListenerId, IEvent, IPointData, IMatrixData, IAround, IDragEvent, IImageData, IImageInputData, IFourNumber, IBoxInputData } from '@leafer-ui/interface';
1
+ import { IEditBoxBase, IUI, IRectInputData, IGroup, IBoundsData, IBounds, IPointerEvent, IEditorBase, IPointData, IEventListenerId, IEvent, IMatrixData, IAround, IDragEvent, IImageData, IImageInputData, IFourNumber, IBoxInputData } from '@leafer-ui/interface';
2
2
  export * from '@leafer-ui/interface';
3
3
 
4
- interface IEditPoint extends IBox {
5
- direction: IDirection8;
6
- pointType: IEditPointType;
7
- }
8
- type IEditPointType = 'rotate' | 'resize';
9
-
10
- interface IEditBox extends IGroup {
4
+ interface IEditBox extends IEditBoxBase {
11
5
  editor: IEditor;
12
- dragging: boolean;
13
- moving: boolean;
14
- circle: IEditPoint;
15
- rect: IRect;
16
- buttons: IGroup;
17
- resizePoints: IEditPoint[];
18
- rotatePoints: IEditPoint[];
19
- resizeLines: IEditPoint[];
20
- readonly flipped: boolean;
21
- readonly flippedX: boolean;
22
- readonly flippedY: boolean;
23
- readonly flippedOne: boolean;
24
- enterPoint: IEditPoint;
25
- update(bounds: IBoundsData): void;
26
- onArrow(e: IKeyEvent): void;
27
6
  }
28
7
 
29
8
  interface IStroker extends IUI {
@@ -44,37 +23,46 @@ interface IEditSelect extends IGroup {
44
23
  targetStroker: IStroker;
45
24
  selectArea: ISelectArea;
46
25
  bounds: IBounds;
26
+ findUI(e: IPointerEvent): IUI;
27
+ findDeepOne(e: IPointerEvent): IUI;
47
28
  update(): void;
48
29
  }
49
30
 
50
31
  interface IEditor extends IEditorBase {
51
- leafList: ILeafList;
52
32
  simulateTarget: IUI;
53
33
  selector: IEditSelect;
54
34
  editBox: IEditBox;
55
35
  editTool: IEditTool;
36
+ innerEditor: IInnerEditor;
37
+ dragStartPoint: IPointData;
56
38
  targetEventIds: IEventListenerId[];
39
+ checkOpenedGroups(): void;
57
40
  listenTargetEvents(): void;
58
41
  removeTargetEvents(): void;
59
42
  }
60
- interface IEditTool {
61
- tag: string;
43
+ interface IEditTool extends IInnerEditor {
62
44
  onMove(e: IEditorMoveEvent): void;
63
45
  onScale(e: IEditorScaleEvent): void;
64
46
  onScaleWithDrag?(e: IEditorScaleEvent): void;
65
47
  onRotate(e: IEditorRotateEvent): void;
66
48
  onSkew(e: IEditorSkewEvent): void;
67
- update(editor: IEditor): void;
68
- }
69
- declare enum IDirection8 {
70
- topLeft = 0,
71
- top = 1,
72
- topRight = 2,
73
- right = 3,
74
- bottomRight = 4,
75
- bottom = 5,
76
- bottomLeft = 6,
77
- left = 7
49
+ }
50
+ interface IInnerEditor {
51
+ tag: string;
52
+ editor: IEditor;
53
+ editBox: IEditBox;
54
+ view: IGroup;
55
+ eventIds: IEventListenerId[];
56
+ onCreate(): void;
57
+ create(): void;
58
+ onLoad(): void;
59
+ load(): void;
60
+ onLoad(): void;
61
+ unload(): void;
62
+ onUpdate(): void;
63
+ update(): void;
64
+ onDestroy(): void;
65
+ destroy(): void;
78
66
  }
79
67
  interface IEditorEvent extends IEvent {
80
68
  readonly target?: IUI;
@@ -94,7 +82,7 @@ interface IEditorScaleEvent extends IEditorEvent {
94
82
  readonly scaleX?: number;
95
83
  readonly scaleY?: number;
96
84
  transform?: IMatrixData;
97
- readonly direction?: IDirection8;
85
+ readonly direction?: number;
98
86
  readonly lockRatio?: boolean | 'corner';
99
87
  readonly around?: IAround;
100
88
  drag?: IDragEvent;
@@ -130,4 +118,4 @@ interface IScrollBar extends IGroup {
130
118
  update(check: boolean): void;
131
119
  }
132
120
 
133
- export { IDirection8, type IEditBox, type IEditPoint, type IEditPointType, type IEditSelect, type IEditTool, type IEditor, type IEditorEvent, type IEditorMoveEvent, type IEditorRotateEvent, type IEditorScaleEvent, type IEditorSkewEvent, type IHTMLTextData, type IHTMLTextInputData, type IScrollBar, type IScrollBarConfig, type IScrollBarTheme, type ISelectArea, type IStroker };
121
+ export type { IEditBox, IEditSelect, IEditTool, IEditor, IEditorEvent, IEditorMoveEvent, IEditorRotateEvent, IEditorScaleEvent, IEditorSkewEvent, IHTMLTextData, IHTMLTextInputData, IInnerEditor, IScrollBar, IScrollBarConfig, IScrollBarTheme, ISelectArea, IStroker };
@@ -1,9 +0,0 @@
1
- import { IBox } from '@leafer-ui/interface'
2
- import { IDirection8 } from './IEditor'
3
-
4
- export interface IEditPoint extends IBox {
5
- direction: IDirection8
6
- pointType: IEditPointType
7
- }
8
-
9
- export type IEditPointType = 'rotate' | 'resize'