@leafer-in/editor 1.6.6 → 1.7.0
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 +334 -263
- package/dist/editor.esm.js +331 -260
- package/dist/editor.esm.min.js +1 -1
- package/dist/editor.esm.min.js.map +1 -1
- package/dist/editor.js +334 -263
- package/dist/editor.min.cjs +1 -1
- package/dist/editor.min.cjs.map +1 -1
- package/dist/editor.min.js +1 -1
- package/dist/editor.min.js.map +1 -1
- package/package.json +6 -6
- package/src/Editor.ts +27 -229
- package/src/display/EditBox.ts +102 -53
- package/src/display/EditMask.ts +4 -3
- package/src/editor/cursor.ts +9 -10
- package/src/editor/simulate.ts +2 -2
- package/src/editor/target.ts +6 -5
- package/src/event/EditorEvent.ts +1 -0
- package/src/helper/EditDataHelper.ts +13 -13
- package/src/index.ts +2 -0
- package/src/tool/EditTool.ts +1 -4
- package/src/tool/InnerEditor.ts +6 -4
- package/src/tool/TransformTool.ts +294 -0
- package/types/index.d.ts +58 -22
package/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IBounds, ILeafList, IUI, IFunction, IEventListenerId, ILeaf, IPointerEvent, ILeaferCanvas, IRenderOptions, IGroup, IObject, IGroupInputData, IEditSize, IPointData, IAlign, IAxis, IMatrix, IApp, IBox, IEditorDragStartData,
|
|
1
|
+
import { IBounds, ILeafList, IUI, IFunction, IEventListenerId, ILeaf, IPointerEvent, ILeaferCanvas, IRenderOptions, IGroup, IObject, IGroupInputData, IEditSize, IPointData, IAlign, IAxis, IMatrix, IApp, IBox, IEditorDragStartData, IEditorConfig as IEditorConfig$1, ITransformTool, IBoundsData, IBoxInputData, IKeyEvent, IRect, IRectInputData, IMatrixData, IDragEvent, IAround, IEvent, ILayoutBoundsData } from '@leafer-ui/interface';
|
|
2
2
|
import { Group, UI, Direction9, Event, Box } from '@leafer-ui/draw';
|
|
3
3
|
import { PointerEvent, DragEvent, MoveEvent, ZoomEvent, RotateEvent, KeyEvent } from '@leafer-ui/core';
|
|
4
|
-
import { IEditSelect, IEditor, IStroker, ISelectArea, IEditorConfig, IEditPoint, ISimulateElement, IEditBox, IEditTool, IInnerEditor, IEditorScaleEvent, IEditorEvent, IEditPointType, IEditPointInputData, 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';
|
|
4
|
+
import { IEditSelect, IEditor, IStroker, ISelectArea, IEditorConfig, IEditPoint, ISimulateElement, IEditBox, IEditTool, IInnerEditor, IEditorScaleEvent, IEditorEvent, IEditPointType, IEditPointInputData, IEditorMoveEvent, IEditorRotateEvent, IEditorSkewEvent, IEditorGroupEvent, IInnerEditorEvent, IInnerEditorMode, IUI as IUI$1, IDragEvent as IDragEvent$1, IPointData as IPointData$1, IPathCommandData, IFromToData, IAround as IAround$1 } from '@leafer-in/interface';
|
|
5
5
|
|
|
6
6
|
declare class EditSelect extends Group implements IEditSelect {
|
|
7
7
|
editor: IEditor;
|
|
@@ -88,19 +88,19 @@ declare class Editor extends Group implements IEditor {
|
|
|
88
88
|
updateEditBox(): void;
|
|
89
89
|
updateEditTool(): void;
|
|
90
90
|
getEditSize(_ui: IUI): IEditSize;
|
|
91
|
-
onMove(
|
|
92
|
-
onScale(
|
|
93
|
-
onRotate(
|
|
94
|
-
onSkew(
|
|
95
|
-
move(
|
|
96
|
-
scaleWithDrag(
|
|
97
|
-
scaleOf(
|
|
98
|
-
flip(
|
|
99
|
-
rotateOf(
|
|
100
|
-
skewOf(
|
|
101
|
-
checkTransform(
|
|
102
|
-
protected getWorldOrigin(
|
|
103
|
-
protected getChangedTransform(
|
|
91
|
+
onMove(_e: DragEvent | MoveEvent): void;
|
|
92
|
+
onScale(_e: DragEvent | ZoomEvent): void;
|
|
93
|
+
onRotate(_e: DragEvent | RotateEvent): void;
|
|
94
|
+
onSkew(_e: DragEvent): void;
|
|
95
|
+
move(_x: number | IPointData, _y?: number): void;
|
|
96
|
+
scaleWithDrag(_data: IEditorScaleEvent): void;
|
|
97
|
+
scaleOf(_origin: IPointData | IAlign, scaleX: number, _scaleY?: number, _resize?: boolean): void;
|
|
98
|
+
flip(_axis: IAxis): void;
|
|
99
|
+
rotateOf(_origin: IPointData | IAlign, _rotation: number): void;
|
|
100
|
+
skewOf(_origin: IPointData | IAlign, _skewX: number, _skewY?: number, _resize?: boolean): void;
|
|
101
|
+
checkTransform(_type: 'moveable' | 'resizeable' | 'rotateable' | 'skewable'): boolean;
|
|
102
|
+
protected getWorldOrigin(_origin: IPointData | IAlign): IPointData;
|
|
103
|
+
protected getChangedTransform(_func: IFunction): IMatrix;
|
|
104
104
|
group(userGroup?: IGroup | IGroupInputData): IGroup;
|
|
105
105
|
ungroup(): IUI[];
|
|
106
106
|
openGroup(group: IGroup): void;
|
|
@@ -117,7 +117,6 @@ declare class Editor extends Group implements IEditor {
|
|
|
117
117
|
toBottom(): void;
|
|
118
118
|
protected onAppRenderStart(app: IApp): void;
|
|
119
119
|
protected onRenderStart(): void;
|
|
120
|
-
protected onKey(e: KeyEvent): void;
|
|
121
120
|
listenTargetEvents(): void;
|
|
122
121
|
removeTargetEvents(): void;
|
|
123
122
|
destroy(): void;
|
|
@@ -126,6 +125,7 @@ declare class Editor extends Group implements IEditor {
|
|
|
126
125
|
declare class EditorEvent extends Event implements IEditorEvent {
|
|
127
126
|
static BEFORE_SELECT: string;
|
|
128
127
|
static SELECT: string;
|
|
128
|
+
static AFTER_SELECT: string;
|
|
129
129
|
static BEFORE_HOVER: string;
|
|
130
130
|
static HOVER: string;
|
|
131
131
|
readonly target: IUI;
|
|
@@ -153,6 +153,16 @@ declare class EditBox extends Group implements IEditBox {
|
|
|
153
153
|
enterPoint: IEditPoint;
|
|
154
154
|
dragPoint: IEditPoint;
|
|
155
155
|
dragStartData: IEditorDragStartData;
|
|
156
|
+
config: IEditorConfig$1;
|
|
157
|
+
mergedConfig: IEditorConfig$1;
|
|
158
|
+
get mergeConfig(): IEditorConfig$1;
|
|
159
|
+
protected _target: IUI;
|
|
160
|
+
get target(): IUI;
|
|
161
|
+
set target(target: IUI);
|
|
162
|
+
get single(): boolean;
|
|
163
|
+
protected _transformTool: ITransformTool;
|
|
164
|
+
get transformTool(): ITransformTool;
|
|
165
|
+
set transformTool(tool: ITransformTool);
|
|
156
166
|
get flipped(): boolean;
|
|
157
167
|
get flippedX(): boolean;
|
|
158
168
|
get flippedY(): boolean;
|
|
@@ -161,9 +171,10 @@ declare class EditBox extends Group implements IEditBox {
|
|
|
161
171
|
constructor(editor: IEditor);
|
|
162
172
|
create(): void;
|
|
163
173
|
load(): void;
|
|
164
|
-
update(
|
|
165
|
-
|
|
166
|
-
protected
|
|
174
|
+
update(): void;
|
|
175
|
+
updateBounds(bounds: IBoundsData): void;
|
|
176
|
+
protected layoutCircle(): void;
|
|
177
|
+
protected layoutButtons(): void;
|
|
167
178
|
protected setButtonPosition(buttons: IUI, direction: number, buttonsMargin: number, useMiddlePoint: boolean): void;
|
|
168
179
|
unload(): void;
|
|
169
180
|
getPointStyle(userStyle?: IBoxInputData): IBoxInputData;
|
|
@@ -173,6 +184,7 @@ declare class EditBox extends Group implements IEditBox {
|
|
|
173
184
|
protected onDragStart(e: DragEvent): void;
|
|
174
185
|
protected onDragEnd(e: DragEvent): void;
|
|
175
186
|
protected onDrag(e: DragEvent): void;
|
|
187
|
+
protected onKey(e: KeyEvent): void;
|
|
176
188
|
onArrow(e: IKeyEvent): void;
|
|
177
189
|
protected onDoubleTap(e: PointerEvent): void;
|
|
178
190
|
protected onLongPress(e: PointerEvent): void;
|
|
@@ -277,6 +289,7 @@ declare const EditToolCreator: {
|
|
|
277
289
|
declare class InnerEditor implements IInnerEditor {
|
|
278
290
|
static registerInnerEditor(): void;
|
|
279
291
|
get tag(): string;
|
|
292
|
+
get mode(): IInnerEditorMode;
|
|
280
293
|
editTarget: IUI;
|
|
281
294
|
config: IObject;
|
|
282
295
|
editor: IEditor;
|
|
@@ -320,6 +333,29 @@ declare class LineEditTool extends EditTool {
|
|
|
320
333
|
onUpdate(): void;
|
|
321
334
|
}
|
|
322
335
|
|
|
336
|
+
declare class TransformTool implements ITransformTool {
|
|
337
|
+
editBox: IEditBox;
|
|
338
|
+
editTool?: IEditTool;
|
|
339
|
+
onMove(e: DragEvent | MoveEvent): void;
|
|
340
|
+
onScale(e: DragEvent | ZoomEvent): void;
|
|
341
|
+
onRotate(e: DragEvent | RotateEvent): void;
|
|
342
|
+
onSkew(e: DragEvent): void;
|
|
343
|
+
move(x: number | IPointData, y?: number): void;
|
|
344
|
+
scaleWithDrag(data: IEditorScaleEvent): void;
|
|
345
|
+
scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number, _resize?: boolean): void;
|
|
346
|
+
flip(axis: IAxis): void;
|
|
347
|
+
rotateOf(origin: IPointData | IAlign, rotation: number): void;
|
|
348
|
+
skewOf(origin: IPointData | IAlign, skewX: number, skewY?: number, _resize?: boolean): void;
|
|
349
|
+
protected doMove(event: IEditorMoveEvent): void;
|
|
350
|
+
protected doScale(event: IEditorScaleEvent): void;
|
|
351
|
+
protected doRotate(event: IEditorRotateEvent): void;
|
|
352
|
+
protected doSkew(event: IEditorSkewEvent): void;
|
|
353
|
+
checkTransform(type: 'moveable' | 'resizeable' | 'rotateable' | 'skewable'): boolean;
|
|
354
|
+
protected getWorldOrigin(origin: IPointData | IAlign): IPointData;
|
|
355
|
+
protected getChangedTransform(func: IFunction): IMatrix;
|
|
356
|
+
emitEvent(event?: IEvent, capture?: boolean): void;
|
|
357
|
+
}
|
|
358
|
+
|
|
323
359
|
declare const EditorHelper: {
|
|
324
360
|
group(list: IUI[], element?: IUI, userGroup?: IGroup | IGroupInputData): IGroup;
|
|
325
361
|
ungroup(list: IUI[]): IUI[];
|
|
@@ -328,8 +364,8 @@ declare const EditorHelper: {
|
|
|
328
364
|
};
|
|
329
365
|
|
|
330
366
|
declare const EditDataHelper: {
|
|
331
|
-
getScaleData(
|
|
332
|
-
getRotateData(
|
|
367
|
+
getScaleData(target: IUI, startBounds: ILayoutBoundsData, direction: Direction9, totalMove: IPointData, lockRatio: boolean | "corner", around: IAround, flipable: boolean, scaleMode: boolean): IEditorScaleEvent;
|
|
368
|
+
getRotateData(target: IUI, direction: Direction9, current: IPointData, last: IPointData, around: IAround): IEditorRotateEvent;
|
|
333
369
|
getSkewData(bounds: IBoundsData, direction: Direction9, move: IPointData, around: IAround): IEditorSkewEvent;
|
|
334
370
|
getAround(around: IAround, altKey: boolean): IAround;
|
|
335
371
|
getRotateDirection(direction: number, rotation: number, totalDirection?: number): number;
|
|
@@ -341,4 +377,4 @@ declare const EditSelectHelper: {
|
|
|
341
377
|
findByBounds(branch: IUI, bounds: IBounds): IUI[];
|
|
342
378
|
};
|
|
343
379
|
|
|
344
|
-
export { EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, InnerEditor, InnerEditorEvent, LineEditTool, SelectArea, Stroker, registerEditTool, registerInnerEditor };
|
|
380
|
+
export { EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, InnerEditor, InnerEditorEvent, LineEditTool, SelectArea, Stroker, TransformTool, registerEditTool, registerInnerEditor };
|