@leafer/layouter 1.0.0-alpha.21 → 1.0.0-alpha.23

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/layouter",
3
- "version": "1.0.0-alpha.21",
3
+ "version": "1.0.0-alpha.23",
4
4
  "description": "@leafer/canvas",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -19,14 +19,14 @@
19
19
  "leaferjs"
20
20
  ],
21
21
  "dependencies": {
22
- "@leafer/event": "1.0.0-alpha.21",
23
- "@leafer/math": "1.0.0-alpha.21",
24
- "@leafer/list": "1.0.0-alpha.21",
25
- "@leafer/data": "1.0.0-alpha.21",
26
- "@leafer/helper": "1.0.0-alpha.21",
27
- "@leafer/debug": "1.0.0-alpha.21"
22
+ "@leafer/event": "1.0.0-alpha.23",
23
+ "@leafer/math": "1.0.0-alpha.23",
24
+ "@leafer/list": "1.0.0-alpha.23",
25
+ "@leafer/data": "1.0.0-alpha.23",
26
+ "@leafer/helper": "1.0.0-alpha.23",
27
+ "@leafer/debug": "1.0.0-alpha.23"
28
28
  },
29
29
  "devDependencies": {
30
- "@leafer/interface": "1.0.0-alpha.21"
30
+ "@leafer/interface": "1.0.0-alpha.23"
31
31
  }
32
32
  }
package/src/Layouter.ts CHANGED
@@ -54,13 +54,11 @@ export class Layouter implements ILayouter {
54
54
  public layout(): void {
55
55
  if (!this.running) return
56
56
  const { target } = this
57
- const { LAYOUT, END } = LayoutEvent
58
57
  this.times = 0
59
58
  this.changed = false
60
59
  target.emit(LayoutEvent.START)
61
60
  this.layoutOnce()
62
- target.emitEvent(new LayoutEvent(LAYOUT, this.layoutedBlocks))
63
- target.emitEvent(new LayoutEvent(END, this.layoutedBlocks))
61
+ target.emitEvent(new LayoutEvent(LayoutEvent.END, this.layoutedBlocks))
64
62
  this.layoutedBlocks = null
65
63
  }
66
64
 
@@ -82,11 +80,11 @@ export class Layouter implements ILayouter {
82
80
 
83
81
  const t = Run.start('PartLayout')
84
82
  const { target, __updateList: updateList } = this
85
- const { BEFORE_ONCE, ONCE, AFTER_ONCE } = LayoutEvent
83
+ const { BEFORE, LAYOUT, AFTER } = LayoutEvent
86
84
 
87
85
  const blocks = this.getBlocks(updateList)
88
86
  blocks.forEach(item => { item.setBefore() })
89
- target.emitEvent(new LayoutEvent(BEFORE_ONCE, blocks))
87
+ target.emitEvent(new LayoutEvent(BEFORE, blocks))
90
88
 
91
89
  updateList.sort()
92
90
  updateMatrix(updateList, this.__levelList)
@@ -95,8 +93,8 @@ export class Layouter implements ILayouter {
95
93
 
96
94
  blocks.forEach(item => item.setAfter())
97
95
 
98
- target.emitEvent(new LayoutEvent(ONCE, blocks))
99
- target.emitEvent(new LayoutEvent(AFTER_ONCE, blocks))
96
+ target.emitEvent(new LayoutEvent(LAYOUT, blocks))
97
+ target.emitEvent(new LayoutEvent(AFTER, blocks))
100
98
 
101
99
  this.setBlocks(blocks)
102
100
 
@@ -111,16 +109,16 @@ export class Layouter implements ILayouter {
111
109
  const t = Run.start('FullLayout')
112
110
 
113
111
  const { target } = this
114
- const { BEFORE_ONCE, ONCE, AFTER_ONCE } = LayoutEvent
112
+ const { BEFORE, LAYOUT, AFTER } = LayoutEvent
115
113
 
116
114
  const blocks = this.getBlocks(new LeafList(target))
117
- target.emitEvent(new LayoutEvent(BEFORE_ONCE, blocks))
115
+ target.emitEvent(new LayoutEvent(BEFORE, blocks))
118
116
 
119
117
  Layouter.fullLayout(target)
120
118
 
121
119
  blocks.forEach(item => { item.setAfter() })
122
- target.emitEvent(new LayoutEvent(ONCE, blocks))
123
- target.emitEvent(new LayoutEvent(AFTER_ONCE, blocks))
120
+ target.emitEvent(new LayoutEvent(LAYOUT, blocks))
121
+ target.emitEvent(new LayoutEvent(AFTER, blocks))
124
122
 
125
123
  this.setBlocks(blocks)
126
124
 
@@ -157,7 +155,7 @@ export class Layouter implements ILayouter {
157
155
  }
158
156
 
159
157
  protected __checkAgain(): void {
160
- if (this.changed && this.times <= this.config.partLayout.maxTimes) this.target.emit(LayoutEvent.AGAIN) // 防止更新布局过程中产生了属性修改
158
+ //if (this.changed && this.times <= this.config.partLayout.maxTimes) this.target.emit(LayoutEvent.AGAIN) // 防止更新布局过程中产生了属性修改
161
159
  }
162
160
 
163
161
  protected __onReceiveWatchData(event: WatchEvent): void {
@@ -180,6 +178,7 @@ export class Layouter implements ILayouter {
180
178
 
181
179
  public destroy(): void {
182
180
  if (this.target) {
181
+ this.stop()
183
182
  this.__removeListenEvents()
184
183
  this.target = null
185
184
  }
@@ -11,7 +11,7 @@ export function updateMatrix(updateList: ILeafList, levelList: ILeafLevelList):
11
11
  let layout: ILeafLayout
12
12
  updateList.list.forEach(leaf => { // 更新矩阵, 所有子元素,和父元素都需要更新bounds
13
13
  layout = leaf.__layout
14
- if (levelList.without(leaf)) { // 防止重复, 子元素可能已经被父元素更新过
14
+ if (levelList.without(leaf) && !layout.useZoomProxy) { // 防止重复, 子元素可能已经被父元素更新过
15
15
 
16
16
  if (layout.matrixChanged) {
17
17