@leafer-in/editor 2.0.5 → 2.0.7

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.0.5",
3
+ "version": "2.0.7",
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.0.5",
38
- "@leafer-ui/core": "^2.0.5",
39
- "@leafer-in/resize": "^2.0.5",
40
- "@leafer-ui/interface": "^2.0.5",
41
- "@leafer-in/interface": "^2.0.5"
37
+ "@leafer-ui/draw": "^2.0.7",
38
+ "@leafer-ui/core": "^2.0.7",
39
+ "@leafer-in/resize": "^2.0.7",
40
+ "@leafer-ui/interface": "^2.0.7",
41
+ "@leafer-in/interface": "^2.0.7"
42
42
  }
43
43
  }
package/src/Editor.ts CHANGED
@@ -143,6 +143,12 @@ export class Editor extends Group implements IEditor {
143
143
  this.setDimOthers(value, 'bright', this.list)
144
144
  }
145
145
 
146
+ public cancelDimOthers(): void {
147
+ this.setDimOthers(false)
148
+ this.setBright(false)
149
+ this.hasDimOthers = undefined
150
+ }
151
+
146
152
  // update
147
153
 
148
154
  public update(): void {
@@ -28,11 +28,7 @@ export function targetAttr(fn: IFunction) {
28
28
  else if (check === false) return
29
29
  }
30
30
 
31
- if (t.hasDimOthers) {
32
- t.setDimOthers(false)
33
- t.setBright(false)
34
- t.hasDimOthers = undefined
35
- }
31
+ if (t.hasDimOthers) t.cancelDimOthers()
36
32
 
37
33
  if (isArray(value) && value.length > 1 && value[0].locked) value.splice(0, 1) // fix: 单个锁定 + shift多选
38
34
  if (t.single) {
@@ -175,6 +175,8 @@ export class EditBox extends Group implements IEditBox {
175
175
  editor.setDimOthers(dimOthers)
176
176
  editor.setBright(!!dimOthers || bright)
177
177
  editor.hasDimOthers = true
178
+ } else if (editor.hasDimOthers) {
179
+ editor.cancelDimOthers()
178
180
  }
179
181
 
180
182
  if (spread) BoundsHelper.spread(bounds, spread)
package/types/index.d.ts CHANGED
@@ -96,6 +96,7 @@ declare class Editor extends Group implements IEditor {
96
96
  shiftItem(item: IUI): void;
97
97
  setDimOthers(value: boolean | number, attrName?: 'bright' | 'dim', list?: IUI[]): void;
98
98
  setBright(value: boolean): void;
99
+ cancelDimOthers(): void;
99
100
  update(): void;
100
101
  updateEditBox(): void;
101
102
  getEditTool(name: string): IEditTool;