@leafer-in/editor 1.0.0-rc.27 → 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/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
- public mergeConfig = config // 实际使用
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/types/index.d.ts CHANGED
@@ -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;
@@ -291,7 +292,7 @@ declare const EditorHelper: {
291
292
  };
292
293
 
293
294
  declare const EditDataHelper: {
294
- getScaleData(bounds: IBoundsData, direction: Direction9, pointMove: IPointData, lockRatio: boolean | 'corner', around: IAround): IEditorScaleEvent;
295
+ getScaleData(bounds: IBoundsData, direction: Direction9, pointMove: IPointData, lockRatio: boolean | "corner", around: IAround): IEditorScaleEvent;
295
296
  getRotateData(bounds: IBoundsData, direction: Direction9, current: IPointData, last: IPointData, around: IAround): IEditorRotateEvent;
296
297
  getSkewData(bounds: IBoundsData, direction: Direction9, move: IPointData, around: IAround): IEditorSkewEvent;
297
298
  getAround(around: IAround, altKey: boolean): IAround;