@leafer-in/editor 2.2.3 → 2.2.5

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.3",
3
+ "version": "2.2.5",
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.3",
38
- "@leafer-ui/core": "^2.2.3",
39
- "@leafer-in/resize": "^2.2.3",
40
- "@leafer-ui/interface": "^2.2.3",
41
- "@leafer-in/interface": "^2.2.3"
37
+ "@leafer-ui/draw": "^2.2.5",
38
+ "@leafer-ui/core": "^2.2.5",
39
+ "@leafer-in/resize": "^2.2.5",
40
+ "@leafer-ui/interface": "^2.2.5",
41
+ "@leafer-in/interface": "^2.2.5"
42
42
  }
43
43
  }
@@ -169,7 +169,7 @@ export class EditSelect extends Group implements IEditSelect {
169
169
  const total = e.getInnerTotal(this)
170
170
 
171
171
  const dragBounds = this.bounds.clone().unsign()
172
- const list = new LeafList(findByBounds(editor.app, dragBounds))
172
+ const list = new LeafList(findByBounds(editor.app, dragBounds, editor.mergedConfig.boxSelect === 'includes' ? 'includes' : 'hit'))
173
173
 
174
174
  this.bounds.width = total.x
175
175
  this.bounds.height = total.y
@@ -7,34 +7,41 @@ export const EditSelectHelper = {
7
7
  return path.list.find((leaf) => leaf.editable) as IUI
8
8
  },
9
9
 
10
- findByBounds(branch: IUI, bounds: IBounds): IUI[] {
10
+ findByBounds(branch: IUI, bounds: IBounds, mode: 'hit' | 'includes' = 'hit'): IUI[] {
11
11
  const list: IUI[] = []
12
- eachFind([branch], list, bounds)
12
+ eachFind([branch], list, bounds, mode)
13
13
  return list
14
14
  }
15
15
 
16
16
  }
17
17
 
18
18
 
19
- function eachFind(children: IUI[], list: IUI[], bounds: IBounds): void {
20
- let child: IUI, data: IUIData
19
+ function eachFind(children: IUI[], list: IUI[], bounds: IBounds, mode: 'hit' | 'includes'): void {
20
+ let child: IUI, data: IUIData, isFind: boolean
21
21
  for (let i = 0, len = children.length; i < len; i++) {
22
22
  child = children[i], data = child.__
23
23
  if (data.hittable && data.visible && !data.locked && bounds.hit(child.__world)) {
24
24
 
25
- if (data.editable) {
26
- if (child.isBranch && !data.hitChildren) {
27
- if (data.hitSelf) list.push(child)
28
- continue
29
- } else if (child.isFrame) {
25
+ if (data.editable && data.editable !== 'single') {
26
+ if (child.isFrame) {
30
27
  if (bounds.includes(child.__layout.boxBounds, child.__world)) {
31
28
  list.push(child)
32
29
  continue
33
30
  }
34
- } else if (bounds.hit(child.__layout.boxBounds, child.__world) && data.hitSelf) list.push(child)
31
+ } else {
32
+
33
+ isFind = bounds[mode](child.__layout.boxBounds, child.__world) && data.hitSelf
34
+
35
+ if (child.isBranch) {
36
+ if (!data.hitChildren) {
37
+ if (isFind) list.push(child)
38
+ continue
39
+ }
40
+ } else if (isFind) list.push(child)
41
+ }
35
42
  }
36
43
 
37
- if (child.isBranch) eachFind(child.children, list, bounds)
44
+ if (child.isBranch) eachFind(child.children, list, bounds, mode)
38
45
 
39
46
  }
40
47
  }
package/types/index.d.ts CHANGED
@@ -429,7 +429,7 @@ declare const EditDataHelper: {
429
429
 
430
430
  declare const EditSelectHelper: {
431
431
  findOne(path: ILeafList): IUI;
432
- findByBounds(branch: IUI, bounds: IBounds): IUI[];
432
+ findByBounds(branch: IUI, bounds: IBounds, mode?: "hit" | "includes"): IUI[];
433
433
  };
434
434
 
435
435
  export { EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, InnerEditor, InnerEditorEvent, LineEditTool, SelectArea, Stroker, TransformTool, editToolMergeConfigAttr, registerEditTool, registerInnerEditor };