@leafer-in/editor 2.2.2 → 2.2.4
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 +22 -14
- package/dist/editor.esm.js +22 -14
- package/dist/editor.esm.min.js +1 -1
- package/dist/editor.esm.min.js.map +1 -1
- package/dist/editor.js +22 -14
- package/dist/editor.min.cjs +1 -1
- package/dist/editor.min.cjs.map +1 -1
- package/dist/editor.min.js +1 -1
- package/dist/editor.min.js.map +1 -1
- package/package.json +6 -6
- package/src/decorator/data.ts +4 -1
- package/src/display/EditSelect.ts +1 -1
- package/src/helper/EditSelectHelper.ts +18 -11
- package/src/tool/LineEditTool.ts +2 -1
- package/types/index.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-in/editor",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.4",
|
|
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.
|
|
38
|
-
"@leafer-ui/core": "^2.2.
|
|
39
|
-
"@leafer-in/resize": "^2.2.
|
|
40
|
-
"@leafer-ui/interface": "^2.2.
|
|
41
|
-
"@leafer-in/interface": "^2.2.
|
|
37
|
+
"@leafer-ui/draw": "^2.2.4",
|
|
38
|
+
"@leafer-ui/core": "^2.2.4",
|
|
39
|
+
"@leafer-in/resize": "^2.2.4",
|
|
40
|
+
"@leafer-ui/interface": "^2.2.4",
|
|
41
|
+
"@leafer-in/interface": "^2.2.4"
|
|
42
42
|
}
|
|
43
43
|
}
|
package/src/decorator/data.ts
CHANGED
|
@@ -31,7 +31,10 @@ export function targetAttr(fn: IFunction) {
|
|
|
31
31
|
|
|
32
32
|
if (t.hasDimOthers) t.cancelDimOthers()
|
|
33
33
|
|
|
34
|
-
if (isArray(value) && value.length > 1 && value
|
|
34
|
+
if (isArray(value) && value.length > 1 && value.some(item => item.locked || item.editable === 'single')) {
|
|
35
|
+
value = value.filter(item => !(item.locked || item.editable === 'single')) // 锁定、单选元素不能参与多选
|
|
36
|
+
}
|
|
37
|
+
|
|
35
38
|
if (t.single) {
|
|
36
39
|
delete t.element.syncEventer // 重置 EditBox.load() 同步事件设置
|
|
37
40
|
delete t.element.__world.ignorePixelSnap // 重置 EditBox.load() 忽略对齐像素设置
|
|
@@ -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.
|
|
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
|
|
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/src/tool/LineEditTool.ts
CHANGED
|
@@ -112,7 +112,8 @@ export class LineEditTool extends EditTool {
|
|
|
112
112
|
const { from, to } = fromTo
|
|
113
113
|
line.innerToWorld(from, from, false, editBox)
|
|
114
114
|
line.innerToWorld(to, to, false, editBox)
|
|
115
|
-
|
|
115
|
+
const { x, y } = editBox.rectBounds
|
|
116
|
+
rect.pen.clearPath().moveTo(from.x - x, from.y - y).lineTo(to.x - x, to.y - y)
|
|
116
117
|
copy(resizePoints[7] as IPointData, from)
|
|
117
118
|
copy(rotatePoints[7] as IPointData, from)
|
|
118
119
|
copy(resizePoints[3] as IPointData, to)
|
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 };
|