@leafer-ui/app 1.6.2 → 1.6.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-ui/app",
3
- "version": "1.6.2",
3
+ "version": "1.6.4",
4
4
  "description": "@leafer-ui/app",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,12 +22,12 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/core": "1.6.2",
26
- "@leafer-ui/display": "1.6.2",
27
- "@leafer-ui/data": "1.6.2"
25
+ "@leafer/core": "1.6.4",
26
+ "@leafer-ui/display": "1.6.4",
27
+ "@leafer-ui/data": "1.6.4"
28
28
  },
29
29
  "devDependencies": {
30
- "@leafer/interface": "1.6.2",
31
- "@leafer-ui/interface": "1.6.2"
30
+ "@leafer/interface": "1.6.4",
31
+ "@leafer-ui/interface": "1.6.4"
32
32
  }
33
33
  }
package/src/App.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ILeaferConfig, IResizeEvent, ILeaferCanvas, IRenderOptions, ILeaferBase, IBoundsData } from '@leafer/interface'
2
2
  import { Creator, DataHelper, LayoutEvent, RenderEvent, canvasSizeAttrs, registerUI } from '@leafer/core'
3
3
 
4
- import { IApp, IAppConfig, IAppForEachFunction, IAppInputData, IEditorBase, ILeafer } from '@leafer-ui/interface'
4
+ import { IApp, IAppConfig, IAppForEachFunction, IAppInputData, ILeafer } from '@leafer-ui/interface'
5
5
 
6
6
  import { Leafer } from '@leafer-ui/draw'
7
7
 
@@ -32,7 +32,7 @@ export class App extends Leafer implements IApp {
32
32
  if (ground) this.ground = this.addLeafer(ground)
33
33
  if (tree || editor) this.tree = this.addLeafer(tree || { type: userConfig.type || 'design' })
34
34
  if (sky || editor) this.sky = this.addLeafer(sky)
35
- if (editor) this.sky.add(this.editor = Creator.editor(editor) as IEditorBase)
35
+ if (editor) Creator.editor(editor, this)
36
36
  }
37
37
  }
38
38
 
@@ -47,6 +47,11 @@ export class App extends Leafer implements IApp {
47
47
  this.layouter.disable()
48
48
  }
49
49
 
50
+ override __updateLocalBounds(): void {
51
+ this.forEach(leafer => leafer.updateLayout())
52
+ super.__updateLocalBounds()
53
+ }
54
+
50
55
  override start(): void {
51
56
  super.start()
52
57
  this.forEach(leafer => leafer.start())
@@ -113,11 +118,7 @@ export class App extends Leafer implements IApp {
113
118
  }
114
119
 
115
120
  override __render(canvas: ILeaferCanvas, options: IRenderOptions): void {
116
- if (canvas.context) {
117
- const m = options.matrix
118
- if (m) canvas.setTransform(m.a, m.b, m.c, m.d, m.e, m.f) // screenshot
119
- this.forEach(leafer => canvas.copyWorld(leafer.canvas))
120
- }
121
+ if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds))
121
122
  }
122
123
 
123
124
  public __onResize(event: IResizeEvent): void {
@@ -142,9 +143,11 @@ export class App extends Leafer implements IApp {
142
143
  }
143
144
 
144
145
  protected __listenChildEvents(leafer: ILeaferBase): void {
145
- leafer.once(LayoutEvent.END, () => this.__onReady())
146
- leafer.once(RenderEvent.START, () => this.__onCreated())
147
- leafer.once(RenderEvent.END, () => this.__onViewReady())
146
+ leafer.once([
147
+ [LayoutEvent.END, this.__onReady, this],
148
+ [RenderEvent.START, this.__onCreated, this],
149
+ [RenderEvent.END, this.__onViewReady, this]
150
+ ])
148
151
  if (this.realCanvas) this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this))
149
152
  }
150
153
 
package/types/index.d.ts CHANGED
@@ -14,6 +14,7 @@ declare class App extends Leafer implements IApp {
14
14
  constructor(userConfig?: IAppConfig, data?: IAppInputData);
15
15
  init(userConfig?: IAppConfig, parentApp?: IApp): void;
16
16
  protected __setApp(): void;
17
+ __updateLocalBounds(): void;
17
18
  start(): void;
18
19
  stop(): void;
19
20
  unlockLayout(): void;