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