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