@leafer-in/editor 2.0.3 → 2.0.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/dist/editor.cjs +19 -10
- package/dist/editor.esm.js +19 -10
- package/dist/editor.esm.min.js +1 -1
- package/dist/editor.esm.min.js.map +1 -1
- package/dist/editor.js +19 -10
- 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/Editor.ts +2 -0
- package/src/config.ts +3 -0
- package/src/decorator/data.ts +2 -2
- package/src/display/EditBox.ts +16 -8
- package/types/index.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-in/editor",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.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.0.
|
|
38
|
-
"@leafer-ui/core": "^2.0.
|
|
39
|
-
"@leafer-in/resize": "^2.0.
|
|
40
|
-
"@leafer-ui/interface": "^2.0.
|
|
41
|
-
"@leafer-in/interface": "^2.0.
|
|
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"
|
|
42
42
|
}
|
|
43
43
|
}
|
package/src/Editor.ts
CHANGED
|
@@ -80,6 +80,8 @@ export class Editor extends Group implements IEditor {
|
|
|
80
80
|
public selector: EditSelect = new EditSelect(this)
|
|
81
81
|
public editMask: EditMask = new EditMask(this)
|
|
82
82
|
|
|
83
|
+
public hasDimOthers?: boolean
|
|
84
|
+
|
|
83
85
|
public get targetLeafer() { const first = this.list[0]; return first && first.leafer }
|
|
84
86
|
public targetChanged: boolean
|
|
85
87
|
public targetEventIds: IEventListenerId[] = []
|
package/src/config.ts
CHANGED
package/src/decorator/data.ts
CHANGED
|
@@ -28,10 +28,10 @@ export function targetAttr(fn: IFunction) {
|
|
|
28
28
|
else if (check === false) return
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
if (!isUndefined(dimOthers) || !isUndefined(bright)) {
|
|
31
|
+
if (t.hasDimOthers) {
|
|
33
32
|
t.setDimOthers(false)
|
|
34
33
|
t.setBright(false)
|
|
34
|
+
t.hasDimOthers = undefined
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
if (isArray(value) && value.length > 1 && value[0].locked) value.splice(0, 1) // fix: 单个锁定 + shift多选
|
package/src/display/EditBox.ts
CHANGED
|
@@ -174,6 +174,7 @@ export class EditBox extends Group implements IEditBox {
|
|
|
174
174
|
if (!isUndefined(dimOthers) || !isUndefined(bright)) { // 没有配置时不强制bright
|
|
175
175
|
editor.setDimOthers(dimOthers)
|
|
176
176
|
editor.setBright(!!dimOthers || bright)
|
|
177
|
+
editor.hasDimOthers = true
|
|
177
178
|
}
|
|
178
179
|
|
|
179
180
|
if (spread) BoundsHelper.spread(bounds, spread)
|
|
@@ -300,10 +301,12 @@ export class EditBox extends Group implements IEditBox {
|
|
|
300
301
|
public onDragStart(e: DragEvent): void {
|
|
301
302
|
this.dragging = true
|
|
302
303
|
const point = this.dragPoint = e.current as IEditPoint, { pointType } = point
|
|
303
|
-
const { moveable, resizeable, rotateable, skewable } = this.mergeConfig
|
|
304
|
+
const { moveable, resizeable, rotateable, skewable, onCopy } = this.mergeConfig
|
|
304
305
|
|
|
305
306
|
// 确定模式
|
|
306
307
|
if (pointType === 'move') {
|
|
308
|
+
// alt复制钩子
|
|
309
|
+
if (e.altKey && onCopy && onCopy() && this.editor.single) this.app.interaction.replaceDownTarget(this.target)
|
|
307
310
|
moveable && (this.moving = true)
|
|
308
311
|
} else {
|
|
309
312
|
if (pointType.includes('rotate') || this.isHoldRotateKey(e) || !resizeable) {
|
|
@@ -417,23 +420,28 @@ export class EditBox extends Group implements IEditBox {
|
|
|
417
420
|
}
|
|
418
421
|
|
|
419
422
|
public onArrow(e: IKeyEvent): void {
|
|
420
|
-
if (this.canUse
|
|
423
|
+
if (this.canUse) {
|
|
421
424
|
let x = 0, y = 0
|
|
422
|
-
const distance = e.shiftKey ? 10 : 1
|
|
423
425
|
switch (e.code) {
|
|
424
426
|
case 'ArrowDown':
|
|
425
|
-
y =
|
|
427
|
+
y = 1
|
|
426
428
|
break
|
|
427
429
|
case 'ArrowUp':
|
|
428
|
-
y = -
|
|
430
|
+
y = -1
|
|
429
431
|
break
|
|
430
432
|
case 'ArrowLeft':
|
|
431
|
-
x = -
|
|
433
|
+
x = -1
|
|
432
434
|
break
|
|
433
435
|
case 'ArrowRight':
|
|
434
|
-
x =
|
|
436
|
+
x = 1
|
|
437
|
+
}
|
|
438
|
+
if (x || y) {
|
|
439
|
+
const { keyEvent, arrowStep, arrowFastStep } = this.mergeConfig
|
|
440
|
+
if (keyEvent) {
|
|
441
|
+
const step = e.shiftKey ? arrowFastStep : arrowStep
|
|
442
|
+
this.transformTool.move(x * step, y * step)
|
|
443
|
+
}
|
|
435
444
|
}
|
|
436
|
-
if (x || y) this.transformTool.move(x, y)
|
|
437
445
|
}
|
|
438
446
|
}
|
|
439
447
|
|
package/types/index.d.ts
CHANGED
|
@@ -82,6 +82,7 @@ declare class Editor extends Group implements IEditor {
|
|
|
82
82
|
editToolList: IObject;
|
|
83
83
|
selector: EditSelect;
|
|
84
84
|
editMask: EditMask;
|
|
85
|
+
hasDimOthers?: boolean;
|
|
85
86
|
get targetLeafer(): _leafer_ui_interface.ILeafer;
|
|
86
87
|
targetChanged: boolean;
|
|
87
88
|
targetEventIds: IEventListenerId[];
|