@leafer-in/editor 1.0.0 → 1.0.1
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 +164 -93
- package/dist/editor.esm.js +165 -94
- package/dist/editor.esm.min.js +1 -1
- package/dist/editor.js +164 -93
- package/dist/editor.min.cjs +1 -1
- package/dist/editor.min.js +1 -1
- package/package.json +5 -5
- package/src/Editor.ts +74 -56
- package/src/config.ts +1 -0
- package/src/display/EditBox.ts +35 -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 +54 -13
- package/types/index.d.ts +13 -6
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, IGroup, IObject, IPointData, IGroupInputData, IEditSize, IAlign, IBox, IBoundsData, IBoxInputData, IKeyEvent, IRect, IRectInputData, IMatrixData, IDragEvent, IAround } from '@leafer-ui/interface';
|
|
3
|
-
import { Group, UI, Event, Direction9, Box, Answer } from '@leafer-ui/draw';
|
|
2
|
+
import { IBounds, ILeafList, IUI, IFunction, IEventListenerId, ILeaf, IPointerEvent, ILeaferCanvas, IRenderOptions, IGroup, IObject, 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, Matrix, Event, Direction9, 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;
|
|
@@ -70,6 +71,7 @@ declare class Editor extends Group implements IEditor {
|
|
|
70
71
|
selector: EditSelect;
|
|
71
72
|
editMask: EditMask;
|
|
72
73
|
dragStartPoint: IPointData;
|
|
74
|
+
dragStartBounds: ILayoutBoundsData;
|
|
73
75
|
targetEventIds: IEventListenerId[];
|
|
74
76
|
constructor(userConfig?: IEditorConfig, data?: IGroupInputData);
|
|
75
77
|
select(target: IUI | IUI[]): void;
|
|
@@ -82,15 +84,18 @@ declare class Editor extends Group implements IEditor {
|
|
|
82
84
|
updateEditBox(): void;
|
|
83
85
|
updateEditTool(): void;
|
|
84
86
|
getEditSize(_ui: IUI): IEditSize;
|
|
85
|
-
onMove(e: DragEvent): void;
|
|
87
|
+
onMove(e: DragEvent | MoveEvent): void;
|
|
86
88
|
onScale(e: DragEvent | ZoomEvent): void;
|
|
87
89
|
onRotate(e: DragEvent | RotateEvent): void;
|
|
88
90
|
onSkew(e: DragEvent): void;
|
|
89
91
|
move(x: number | IPointData, y?: number): void;
|
|
90
92
|
scaleWithDrag(data: IEditorScaleEvent): void;
|
|
91
93
|
scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number, _resize?: boolean): void;
|
|
94
|
+
flip(axis: IAxis): void;
|
|
92
95
|
rotateOf(origin: IPointData | IAlign, rotation: number): void;
|
|
93
96
|
skewOf(origin: IPointData | IAlign, skewX: number, skewY?: number, _resize?: boolean): void;
|
|
97
|
+
protected getWorldOrigin(origin: IPointData | IAlign): IPointData;
|
|
98
|
+
protected getChangedTransform(func: IFunction): Matrix;
|
|
94
99
|
group(userGroup?: IGroup | IGroupInputData): IGroup;
|
|
95
100
|
ungroup(): IUI[];
|
|
96
101
|
openGroup(group: IGroup): void;
|
|
@@ -145,7 +150,9 @@ declare class EditBox extends Group implements IEditBox {
|
|
|
145
150
|
create(): void;
|
|
146
151
|
load(): void;
|
|
147
152
|
update(bounds: IBoundsData): void;
|
|
148
|
-
protected
|
|
153
|
+
protected layoutCircle(config: IEditorConfig$1): void;
|
|
154
|
+
protected layoutButtons(config: IEditorConfig$1): void;
|
|
155
|
+
protected setButtonPosition(buttons: IUI, direction: number, buttonsMargin: number, useMiddlePoint: boolean): void;
|
|
149
156
|
unload(): void;
|
|
150
157
|
getPointStyle(userStyle?: IBoxInputData): IBoxInputData;
|
|
151
158
|
getPointsStyle(): IBoxInputData[];
|
|
@@ -300,7 +307,7 @@ declare const EditorHelper: {
|
|
|
300
307
|
};
|
|
301
308
|
|
|
302
309
|
declare const EditDataHelper: {
|
|
303
|
-
getScaleData(
|
|
310
|
+
getScaleData(element: IUI, startBounds: ILayoutBoundsData, direction: Direction9, totalMove: IPointData, lockRatio: boolean | "corner", around: IAround, flipable: boolean, scaleMode: boolean): IEditorScaleEvent;
|
|
304
311
|
getRotateData(bounds: IBoundsData, direction: Direction9, current: IPointData, last: IPointData, around: IAround): IEditorRotateEvent;
|
|
305
312
|
getSkewData(bounds: IBoundsData, direction: Direction9, move: IPointData, around: IAround): IEditorSkewEvent;
|
|
306
313
|
getAround(around: IAround, altKey: boolean): IAround;
|