@leafer/layout 1.0.2 → 1.0.4

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/layout",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "@leafer/layout",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,11 +22,11 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/math": "1.0.2",
26
- "@leafer/helper": "1.0.2",
27
- "@leafer/platform": "1.0.2"
25
+ "@leafer/math": "1.0.4",
26
+ "@leafer/helper": "1.0.4",
27
+ "@leafer/platform": "1.0.4"
28
28
  },
29
29
  "devDependencies": {
30
- "@leafer/interface": "1.0.2"
30
+ "@leafer/interface": "1.0.4"
31
31
  }
32
32
  }
package/src/LeafLayout.ts CHANGED
@@ -75,6 +75,7 @@ export class LeafLayout implements ILeafLayout {
75
75
  public hitCanvasChanged: boolean
76
76
 
77
77
  public childrenSortChanged?: boolean
78
+ public stateStyleChanged?: boolean
78
79
 
79
80
  // keep state
80
81
  public affectScaleOrRotation: boolean
@@ -202,7 +203,7 @@ export class LeafLayout implements ILeafLayout {
202
203
 
203
204
  public getLayoutBounds(type?: IBoundsType, relative: ILocationType | ILeaf = 'world', unscale?: boolean): ILayoutBoundsData {
204
205
  const { leaf } = this
205
- let point: IPointData, matrix: IMatrixData, bounds: IBoundsData = this.getInnerBounds(type)
206
+ let point: IPointData, matrix: IMatrixData, layoutBounds: ILayoutBoundsData, bounds: IBoundsData = this.getInnerBounds(type)
206
207
 
207
208
  switch (relative) {
208
209
  case 'world':
@@ -210,8 +211,9 @@ export class LeafLayout implements ILeafLayout {
210
211
  matrix = leaf.__world
211
212
  break
212
213
  case 'local':
214
+ const { scaleX, scaleY, rotation, skewX, skewY } = leaf.__
215
+ layoutBounds = { scaleX, scaleY, rotation, skewX, skewY } as ILayoutBoundsData // 更精准,务必保留
213
216
  point = leaf.getLocalPointByInner(bounds)
214
- matrix = leaf.__localMatrix
215
217
  break
216
218
  case 'inner':
217
219
  point = bounds
@@ -224,7 +226,7 @@ export class LeafLayout implements ILeafLayout {
224
226
  matrix = getRelativeWorld(leaf, relative, true)
225
227
  }
226
228
 
227
- const layoutBounds = MatrixHelper.getLayout(matrix) as ILayoutBoundsData
229
+ if (!layoutBounds) layoutBounds = MatrixHelper.getLayout(matrix) as ILayoutBoundsData
228
230
  copy(layoutBounds, bounds)
229
231
  PointHelper.copy(layoutBounds, point)
230
232
 
package/types/index.d.ts CHANGED
@@ -37,6 +37,7 @@ declare class LeafLayout implements ILeafLayout {
37
37
  opacityChanged: boolean;
38
38
  hitCanvasChanged: boolean;
39
39
  childrenSortChanged?: boolean;
40
+ stateStyleChanged?: boolean;
40
41
  affectScaleOrRotation: boolean;
41
42
  affectRotation: boolean;
42
43
  affectChildrenSort?: boolean;