@leafer/display-module 1.7.0 → 1.9.0
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 +7 -6
- package/src/BranchRender.ts +3 -5
- package/src/LeafDataProxy.ts +10 -5
- package/src/LeafMatrix.ts +3 -2
- package/src/LeafRender.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/display-module",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "@leafer/display-module",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,12 +22,13 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/helper": "1.
|
|
26
|
-
"@leafer/event": "1.
|
|
27
|
-
"@leafer/math": "1.
|
|
28
|
-
"@leafer/
|
|
25
|
+
"@leafer/helper": "1.9.0",
|
|
26
|
+
"@leafer/event": "1.9.0",
|
|
27
|
+
"@leafer/math": "1.9.0",
|
|
28
|
+
"@leafer/data": "1.9.0",
|
|
29
|
+
"@leafer/debug": "1.9.0"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
|
-
"@leafer/interface": "1.
|
|
32
|
+
"@leafer/interface": "1.9.0"
|
|
32
33
|
}
|
|
33
34
|
}
|
package/src/BranchRender.ts
CHANGED
|
@@ -28,7 +28,7 @@ export const BranchRender: IBranchRenderModule = {
|
|
|
28
28
|
if (data.dim) options.dimOpacity = data.dim === true ? 0.2 : data.dim
|
|
29
29
|
else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0)
|
|
30
30
|
|
|
31
|
-
if (data.__single) {
|
|
31
|
+
if (data.__single && !this.isBranchLeaf) { // Frame / Box 不能走 single 逻辑渲染组,需用 drawAfterFill 渲染成一个整体, 关联设置 BoxData.__drawAfterFill
|
|
32
32
|
|
|
33
33
|
if (data.eraser === 'path') return this.__renderEraser(canvas, options)
|
|
34
34
|
|
|
@@ -62,8 +62,7 @@ export const BranchRender: IBranchRenderModule = {
|
|
|
62
62
|
|
|
63
63
|
const { children } = this
|
|
64
64
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
65
|
-
|
|
66
|
-
children[i].__render(canvas, options)
|
|
65
|
+
excludeRenderBounds(children[i], options) || children[i].__render(canvas, options)
|
|
67
66
|
}
|
|
68
67
|
|
|
69
68
|
}
|
|
@@ -74,8 +73,7 @@ export const BranchRender: IBranchRenderModule = {
|
|
|
74
73
|
if (this.__worldOpacity) {
|
|
75
74
|
const { children } = this
|
|
76
75
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
77
|
-
|
|
78
|
-
children[i].__clip(canvas, options)
|
|
76
|
+
excludeRenderBounds(children[i], options) || children[i].__clip(canvas, options)
|
|
79
77
|
}
|
|
80
78
|
}
|
|
81
79
|
}
|
package/src/LeafDataProxy.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ILeafDataProxyModule, IObject, IValue } from '@leafer/interface'
|
|
2
|
-
import { PropertyEvent } from '@leafer/event'
|
|
2
|
+
import { PropertyEvent, LeaferEvent, leaferTransformAttrMap } from '@leafer/event'
|
|
3
|
+
import { isObject, isFinite, isUndefined } from '@leafer/data'
|
|
3
4
|
import { Debug } from '@leafer/debug'
|
|
4
5
|
|
|
5
6
|
|
|
6
|
-
const { isFinite } = Number
|
|
7
7
|
const debug = Debug.get('setAttr')
|
|
8
8
|
|
|
9
9
|
export const LeafDataProxy: ILeafDataProxyModule = {
|
|
@@ -13,12 +13,12 @@ export const LeafDataProxy: ILeafDataProxyModule = {
|
|
|
13
13
|
|
|
14
14
|
const oldValue = this.__.__getInput(name)
|
|
15
15
|
|
|
16
|
-
if (checkFiniteNumber && !isFinite(newValue) && newValue
|
|
16
|
+
if (checkFiniteNumber && !isFinite(newValue) && !isUndefined(newValue)) { // 警告 NaN、Infinity、-Infinity、null、非有效数字
|
|
17
17
|
debug.warn(this.innerName, name, newValue)
|
|
18
18
|
newValue = undefined // must
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
if (
|
|
21
|
+
if (isObject(newValue) || oldValue !== newValue) {
|
|
22
22
|
|
|
23
23
|
this.__realSetAttr(name, newValue)
|
|
24
24
|
|
|
@@ -27,6 +27,11 @@ export const LeafDataProxy: ILeafDataProxyModule = {
|
|
|
27
27
|
|
|
28
28
|
if (this.isLeafer) {
|
|
29
29
|
this.emitEvent(new PropertyEvent(PropertyEvent.LEAFER_CHANGE, this, name, oldValue, newValue))
|
|
30
|
+
const transformEventName = leaferTransformAttrMap[name]
|
|
31
|
+
if (transformEventName) {
|
|
32
|
+
this.emitEvent(new LeaferEvent(transformEventName, this))
|
|
33
|
+
this.emitEvent(new LeaferEvent(LeaferEvent.TRANSFORM, this))
|
|
34
|
+
}
|
|
30
35
|
} else {
|
|
31
36
|
if (this.hasEvent(CHANGE)) this.emitEvent(event)
|
|
32
37
|
}
|
|
@@ -51,7 +56,7 @@ export const LeafDataProxy: ILeafDataProxyModule = {
|
|
|
51
56
|
const data = this.__ as IObject
|
|
52
57
|
data[name] = newValue
|
|
53
58
|
if (this.__proxyData) this.setProxyAttr(name, newValue)
|
|
54
|
-
if (data.normalStyle) this.lockNormalStyle || data.normalStyle[name]
|
|
59
|
+
if (data.normalStyle) this.lockNormalStyle || isUndefined(data.normalStyle[name]) || (data.normalStyle[name] = newValue)
|
|
55
60
|
},
|
|
56
61
|
|
|
57
62
|
|
package/src/LeafMatrix.ts
CHANGED
|
@@ -9,7 +9,8 @@ export const LeafMatrix: ILeafMatrixModule = {
|
|
|
9
9
|
|
|
10
10
|
__updateWorldMatrix(): void {
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
const { parent, __layout } = this
|
|
13
|
+
multiplyParent(this.__local || __layout, parent ? parent.__world : defaultWorld, this.__world, !!__layout.affectScaleOrRotation, this.__ as ILayoutData, parent && (parent.scrollY || parent.scrollX) && parent.__ as IScrollPointData)
|
|
13
14
|
|
|
14
15
|
},
|
|
15
16
|
|
|
@@ -21,7 +22,7 @@ export const LeafMatrix: ILeafMatrixModule = {
|
|
|
21
22
|
|
|
22
23
|
if (layout.affectScaleOrRotation) {
|
|
23
24
|
|
|
24
|
-
if ((layout.scaleChanged && (layout.resized = 'scale')) || layout.rotationChanged) {
|
|
25
|
+
if ((layout.scaleChanged && (layout.resized || (layout.resized = 'scale'))) || layout.rotationChanged) {
|
|
25
26
|
setLayout(local, data as ILayoutData, null, null, layout.affectRotation)
|
|
26
27
|
layout.scaleChanged = layout.rotationChanged = undefined
|
|
27
28
|
}
|
package/src/LeafRender.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ILeaferCanvas, IRenderOptions, ILeafRenderModule } from '@leafer/interface'
|
|
2
|
+
import { LeafHelper } from '@leafer/helper'
|
|
2
3
|
import { Debug } from '@leafer/debug'
|
|
3
4
|
|
|
4
5
|
|
|
@@ -22,8 +23,7 @@ export const LeafRender: ILeafRenderModule = {
|
|
|
22
23
|
const tempCanvas = canvas.getSameCanvas(true, true)
|
|
23
24
|
this.__draw(tempCanvas, options, canvas)
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
else canvas.copyWorldToInner(tempCanvas, this.__nowWorld, this.__layout.renderBounds, data.__blendMode)
|
|
26
|
+
LeafHelper.copyCanvasByWorld(this, canvas, tempCanvas, this.__nowWorld, data.__blendMode, true)
|
|
27
27
|
|
|
28
28
|
tempCanvas.recycle(this.__nowWorld)
|
|
29
29
|
|