@leafer/display-module 1.0.0-rc.19 → 1.0.0-rc.20
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 +6 -5
- package/src/LeafBounds.ts +3 -2
- package/src/LeafDataProxy.ts +16 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/display-module",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.20",
|
|
4
4
|
"description": "@leafer/display-module",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,11 +22,12 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/helper": "1.0.0-rc.
|
|
26
|
-
"@leafer/event": "1.0.0-rc.
|
|
27
|
-
"@leafer/math": "1.0.0-rc.
|
|
25
|
+
"@leafer/helper": "1.0.0-rc.20",
|
|
26
|
+
"@leafer/event": "1.0.0-rc.20",
|
|
27
|
+
"@leafer/math": "1.0.0-rc.20",
|
|
28
|
+
"@leafer/debug": "1.0.0-rc.20"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
|
-
"@leafer/interface": "1.0.0-rc.
|
|
31
|
+
"@leafer/interface": "1.0.0-rc.20"
|
|
31
32
|
}
|
|
32
33
|
}
|
package/src/LeafBounds.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { BranchHelper, LeafHelper } from '@leafer/helper'
|
|
|
6
6
|
|
|
7
7
|
const { updateMatrix, updateAllMatrix, hasParentAutoLayout } = LeafHelper
|
|
8
8
|
const { updateBounds } = BranchHelper
|
|
9
|
-
const { toOuterOf, copyAndSpread } = BoundsHelper
|
|
9
|
+
const { toOuterOf, copyAndSpread, copy } = BoundsHelper
|
|
10
10
|
const { toBounds } = PathBounds
|
|
11
11
|
|
|
12
12
|
export const LeafBounds: ILeafBoundsModule = {
|
|
@@ -153,7 +153,8 @@ export const LeafBounds: ILeafBoundsModule = {
|
|
|
153
153
|
},
|
|
154
154
|
|
|
155
155
|
__updateRenderBounds(): void {
|
|
156
|
-
|
|
156
|
+
const { renderSpread, strokeBounds, renderBounds } = this.__layout
|
|
157
|
+
renderSpread > 0 ? copyAndSpread(renderBounds, strokeBounds, renderSpread) : copy(renderBounds, strokeBounds) // Box use -1
|
|
157
158
|
},
|
|
158
159
|
|
|
159
160
|
}
|
package/src/LeafDataProxy.ts
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { ILeafDataProxyModule, IObject, IValue } from '@leafer/interface'
|
|
2
2
|
import { PropertyEvent } from '@leafer/event'
|
|
3
|
+
import { Debug } from '@leafer/debug'
|
|
3
4
|
|
|
4
5
|
|
|
6
|
+
const { isFinite } = Number
|
|
7
|
+
const debug = Debug.get('setAttr')
|
|
8
|
+
|
|
5
9
|
export const LeafDataProxy: ILeafDataProxyModule = {
|
|
6
10
|
|
|
7
|
-
__setAttr(name: string, newValue: IValue):
|
|
11
|
+
__setAttr(name: string, newValue: IValue, checkFiniteNumber?: boolean): boolean {
|
|
8
12
|
if (this.leafer && this.leafer.created) {
|
|
9
13
|
const oldValue = this.__.__getInput(name)
|
|
14
|
+
|
|
15
|
+
if (checkFiniteNumber && !isFinite(newValue) && newValue !== undefined) { // 警告 NaN、Infinity、-Infinity、null、非有效数字
|
|
16
|
+
debug.warn(this.innerName, name, newValue)
|
|
17
|
+
newValue = undefined // must
|
|
18
|
+
}
|
|
19
|
+
|
|
10
20
|
if (typeof newValue === 'object' || oldValue !== newValue) {
|
|
11
21
|
(this.__ as IObject)[name] = newValue
|
|
12
22
|
if (this.__proxyData) this.setProxyAttr(name, newValue)
|
|
@@ -21,10 +31,15 @@ export const LeafDataProxy: ILeafDataProxyModule = {
|
|
|
21
31
|
}
|
|
22
32
|
|
|
23
33
|
this.leafer.emitEvent(event)
|
|
34
|
+
return true
|
|
35
|
+
} else {
|
|
36
|
+
return false
|
|
24
37
|
}
|
|
38
|
+
|
|
25
39
|
} else {
|
|
26
40
|
(this.__ as IObject)[name] = newValue
|
|
27
41
|
if (this.__proxyData) this.setProxyAttr(name, newValue)
|
|
42
|
+
return true
|
|
28
43
|
}
|
|
29
44
|
},
|
|
30
45
|
|