@leafer-in/editor 1.0.0 → 1.0.2
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/editor.cjs +209 -102
- package/dist/editor.esm.js +210 -103
- package/dist/editor.esm.min.js +1 -1
- package/dist/editor.js +209 -102
- package/dist/editor.min.cjs +1 -1
- package/dist/editor.min.js +1 -1
- package/package.json +5 -5
- package/src/Editor.ts +77 -58
- package/src/config.ts +1 -0
- package/src/display/EditBox.ts +37 -30
- package/src/display/EditMask.ts +1 -1
- package/src/display/EditSelect.ts +26 -10
- package/src/editor/cursor.ts +4 -0
- package/src/helper/EditDataHelper.ts +68 -14
- package/types/index.d.ts +15 -7
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from '@leafer-in/resize';
|
|
2
|
-
import { IBounds, ILeafList, IUI, IEventListenerId, ILeaf, IPointerEvent, ILeaferCanvas, IRenderOptions,
|
|
3
|
-
import { Group, UI,
|
|
2
|
+
import { IBounds, ILeafList, IUI, IFunction, IEventListenerId, ILeaf, IPointerEvent, ILeaferCanvas, IRenderOptions, IObject, IGroup, IPointData, ILayoutBoundsData, IGroupInputData, IEditSize, IAlign, IAxis, IBox, IBoundsData, IEditorConfig as IEditorConfig$1, IBoxInputData, IKeyEvent, IRect, IRectInputData, IMatrixData, IDragEvent, IAround } from '@leafer-ui/interface';
|
|
3
|
+
import { Group, UI, Direction9, Matrix, Event, Box, Answer } from '@leafer-ui/draw';
|
|
4
4
|
import { PointerEvent, DragEvent, MoveEvent, ZoomEvent, RotateEvent } from '@leafer-ui/core';
|
|
5
5
|
import { IEditSelect, IEditor, IStroker, ISelectArea, IEditorConfig, IEditBox, IEditTool, IInnerEditor, IEditorScaleEvent, IEditorEvent, IEditPoint, IEditPointType, IEditorMoveEvent, IEditorRotateEvent, IEditorSkewEvent, IEditorGroupEvent, IInnerEditorEvent, IUI as IUI$1, IDragEvent as IDragEvent$1, IPointData as IPointData$1, IPathCommandData, IFromToData, IAround as IAround$1 } from '@leafer-in/interface';
|
|
6
6
|
|
|
@@ -15,6 +15,7 @@ declare class EditSelect extends Group implements IEditSelect {
|
|
|
15
15
|
selectArea: ISelectArea;
|
|
16
16
|
protected originList: ILeafList;
|
|
17
17
|
protected needRemoveItem: IUI;
|
|
18
|
+
protected waitSelect: IFunction;
|
|
18
19
|
protected __eventIds: IEventListenerId[];
|
|
19
20
|
constructor(editor: IEditor);
|
|
20
21
|
protected onHover(): void;
|
|
@@ -26,7 +27,7 @@ declare class EditSelect extends Group implements IEditSelect {
|
|
|
26
27
|
protected checkAndSelect(e: PointerEvent): void;
|
|
27
28
|
protected onDragStart(e: DragEvent): void;
|
|
28
29
|
protected onDrag(e: DragEvent): void;
|
|
29
|
-
protected onDragEnd(): void;
|
|
30
|
+
protected onDragEnd(e: DragEvent): void;
|
|
30
31
|
protected onAutoMove(e: MoveEvent): void;
|
|
31
32
|
protected allow(target: ILeaf): boolean;
|
|
32
33
|
protected allowDrag(e: DragEvent): boolean;
|
|
@@ -47,7 +48,7 @@ declare class EditMask extends UI {
|
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
declare class Editor extends Group implements IEditor {
|
|
50
|
-
config:
|
|
51
|
+
config: IObject;
|
|
51
52
|
get mergeConfig(): IEditorConfig;
|
|
52
53
|
hoverTarget?: IUI;
|
|
53
54
|
target?: IUI | IUI[];
|
|
@@ -57,6 +58,7 @@ declare class Editor extends Group implements IEditor {
|
|
|
57
58
|
get editing(): boolean;
|
|
58
59
|
innerEditing: boolean;
|
|
59
60
|
get groupOpening(): boolean;
|
|
61
|
+
resizeDirection?: Direction9;
|
|
60
62
|
get multiple(): boolean;
|
|
61
63
|
get single(): boolean;
|
|
62
64
|
get dragging(): boolean;
|
|
@@ -70,6 +72,7 @@ declare class Editor extends Group implements IEditor {
|
|
|
70
72
|
selector: EditSelect;
|
|
71
73
|
editMask: EditMask;
|
|
72
74
|
dragStartPoint: IPointData;
|
|
75
|
+
dragStartBounds: ILayoutBoundsData;
|
|
73
76
|
targetEventIds: IEventListenerId[];
|
|
74
77
|
constructor(userConfig?: IEditorConfig, data?: IGroupInputData);
|
|
75
78
|
select(target: IUI | IUI[]): void;
|
|
@@ -82,15 +85,18 @@ declare class Editor extends Group implements IEditor {
|
|
|
82
85
|
updateEditBox(): void;
|
|
83
86
|
updateEditTool(): void;
|
|
84
87
|
getEditSize(_ui: IUI): IEditSize;
|
|
85
|
-
onMove(e: DragEvent): void;
|
|
88
|
+
onMove(e: DragEvent | MoveEvent): void;
|
|
86
89
|
onScale(e: DragEvent | ZoomEvent): void;
|
|
87
90
|
onRotate(e: DragEvent | RotateEvent): void;
|
|
88
91
|
onSkew(e: DragEvent): void;
|
|
89
92
|
move(x: number | IPointData, y?: number): void;
|
|
90
93
|
scaleWithDrag(data: IEditorScaleEvent): void;
|
|
91
94
|
scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number, _resize?: boolean): void;
|
|
95
|
+
flip(axis: IAxis): void;
|
|
92
96
|
rotateOf(origin: IPointData | IAlign, rotation: number): void;
|
|
93
97
|
skewOf(origin: IPointData | IAlign, skewX: number, skewY?: number, _resize?: boolean): void;
|
|
98
|
+
protected getWorldOrigin(origin: IPointData | IAlign): IPointData;
|
|
99
|
+
protected getChangedTransform(func: IFunction): Matrix;
|
|
94
100
|
group(userGroup?: IGroup | IGroupInputData): IGroup;
|
|
95
101
|
ungroup(): IUI[];
|
|
96
102
|
openGroup(group: IGroup): void;
|
|
@@ -145,7 +151,9 @@ declare class EditBox extends Group implements IEditBox {
|
|
|
145
151
|
create(): void;
|
|
146
152
|
load(): void;
|
|
147
153
|
update(bounds: IBoundsData): void;
|
|
148
|
-
protected
|
|
154
|
+
protected layoutCircle(config: IEditorConfig$1): void;
|
|
155
|
+
protected layoutButtons(config: IEditorConfig$1): void;
|
|
156
|
+
protected setButtonPosition(buttons: IUI, direction: number, buttonsMargin: number, useMiddlePoint: boolean): void;
|
|
149
157
|
unload(): void;
|
|
150
158
|
getPointStyle(userStyle?: IBoxInputData): IBoxInputData;
|
|
151
159
|
getPointsStyle(): IBoxInputData[];
|
|
@@ -300,7 +308,7 @@ declare const EditorHelper: {
|
|
|
300
308
|
};
|
|
301
309
|
|
|
302
310
|
declare const EditDataHelper: {
|
|
303
|
-
getScaleData(
|
|
311
|
+
getScaleData(element: IUI, startBounds: ILayoutBoundsData, direction: Direction9, totalMove: IPointData, lockRatio: boolean | "corner", around: IAround, flipable: boolean, scaleMode: boolean): IEditorScaleEvent;
|
|
304
312
|
getRotateData(bounds: IBoundsData, direction: Direction9, current: IPointData, last: IPointData, around: IAround): IEditorRotateEvent;
|
|
305
313
|
getSkewData(bounds: IBoundsData, direction: Direction9, move: IPointData, around: IAround): IEditorSkewEvent;
|
|
306
314
|
getAround(around: IAround, altKey: boolean): IAround;
|