@leafer-ui/miniapp 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.
@@ -599,6 +599,15 @@ class Renderer {
599
599
  }
600
600
  checkRender() {
601
601
  if (this.running) {
602
+ const { target } = this;
603
+ if (target.isApp) {
604
+ target.emit(RenderEvent.CHILD_START, target);
605
+ target.children.forEach(leafer => {
606
+ leafer.renderer.FPS = this.FPS;
607
+ leafer.renderer.checkRender();
608
+ });
609
+ target.emit(RenderEvent.CHILD_END, target);
610
+ }
602
611
  if (this.changed && this.canvas.view)
603
612
  this.render();
604
613
  this.target.emit(RenderEvent.NEXT);
@@ -684,7 +693,7 @@ class Renderer {
684
693
  bounds.spread(Renderer.clipSpread).ceil();
685
694
  canvas.clearWorld(bounds, true);
686
695
  canvas.clipWorld(bounds, true);
687
- this.__render(bounds, block.includes(this.target.__world), realBounds);
696
+ this.__render(bounds, realBounds);
688
697
  canvas.restore();
689
698
  Run.end(t);
690
699
  }
@@ -693,12 +702,12 @@ class Renderer {
693
702
  const { canvas } = this;
694
703
  canvas.save();
695
704
  canvas.clear();
696
- this.__render(canvas.bounds, true);
705
+ this.__render(canvas.bounds);
697
706
  canvas.restore();
698
707
  Run.end(t);
699
708
  }
700
- __render(bounds, includes, realBounds) {
701
- const { canvas } = this, options = includes ? { includes } : { bounds, includes };
709
+ __render(bounds, realBounds) {
710
+ const { canvas } = this, includes = bounds.includes(this.target.__world), options = includes ? { includes } : { bounds, includes };
702
711
  if (this.needFill)
703
712
  canvas.fillWorld(bounds, this.config.fill);
704
713
  if (Debug.showRepaint)
@@ -725,22 +734,14 @@ class Renderer {
725
734
  }
726
735
  __requestRender() {
727
736
  const target = this.target;
728
- if (target.parentApp)
729
- return target.parentApp.renderer.update(false);
730
- if (this.requestTime)
737
+ if (this.requestTime || !target)
731
738
  return;
739
+ if (target.parentApp)
740
+ return target.parentApp.requestRender(false);
732
741
  const requestTime = this.requestTime = Date.now();
733
742
  Platform.requestRender(() => {
734
743
  this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - requestTime)));
735
744
  this.requestTime = 0;
736
- if (target.isApp) {
737
- target.emit(RenderEvent.CHILD_START, target);
738
- target.children.forEach(leafer => {
739
- leafer.renderer.FPS = this.FPS;
740
- leafer.renderer.checkRender();
741
- });
742
- target.emit(RenderEvent.CHILD_END, target);
743
- }
744
745
  this.checkRender();
745
746
  });
746
747
  }