@leafer/display-module 1.6.2 → 1.6.3

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/display-module",
3
- "version": "1.6.2",
3
+ "version": "1.6.3",
4
4
  "description": "@leafer/display-module",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,12 +22,12 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/helper": "1.6.2",
26
- "@leafer/event": "1.6.2",
27
- "@leafer/math": "1.6.2",
28
- "@leafer/debug": "1.6.2"
25
+ "@leafer/helper": "1.6.3",
26
+ "@leafer/event": "1.6.3",
27
+ "@leafer/math": "1.6.3",
28
+ "@leafer/debug": "1.6.3"
29
29
  },
30
30
  "devDependencies": {
31
- "@leafer/interface": "1.6.2"
31
+ "@leafer/interface": "1.6.3"
32
32
  }
33
33
  }
package/src/LeafBounds.ts CHANGED
@@ -2,6 +2,7 @@ import { ILeafBoundsModule } from '@leafer/interface'
2
2
  import { BoundsHelper } from '@leafer/math'
3
3
  import { PathBounds } from '@leafer/path'
4
4
  import { BranchHelper, LeafHelper } from '@leafer/helper'
5
+ import { BoundsEvent } from '@leafer/event'
5
6
 
6
7
 
7
8
  const { updateMatrix, updateAllMatrix } = LeafHelper
@@ -13,13 +14,18 @@ export const LeafBounds: ILeafBoundsModule = {
13
14
 
14
15
  __updateWorldBounds(): void {
15
16
 
16
- toOuterOf(this.__layout.renderBounds, this.__world, this.__world)
17
+ const layout = this.__layout
18
+
19
+ toOuterOf(layout.renderBounds, this.__world, this.__world)
17
20
 
18
- if (this.__layout.resized) {
19
- this.__onUpdateSize()
20
- this.__layout.resized = false
21
+ if (layout.resized) {
22
+ if (layout.resized === 'inner') this.__onUpdateSize() // scale变化不用更新
23
+ if (this.__hasLocalEvent) BoundsEvent.emitLocal(this)
24
+ layout.resized = undefined
21
25
  }
22
26
 
27
+ if (this.__hasWorldEvent) BoundsEvent.emitWorld(this)
28
+
23
29
  },
24
30
 
25
31
  __updateLocalBounds(): void {
@@ -32,14 +38,14 @@ export const LeafBounds: ILeafBoundsModule = {
32
38
  this.__updateRenderPath()
33
39
 
34
40
  this.__updateBoxBounds()
35
- layout.resized = true
41
+ layout.resized = 'inner'
36
42
  }
37
43
 
38
44
 
39
45
  if (layout.localBoxChanged) { // position change
40
46
 
41
47
  if (this.__local) this.__updateLocalBoxBounds()
42
- layout.localBoxChanged = false
48
+ layout.localBoxChanged = undefined
43
49
 
44
50
  if (layout.strokeSpread) layout.strokeChanged = true
45
51
  if (layout.renderSpread) layout.renderChanged = true
@@ -47,7 +53,7 @@ export const LeafBounds: ILeafBoundsModule = {
47
53
  }
48
54
 
49
55
 
50
- layout.boxChanged = false // must after updateLocalBoxBounds()
56
+ layout.boxChanged = undefined // must after updateLocalBoxBounds()
51
57
 
52
58
 
53
59
  if (layout.strokeChanged) {
@@ -65,11 +71,11 @@ export const LeafBounds: ILeafBoundsModule = {
65
71
  layout.spreadStrokeCancel()
66
72
  }
67
73
 
68
- layout.strokeChanged = false
74
+ layout.strokeChanged = undefined
69
75
  if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread) layout.renderChanged = true
70
76
 
71
77
  if (this.parent) this.parent.__layout.strokeChange()
72
- layout.resized = true
78
+ layout.resized = 'inner'
73
79
  }
74
80
 
75
81
 
@@ -88,12 +94,13 @@ export const LeafBounds: ILeafBoundsModule = {
88
94
  layout.spreadRenderCancel()
89
95
  }
90
96
 
91
- layout.renderChanged = false
97
+ layout.renderChanged = undefined
92
98
 
93
99
  if (this.parent) this.parent.__layout.renderChange()
94
100
  }
95
101
 
96
- layout.boundsChanged = false
102
+ layout.resized || (layout.resized = 'local')
103
+ layout.boundsChanged = undefined
97
104
 
98
105
  },
99
106
 
package/src/LeafMatrix.ts CHANGED
@@ -21,9 +21,9 @@ export const LeafMatrix: ILeafMatrixModule = {
21
21
 
22
22
  if (layout.affectScaleOrRotation) {
23
23
 
24
- if (layout.scaleChanged || layout.rotationChanged) {
24
+ if ((layout.scaleChanged && (layout.resized = 'scale')) || layout.rotationChanged) {
25
25
  setLayout(local, data as ILayoutData, null, null, layout.affectRotation)
26
- layout.scaleChanged = layout.rotationChanged = false
26
+ layout.scaleChanged = layout.rotationChanged = undefined
27
27
  }
28
28
 
29
29
  }
@@ -38,7 +38,7 @@ export const LeafMatrix: ILeafMatrixModule = {
38
38
 
39
39
  }
40
40
 
41
- this.__layout.matrixChanged = false
41
+ this.__layout.matrixChanged = undefined
42
42
 
43
43
  }
44
44