@leafer-ui/worker 1.6.0 → 1.6.1

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/dist/worker.cjs CHANGED
@@ -459,6 +459,15 @@ class Renderer {
459
459
  }
460
460
  checkRender() {
461
461
  if (this.running) {
462
+ const { target } = this;
463
+ if (target.isApp) {
464
+ target.emit(core.RenderEvent.CHILD_START, target);
465
+ target.children.forEach(leafer => {
466
+ leafer.renderer.FPS = this.FPS;
467
+ leafer.renderer.checkRender();
468
+ });
469
+ target.emit(core.RenderEvent.CHILD_END, target);
470
+ }
462
471
  if (this.changed && this.canvas.view)
463
472
  this.render();
464
473
  this.target.emit(core.RenderEvent.NEXT);
@@ -544,7 +553,7 @@ class Renderer {
544
553
  bounds.spread(Renderer.clipSpread).ceil();
545
554
  canvas.clearWorld(bounds, true);
546
555
  canvas.clipWorld(bounds, true);
547
- this.__render(bounds, block.includes(this.target.__world), realBounds);
556
+ this.__render(bounds, realBounds);
548
557
  canvas.restore();
549
558
  core.Run.end(t);
550
559
  }
@@ -553,12 +562,12 @@ class Renderer {
553
562
  const { canvas } = this;
554
563
  canvas.save();
555
564
  canvas.clear();
556
- this.__render(canvas.bounds, true);
565
+ this.__render(canvas.bounds);
557
566
  canvas.restore();
558
567
  core.Run.end(t);
559
568
  }
560
- __render(bounds, includes, realBounds) {
561
- const { canvas } = this, options = includes ? { includes } : { bounds, includes };
569
+ __render(bounds, realBounds) {
570
+ const { canvas } = this, includes = bounds.includes(this.target.__world), options = includes ? { includes } : { bounds, includes };
562
571
  if (this.needFill)
563
572
  canvas.fillWorld(bounds, this.config.fill);
564
573
  if (core.Debug.showRepaint)
@@ -585,22 +594,14 @@ class Renderer {
585
594
  }
586
595
  __requestRender() {
587
596
  const target = this.target;
588
- if (target.parentApp)
589
- return target.parentApp.renderer.update(false);
590
- if (this.requestTime)
597
+ if (this.requestTime || !target)
591
598
  return;
599
+ if (target.parentApp)
600
+ return target.parentApp.requestRender(false);
592
601
  const requestTime = this.requestTime = Date.now();
593
602
  core.Platform.requestRender(() => {
594
603
  this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - requestTime)));
595
604
  this.requestTime = 0;
596
- if (target.isApp) {
597
- target.emit(core.RenderEvent.CHILD_START, target);
598
- target.children.forEach(leafer => {
599
- leafer.renderer.FPS = this.FPS;
600
- leafer.renderer.checkRender();
601
- });
602
- target.emit(core.RenderEvent.CHILD_END, target);
603
- }
604
605
  this.checkRender();
605
606
  });
606
607
  }