@leafer-in/editor 2.2.7 → 2.2.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-in/editor",
3
- "version": "2.2.7",
3
+ "version": "2.2.9",
4
4
  "description": "@leafer-in/editor",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -34,10 +34,10 @@
34
34
  "leaferjs"
35
35
  ],
36
36
  "peerDependencies": {
37
- "@leafer-ui/draw": "^2.2.7",
38
- "@leafer-ui/core": "^2.2.7",
39
- "@leafer-in/resize": "^2.2.7",
40
- "@leafer-ui/interface": "^2.2.7",
41
- "@leafer-in/interface": "^2.2.7"
37
+ "@leafer-ui/draw": "^2.2.9",
38
+ "@leafer-ui/core": "^2.2.9",
39
+ "@leafer-in/resize": "^2.2.9",
40
+ "@leafer-ui/interface": "^2.2.9",
41
+ "@leafer-in/interface": "^2.2.9"
42
42
  }
43
43
  }
package/src/Editor.ts CHANGED
@@ -154,8 +154,7 @@ export class Editor extends Group implements IEditor {
154
154
  public update(): void {
155
155
  if (this.editing) {
156
156
  if (!this.element.parent) return this.cancel()
157
- if (this.innerEditing) this.innerEditor.update()
158
- this.editTool.update()
157
+ this.innerEditing ? this.innerEditor.update() : this.editTool.update() // 同一时间只能有一个工具更新
159
158
  this.selector.update()
160
159
  }
161
160
  }
@@ -290,6 +289,7 @@ export class Editor extends Group implements IEditor {
290
289
  if (opened.length) {
291
290
  let { list } = opened
292
291
  if (this.editing) list = [], opened.forEach(item => this.list.every(leaf => !LeafHelper.hasParent(leaf, item)) && list.push(item))
292
+ else list = [...list] // 防止 list 循环时被修改
293
293
  list.forEach(item => this.closeGroup(item as IGroup))
294
294
  }
295
295
  if (this.editing && !this.selector.dragging) this.checkDeepSelect()
@@ -153,10 +153,7 @@ export class EditBox extends Group implements IEditBox {
153
153
  const rectThrough = isNull(mergeConfig.rectThrough) ? single : mergeConfig.rectThrough
154
154
  rect.hittable = !rectThrough
155
155
 
156
- if (rectThrough) {
157
- target.syncEventer = rect // 同步给 rect 冒泡,在 target 属性装饰器中重置
158
- this.app.interaction.bottomList = [{ target: rect, proxy: target }]
159
- }
156
+ if (rectThrough) this.addBottomList()
160
157
 
161
158
  // 忽略元素像素对齐,在 target 属性装饰器中重置
162
159
  if (single) DataHelper.stintSet(target.__world, 'ignorePixelSnap', ignorePixelSnap)
@@ -179,6 +176,17 @@ export class EditBox extends Group implements IEditBox {
179
176
  public unload(): void {
180
177
  this.unloadWidgets()
181
178
  this.visible = false
179
+ this.removeBottomList()
180
+ }
181
+
182
+
183
+ public addBottomList(): void {
184
+ const { target, rect } = this
185
+ target.syncEventer = rect // 同步给 rect 冒泡,在 target 属性装饰器中重置
186
+ this.app.interaction.bottomList = [{ target: rect, proxy: target }]
187
+ }
188
+
189
+ public removeBottomList(): void {
182
190
  if (this.app) this.rect.syncEventer = this.app.interaction.bottomList = null
183
191
  }
184
192
 
@@ -43,6 +43,7 @@ export class Stroker extends UI implements IStroker {
43
43
  if (style) this.set(style)
44
44
  this.set(bounds)
45
45
  this.visible = true
46
+ this.forceUpdate('surface') // 防止bounds相同不更新
46
47
  } else this.visible = 0
47
48
  }
48
49
 
@@ -67,20 +67,18 @@ export class EditTool extends InnerEditor implements IEditTool {
67
67
  // 状态
68
68
 
69
69
  public load(): void {
70
- this.editBox.view.visible = true
71
- this.onLoad()
72
- }
73
-
74
- public update(): void {
75
- this.updateEditBoxConfig()
76
- this.editBox.update()
77
- this.onUpdate()
70
+ if (this.editor) {
71
+ this.editBox.view.visible = true
72
+ this.onLoad()
73
+ }
78
74
  }
79
75
 
80
76
  public unload(): void {
81
- this.editBox.view.visible = false
82
- this.unloadEditBoxConfig()
83
- this.onUnload()
77
+ if (this.editor) {
78
+ this.editBox.view.visible = false
79
+ this.unloadEditBoxConfig()
80
+ this.onUnload()
81
+ }
84
82
  }
85
83
 
86
84
  }
@@ -92,6 +92,7 @@ export class InnerEditor implements IInnerEditor {
92
92
  public update(): void {
93
93
  if (this.editor) {
94
94
  this.updateEditBoxConfig()
95
+ this.editBox.update()
95
96
  this.onUpdate()
96
97
  }
97
98
  }
package/types/index.d.ts CHANGED
@@ -185,6 +185,8 @@ declare class EditBox extends Group implements IEditBox {
185
185
  load(): void;
186
186
  update(): void;
187
187
  unload(): void;
188
+ addBottomList(): void;
189
+ removeBottomList(): void;
188
190
  updateBounds(bounds: IBoundsData): void;
189
191
  protected layoutCircle(): void;
190
192
  protected layoutButtons(): void;
@@ -379,7 +381,6 @@ declare class EditTool extends InnerEditor implements IEditTool {
379
381
  onRotate(e: IEditorRotateEvent): void;
380
382
  onSkew(e: IEditorSkewEvent): void;
381
383
  load(): void;
382
- update(): void;
383
384
  unload(): void;
384
385
  }
385
386
  interface EditTool {