leafer-ui 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/web.cjs CHANGED
@@ -640,6 +640,15 @@ class Renderer {
640
640
  }
641
641
  checkRender() {
642
642
  if (this.running) {
643
+ const { target } = this;
644
+ if (target.isApp) {
645
+ target.emit(core.RenderEvent.CHILD_START, target);
646
+ target.children.forEach(leafer => {
647
+ leafer.renderer.FPS = this.FPS;
648
+ leafer.renderer.checkRender();
649
+ });
650
+ target.emit(core.RenderEvent.CHILD_END, target);
651
+ }
643
652
  if (this.changed && this.canvas.view)
644
653
  this.render();
645
654
  this.target.emit(core.RenderEvent.NEXT);
@@ -725,7 +734,7 @@ class Renderer {
725
734
  bounds.spread(Renderer.clipSpread).ceil();
726
735
  canvas.clearWorld(bounds, true);
727
736
  canvas.clipWorld(bounds, true);
728
- this.__render(bounds, block.includes(this.target.__world), realBounds);
737
+ this.__render(bounds, realBounds);
729
738
  canvas.restore();
730
739
  core.Run.end(t);
731
740
  }
@@ -734,12 +743,12 @@ class Renderer {
734
743
  const { canvas } = this;
735
744
  canvas.save();
736
745
  canvas.clear();
737
- this.__render(canvas.bounds, true);
746
+ this.__render(canvas.bounds);
738
747
  canvas.restore();
739
748
  core.Run.end(t);
740
749
  }
741
- __render(bounds, includes, realBounds) {
742
- const { canvas } = this, options = includes ? { includes } : { bounds, includes };
750
+ __render(bounds, realBounds) {
751
+ const { canvas } = this, includes = bounds.includes(this.target.__world), options = includes ? { includes } : { bounds, includes };
743
752
  if (this.needFill)
744
753
  canvas.fillWorld(bounds, this.config.fill);
745
754
  if (core.Debug.showRepaint)
@@ -766,22 +775,14 @@ class Renderer {
766
775
  }
767
776
  __requestRender() {
768
777
  const target = this.target;
769
- if (target.parentApp)
770
- return target.parentApp.renderer.update(false);
771
- if (this.requestTime)
778
+ if (this.requestTime || !target)
772
779
  return;
780
+ if (target.parentApp)
781
+ return target.parentApp.requestRender(false);
773
782
  const requestTime = this.requestTime = Date.now();
774
783
  core.Platform.requestRender(() => {
775
784
  this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - requestTime)));
776
785
  this.requestTime = 0;
777
- if (target.isApp) {
778
- target.emit(core.RenderEvent.CHILD_START, target);
779
- target.children.forEach(leafer => {
780
- leafer.renderer.FPS = this.FPS;
781
- leafer.renderer.checkRender();
782
- });
783
- target.emit(core.RenderEvent.CHILD_END, target);
784
- }
785
786
  this.checkRender();
786
787
  });
787
788
  }