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