@leafer-in/editor 1.0.0-rc.26 → 1.0.0-rc.28
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 +199 -10
- package/dist/editor.esm.js +194 -6
- package/dist/editor.esm.min.js +1 -1
- package/dist/editor.js +201 -11
- package/dist/editor.min.cjs +1 -1
- package/dist/editor.min.js +1 -1
- package/package.json +5 -6
- package/src/Editor.ts +11 -3
- package/src/index.ts +3 -1
- package/types/index.d.ts +25 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-in/editor",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.28",
|
|
4
4
|
"description": "@leafer-in/editor",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,10 +34,9 @@
|
|
|
34
34
|
"leaferjs"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@leafer-ui/core": "1.0.0-rc.
|
|
38
|
-
"@leafer-ui/
|
|
39
|
-
"@leafer-
|
|
40
|
-
"@leafer-in/
|
|
41
|
-
"@leafer-in/interface": "1.0.0-rc.26"
|
|
37
|
+
"@leafer-ui/core": "1.0.0-rc.28",
|
|
38
|
+
"@leafer-ui/interface": "1.0.0-rc.28",
|
|
39
|
+
"@leafer-in/resize": "1.0.0-rc.28",
|
|
40
|
+
"@leafer-in/interface": "1.0.0-rc.28"
|
|
42
41
|
}
|
|
43
42
|
}
|
package/src/Editor.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { onTarget, onHover } from './editor/target'
|
|
|
18
18
|
import { targetAttr } from './decorator/data'
|
|
19
19
|
import { EditorHelper } from './helper/EditorHelper'
|
|
20
20
|
import { EditDataHelper } from './helper/EditDataHelper'
|
|
21
|
+
import { simulate } from './editor/simulate'
|
|
21
22
|
import { updateCursor } from './editor/cursor'
|
|
22
23
|
import { EditToolCreator } from './tool/EditToolCreator'
|
|
23
24
|
import { InnerEditorEvent } from './event/InnerEditorEvent'
|
|
@@ -27,7 +28,11 @@ import { EditorGroupEvent } from './event/EditorGroupEvent'
|
|
|
27
28
|
export class Editor extends Group implements IEditor {
|
|
28
29
|
|
|
29
30
|
public config = config
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
public get mergeConfig(): IEditorConfig {
|
|
33
|
+
const { element, config } = this
|
|
34
|
+
return this.single && element.editConfig ? { ...config, ...element.editConfig } : config // 实时合并,后期可优化
|
|
35
|
+
}
|
|
31
36
|
|
|
32
37
|
@targetAttr(onHover)
|
|
33
38
|
public hoverTarget: IUI
|
|
@@ -116,6 +121,11 @@ export class Editor extends Group implements IEditor {
|
|
|
116
121
|
}
|
|
117
122
|
}
|
|
118
123
|
|
|
124
|
+
public updateEditBox(): void {
|
|
125
|
+
if (this.multiple) simulate(this)
|
|
126
|
+
this.update()
|
|
127
|
+
}
|
|
128
|
+
|
|
119
129
|
public updateEditTool(): void {
|
|
120
130
|
const tool = this.editTool
|
|
121
131
|
if (tool) {
|
|
@@ -127,8 +137,6 @@ export class Editor extends Group implements IEditor {
|
|
|
127
137
|
if (this.editing) {
|
|
128
138
|
const tag = this.single ? this.list[0].editOuter as string : 'EditTool'
|
|
129
139
|
this.editTool = this.editToolList[tag] = this.editToolList[tag] || EditToolCreator.get(tag, this)
|
|
130
|
-
const { editConfig } = this.element
|
|
131
|
-
this.mergeConfig = this.single && editConfig ? { ...this.mergeConfig, ...editConfig } : this.config
|
|
132
140
|
this.editBox.load()
|
|
133
141
|
this.editTool.load()
|
|
134
142
|
}
|
package/src/index.ts
CHANGED
|
@@ -8,12 +8,14 @@ export { EditSelect } from './display/EditSelect'
|
|
|
8
8
|
export { SelectArea } from './display/SelectArea'
|
|
9
9
|
export { Stroker } from './display/Stroker'
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
export { EditorEvent } from './event/EditorEvent'
|
|
13
13
|
export { EditorMoveEvent } from './event/EditorMoveEvent'
|
|
14
14
|
export { EditorScaleEvent } from './event/EditorScaleEvent'
|
|
15
15
|
export { EditorRotateEvent } from './event/EditorRotateEvent'
|
|
16
16
|
export { EditorSkewEvent } from './event/EditorSkewEvent'
|
|
17
|
+
export { EditorGroupEvent } from './event/EditorGroupEvent'
|
|
18
|
+
export { InnerEditorEvent } from './event/InnerEditorEvent'
|
|
17
19
|
|
|
18
20
|
export { EditToolCreator, registerEditTool, registerInnerEditor } from './tool/EditToolCreator'
|
|
19
21
|
export { InnerEditor } from './tool/InnerEditor'
|
package/types/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export * from '@leafer-in/resize';
|
|
|
2
2
|
import { IBounds, ILeafList, IUI, IEventListenerId, ILeaf, IPointerEvent, IGroup, IObject, IPointData, IGroupInputData, IEditSize, IAlign, IBox, IBoundsData, IBoxInputData, IKeyEvent, IRect, IRectInputData, ILeaferCanvas, IRenderOptions, IMatrixData, IDragEvent, IAround } from '@leafer-ui/interface';
|
|
3
3
|
import { Group, Event, Direction9, Box, UI, Answer } from '@leafer-ui/draw';
|
|
4
4
|
import { PointerEvent, DragEvent, MoveEvent, ZoomEvent, RotateEvent } from '@leafer-ui/core';
|
|
5
|
-
import { IEditSelect, IEditor, IStroker, ISelectArea, IEditorConfig, IEditBox, IEditTool, IInnerEditor, IEditorScaleEvent, IEditorEvent, IEditPoint, IEditPointType,
|
|
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
|
|
|
7
7
|
declare class EditSelect extends Group implements IEditSelect {
|
|
8
8
|
editor: IEditor;
|
|
@@ -41,7 +41,7 @@ declare class EditSelect extends Group implements IEditSelect {
|
|
|
41
41
|
|
|
42
42
|
declare class Editor extends Group implements IEditor {
|
|
43
43
|
config: IEditorConfig;
|
|
44
|
-
mergeConfig: IEditorConfig;
|
|
44
|
+
get mergeConfig(): IEditorConfig;
|
|
45
45
|
hoverTarget: IUI;
|
|
46
46
|
target: IUI | IUI[];
|
|
47
47
|
get list(): IUI[];
|
|
@@ -71,6 +71,7 @@ declare class Editor extends Group implements IEditor {
|
|
|
71
71
|
removeItem(item: IUI): void;
|
|
72
72
|
shiftItem(item: IUI): void;
|
|
73
73
|
update(): void;
|
|
74
|
+
updateEditBox(): void;
|
|
74
75
|
updateEditTool(): void;
|
|
75
76
|
getEditSize(_ui: IUI): IEditSize;
|
|
76
77
|
onMove(e: DragEvent): void;
|
|
@@ -177,16 +178,6 @@ declare class Stroker extends UI implements IStroker {
|
|
|
177
178
|
destroy(): void;
|
|
178
179
|
}
|
|
179
180
|
|
|
180
|
-
declare class InnerEditorEvent extends EditorEvent implements IInnerEditorEvent {
|
|
181
|
-
static BEFORE_OPEN: string;
|
|
182
|
-
static OPEN: string;
|
|
183
|
-
static BEFORE_CLOSE: string;
|
|
184
|
-
static CLOSE: string;
|
|
185
|
-
readonly editTarget: IUI;
|
|
186
|
-
readonly innerEditor: IInnerEditor;
|
|
187
|
-
constructor(type: string, data?: IInnerEditorEvent);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
181
|
declare class EditorMoveEvent extends EditorEvent implements IEditorMoveEvent {
|
|
191
182
|
static MOVE: string;
|
|
192
183
|
readonly moveX: number;
|
|
@@ -219,6 +210,26 @@ declare class EditorSkewEvent extends EditorEvent implements IEditorSkewEvent {
|
|
|
219
210
|
constructor(type: string, data?: IEditorSkewEvent);
|
|
220
211
|
}
|
|
221
212
|
|
|
213
|
+
declare class EditorGroupEvent extends EditorEvent implements IEditorGroupEvent {
|
|
214
|
+
static GROUP: string;
|
|
215
|
+
static BEFORE_UNGROUP: string;
|
|
216
|
+
static UNGROUP: string;
|
|
217
|
+
static OPEN: string;
|
|
218
|
+
static CLOSE: string;
|
|
219
|
+
readonly editTarget: IGroup;
|
|
220
|
+
constructor(type: string, data?: IEditorGroupEvent);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
declare class InnerEditorEvent extends EditorEvent implements IInnerEditorEvent {
|
|
224
|
+
static BEFORE_OPEN: string;
|
|
225
|
+
static OPEN: string;
|
|
226
|
+
static BEFORE_CLOSE: string;
|
|
227
|
+
static CLOSE: string;
|
|
228
|
+
readonly editTarget: IUI;
|
|
229
|
+
readonly innerEditor: IInnerEditor;
|
|
230
|
+
constructor(type: string, data?: IInnerEditorEvent);
|
|
231
|
+
}
|
|
232
|
+
|
|
222
233
|
declare function registerEditTool(): (target: IObject) => void;
|
|
223
234
|
declare const registerInnerEditor: typeof registerEditTool;
|
|
224
235
|
declare const EditToolCreator: {
|
|
@@ -281,7 +292,7 @@ declare const EditorHelper: {
|
|
|
281
292
|
};
|
|
282
293
|
|
|
283
294
|
declare const EditDataHelper: {
|
|
284
|
-
getScaleData(bounds: IBoundsData, direction: Direction9, pointMove: IPointData, lockRatio: boolean |
|
|
295
|
+
getScaleData(bounds: IBoundsData, direction: Direction9, pointMove: IPointData, lockRatio: boolean | "corner", around: IAround): IEditorScaleEvent;
|
|
285
296
|
getRotateData(bounds: IBoundsData, direction: Direction9, current: IPointData, last: IPointData, around: IAround): IEditorRotateEvent;
|
|
286
297
|
getSkewData(bounds: IBoundsData, direction: Direction9, move: IPointData, around: IAround): IEditorSkewEvent;
|
|
287
298
|
getAround(around: IAround, altKey: boolean): IAround;
|
|
@@ -294,4 +305,4 @@ declare const EditSelectHelper: {
|
|
|
294
305
|
findBounds(leaf: IUI, bounds: IBounds): Answer;
|
|
295
306
|
};
|
|
296
307
|
|
|
297
|
-
export { EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, InnerEditor, InnerEditorEvent, LineEditTool, SelectArea, Stroker, registerEditTool, registerInnerEditor };
|
|
308
|
+
export { EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, InnerEditor, InnerEditorEvent, LineEditTool, SelectArea, Stroker, registerEditTool, registerInnerEditor };
|