@leafer/layout 1.0.0-beta → 1.0.0-beta.10

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 +4 -4
  2. package/src/LeafLayout.ts +11 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer/layout",
3
- "version": "1.0.0-beta",
3
+ "version": "1.0.0-beta.10",
4
4
  "description": "@leafer/layout",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -19,10 +19,10 @@
19
19
  "leaferjs"
20
20
  ],
21
21
  "dependencies": {
22
- "@leafer/math": "1.0.0-beta",
23
- "@leafer/platform": "1.0.0-beta"
22
+ "@leafer/math": "1.0.0-beta.10",
23
+ "@leafer/platform": "1.0.0-beta.10"
24
24
  },
25
25
  "devDependencies": {
26
- "@leafer/interface": "1.0.0-beta"
26
+ "@leafer/interface": "1.0.0-beta.10"
27
27
  }
28
28
  }
package/src/LeafLayout.ts CHANGED
@@ -59,6 +59,7 @@ export class LeafLayout implements ILeafLayout {
59
59
  // keep state
60
60
  public affectScaleOrRotation: boolean
61
61
  public affectRotation: boolean
62
+ public affectChildrenSort?: boolean
62
63
 
63
64
  public strokeSpread: number
64
65
  public renderSpread: number
@@ -71,17 +72,17 @@ export class LeafLayout implements ILeafLayout {
71
72
  this.renderBounds = this.strokeBounds = this.boxBounds = { x: 0, y: 0, width: 0, height: 0 }
72
73
  this.localRenderBounds = this.localStrokeBounds = leaf.__local
73
74
  this.boxChange()
75
+ this.positionChange()
74
76
  }
75
77
 
76
78
 
77
- public checkUpdate(): void {
79
+ public checkUpdate(force?: boolean): void {
78
80
  const { leafer } = this.leaf
79
81
  if (leafer) {
80
82
  if (leafer.ready) {
81
- if (leafer.watcher.changed) leafer.layouter.layout()
83
+ if ((Platform.realtimeLayout || force) && leafer.watcher.changed) leafer.layouter.layout()
82
84
  } else {
83
85
  leafer.start()
84
- leafer.layouter.layout()
85
86
  }
86
87
  } else {
87
88
  let root = this.leaf
@@ -258,6 +259,13 @@ export class LeafLayout implements ILeafLayout {
258
259
  this.surfaceChanged || this.surfaceChange()
259
260
  }
260
261
 
262
+ public childrenSortChange(): void {
263
+ if (!this.childrenSortChanged) {
264
+ this.childrenSortChanged = true
265
+ this.leaf.forceUpdate('surface')
266
+ }
267
+ }
268
+
261
269
  public destroy(): void {
262
270
  this.leaf = null
263
271
  }