@leafer/display-module 1.0.0-rc.23 → 1.0.0-rc.25

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.
Files changed (2) hide show
  1. package/package.json +6 -6
  2. package/src/LeafBounds.ts +26 -19
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer/display-module",
3
- "version": "1.0.0-rc.23",
3
+ "version": "1.0.0-rc.25",
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.0.0-rc.23",
26
- "@leafer/event": "1.0.0-rc.23",
27
- "@leafer/math": "1.0.0-rc.23",
28
- "@leafer/debug": "1.0.0-rc.23"
25
+ "@leafer/helper": "1.0.0-rc.25",
26
+ "@leafer/event": "1.0.0-rc.25",
27
+ "@leafer/math": "1.0.0-rc.25",
28
+ "@leafer/debug": "1.0.0-rc.25"
29
29
  },
30
30
  "devDependencies": {
31
- "@leafer/interface": "1.0.0-rc.23"
31
+ "@leafer/interface": "1.0.0-rc.25"
32
32
  }
33
33
  }
package/src/LeafBounds.ts CHANGED
@@ -4,7 +4,7 @@ import { PathBounds } from '@leafer/path'
4
4
  import { BranchHelper, LeafHelper } from '@leafer/helper'
5
5
 
6
6
 
7
- const { updateMatrix, updateAllMatrix, hasParentAutoLayout } = LeafHelper
7
+ const { updateMatrix, updateAllMatrix } = LeafHelper
8
8
  const { updateBounds } = BranchHelper
9
9
  const { toOuterOf, copyAndSpread, copy } = BoundsHelper
10
10
  const { toBounds } = PathBounds
@@ -32,7 +32,6 @@ export const LeafBounds: ILeafBoundsModule = {
32
32
  this.__updateRenderPath()
33
33
 
34
34
  this.__updateBoxBounds()
35
- layout.boxChanged = false
36
35
  layout.resized = true
37
36
  }
38
37
 
@@ -48,15 +47,16 @@ export const LeafBounds: ILeafBoundsModule = {
48
47
  }
49
48
 
50
49
 
50
+ layout.boxChanged = false // must after updateLocalBoxBounds()
51
+
52
+
51
53
  if (layout.strokeChanged) {
52
54
 
53
55
  layout.strokeSpread = this.__updateStrokeSpread()
54
56
 
55
57
  if (layout.strokeSpread) {
56
58
 
57
- if (layout.strokeBounds === layout.boxBounds) {
58
- layout.spreadStroke()
59
- }
59
+ if (layout.strokeBounds === layout.boxBounds) layout.spreadStroke()
60
60
 
61
61
  this.__updateStrokeBounds()
62
62
  this.__updateLocalStrokeBounds()
@@ -66,7 +66,7 @@ export const LeafBounds: ILeafBoundsModule = {
66
66
  }
67
67
 
68
68
  layout.strokeChanged = false
69
- if (layout.renderSpread) layout.renderChanged = true
69
+ if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread) layout.renderChanged = true
70
70
 
71
71
  if (this.parent) this.parent.__layout.strokeChange()
72
72
  layout.resized = true
@@ -79,9 +79,7 @@ export const LeafBounds: ILeafBoundsModule = {
79
79
 
80
80
  if (layout.renderSpread) {
81
81
 
82
- if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds) {
83
- layout.spreadRender()
84
- }
82
+ if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds) layout.spreadRender()
85
83
 
86
84
  this.__updateRenderBounds()
87
85
  this.__updateLocalRenderBounds()
@@ -100,7 +98,7 @@ export const LeafBounds: ILeafBoundsModule = {
100
98
  },
101
99
 
102
100
  __updateLocalBoxBounds(): void {
103
- if (this.__hasAutoLayout) this.__updateAutoLayout()
101
+ if (this.__hasAutoLayout) this.__updateAutoLayout() // origin / around / flow
104
102
  toOuterOf(this.__layout.boxBounds, this.__local, this.__local)
105
103
  },
106
104
 
@@ -130,16 +128,24 @@ export const LeafBounds: ILeafBoundsModule = {
130
128
  __updateAutoLayout(): void {
131
129
  this.__layout.matrixChanged = true
132
130
  if (this.isBranch) {
133
- if (this.leafer) this.leafer.layouter.addExtra(this) // add part render
134
- if (this.__.flow) this.__updateFlowLayout()
135
- // console.log('update flow')
131
+ if (this.leafer && this.leafer.ready) this.leafer.layouter.addExtra(this) // add part
132
+
133
+ if (this.__.flow) {
134
+
135
+ if (this.__layout.boxChanged) this.__updateFlowLayout()
136
+
137
+ updateAllMatrix(this)
138
+ updateBounds(this, this)
139
+
140
+ if (this.__.__autoSide) this.__updateBoxBounds()
136
141
 
137
- if (hasParentAutoLayout(this)) {
138
- updateMatrix(this)
139
142
  } else {
143
+
140
144
  updateAllMatrix(this)
141
145
  updateBounds(this, this)
146
+
142
147
  }
148
+
143
149
  } else {
144
150
  updateMatrix(this)
145
151
  }
@@ -152,12 +158,13 @@ export const LeafBounds: ILeafBoundsModule = {
152
158
  },
153
159
 
154
160
  __updateStrokeBounds(): void {
155
- copyAndSpread(this.__layout.strokeBounds, this.__layout.boxBounds, this.__layout.strokeSpread)
161
+ const layout = this.__layout
162
+ copyAndSpread(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread)
156
163
  },
157
164
 
158
165
  __updateRenderBounds(): void {
159
- const { renderSpread, strokeBounds, renderBounds } = this.__layout
160
- renderSpread > 0 ? copyAndSpread(renderBounds, strokeBounds, renderSpread) : copy(renderBounds, strokeBounds) // Box use -1
161
- },
166
+ const layout = this.__layout
167
+ layout.renderSpread > 0 ? copyAndSpread(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy(layout.renderBounds, layout.strokeBounds) // Box use -1
168
+ }
162
169
 
163
170
  }