@leafer-ui/display 1.3.1 → 1.3.2

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/display",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "@leafer-ui/display",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,14 +22,14 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/core": "1.3.1",
26
- "@leafer-ui/data": "1.3.1",
27
- "@leafer-ui/display-module": "1.3.1",
28
- "@leafer-ui/decorator": "1.3.1",
29
- "@leafer-ui/external": "1.3.1"
25
+ "@leafer/core": "1.3.2",
26
+ "@leafer-ui/data": "1.3.2",
27
+ "@leafer-ui/display-module": "1.3.2",
28
+ "@leafer-ui/decorator": "1.3.2",
29
+ "@leafer-ui/external": "1.3.2"
30
30
  },
31
31
  "devDependencies": {
32
- "@leafer/interface": "1.3.1",
33
- "@leafer-ui/interface": "1.3.1"
32
+ "@leafer/interface": "1.3.2",
33
+ "@leafer-ui/interface": "1.3.2"
34
34
  }
35
35
  }
package/src/Leafer.ts CHANGED
@@ -293,7 +293,6 @@ export class Leafer extends Group implements ILeafer {
293
293
  }
294
294
 
295
295
  protected __onReady(): void {
296
- if (this.ready) return
297
296
  this.ready = true
298
297
  this.emitLeafer(LeaferEvent.BEFORE_READY)
299
298
  this.emitLeafer(LeaferEvent.READY)
@@ -308,6 +307,19 @@ export class Leafer extends Group implements ILeafer {
308
307
  WaitHelper.run(this.__viewReadyWait)
309
308
  }
310
309
 
310
+ protected __onLayoutEnd(): void {
311
+ const { grow, growWidth, growHeight } = this.config
312
+ if (grow) {
313
+ let { width, height, pixelRatio } = this
314
+ const bounds = grow === 'box' ? this.worldBoxBounds : this.__world
315
+ if (growWidth !== false) width = Math.max(1, bounds.x + bounds.width)
316
+ if (growHeight !== false) height = Math.max(1, bounds.y + bounds.height)
317
+ this.__doResize({ width, height, pixelRatio })
318
+ }
319
+
320
+ if (!this.ready) this.__onReady()
321
+ }
322
+
311
323
  protected __onNextRender(): void {
312
324
  if (this.viewReady) {
313
325
  WaitHelper.run(this.__nextRenderWait)
@@ -405,11 +417,11 @@ export class Leafer extends Group implements ILeafer {
405
417
  const runId = Run.start('FirstCreate ' + this.innerName)
406
418
  this.once(LeaferEvent.START, () => Run.end(runId))
407
419
  this.once(LayoutEvent.START, () => this.updateLazyBounds())
408
- this.once(LayoutEvent.END, () => this.__onReady())
409
420
  this.once(RenderEvent.START, () => this.__onCreated())
410
421
  this.once(RenderEvent.END, () => this.__onViewReady())
411
422
  this.__eventIds.push(
412
423
  this.on_(WatchEvent.DATA, this.__onWatchData, this),
424
+ this.on_(LayoutEvent.END, this.__onLayoutEnd, this),
413
425
  this.on_(RenderEvent.NEXT, this.__onNextRender, this),
414
426
  )
415
427
  }
package/src/UI.ts CHANGED
@@ -471,7 +471,7 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
471
471
  return Plugin.need('animate')
472
472
  }
473
473
 
474
- public killAnimate(_type?: IAnimateType, _killStyle?: IUIInputData): void { }
474
+ public killAnimate(_type?: IAnimateType, _nextStyle?: IUIInputData): void { }
475
475
 
476
476
 
477
477
  // create
package/types/index.d.ts CHANGED
@@ -132,7 +132,7 @@ declare class UI extends Leaf implements IUI {
132
132
  __drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void;
133
133
  __drawPathByBox(drawer: IPathDrawer): void;
134
134
  animate(_keyframe?: IUIInputData | IKeyframe[] | IAnimation | IAnimation[], _options?: ITransition, _type?: IAnimateType, _isTemp?: boolean): IAnimate;
135
- killAnimate(_type?: IAnimateType, _killStyle?: IUIInputData): void;
135
+ killAnimate(_type?: IAnimateType, _nextStyle?: IUIInputData): void;
136
136
  export(_filename: IExportFileType | string, _options?: IExportOptions | number | boolean): Promise<IExportResult>;
137
137
  clone(data?: IUIInputData): IUI;
138
138
  static one(data: IUIInputData, x?: number, y?: number, width?: number, height?: number): IUI;
@@ -236,6 +236,7 @@ declare class Leafer extends Group implements ILeafer {
236
236
  protected __onCreated(): void;
237
237
  protected __onReady(): void;
238
238
  protected __onViewReady(): void;
239
+ protected __onLayoutEnd(): void;
239
240
  protected __onNextRender(): void;
240
241
  protected __checkViewCompleted(emit?: boolean): void;
241
242
  protected __onWatchData(): void;