@leafer-draw/node 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/node.cjs CHANGED
@@ -471,6 +471,15 @@ class Renderer {
471
471
  }
472
472
  checkRender() {
473
473
  if (this.running) {
474
+ const { target } = this;
475
+ if (target.isApp) {
476
+ target.emit(core.RenderEvent.CHILD_START, target);
477
+ target.children.forEach(leafer => {
478
+ leafer.renderer.FPS = this.FPS;
479
+ leafer.renderer.checkRender();
480
+ });
481
+ target.emit(core.RenderEvent.CHILD_END, target);
482
+ }
474
483
  if (this.changed && this.canvas.view)
475
484
  this.render();
476
485
  this.target.emit(core.RenderEvent.NEXT);
@@ -556,7 +565,7 @@ class Renderer {
556
565
  bounds.spread(Renderer.clipSpread).ceil();
557
566
  canvas.clearWorld(bounds, true);
558
567
  canvas.clipWorld(bounds, true);
559
- this.__render(bounds, block.includes(this.target.__world), realBounds);
568
+ this.__render(bounds, realBounds);
560
569
  canvas.restore();
561
570
  core.Run.end(t);
562
571
  }
@@ -565,12 +574,12 @@ class Renderer {
565
574
  const { canvas } = this;
566
575
  canvas.save();
567
576
  canvas.clear();
568
- this.__render(canvas.bounds, true);
577
+ this.__render(canvas.bounds);
569
578
  canvas.restore();
570
579
  core.Run.end(t);
571
580
  }
572
- __render(bounds, includes, realBounds) {
573
- const { canvas } = this, options = includes ? { includes } : { bounds, includes };
581
+ __render(bounds, realBounds) {
582
+ const { canvas } = this, includes = bounds.includes(this.target.__world), options = includes ? { includes } : { bounds, includes };
574
583
  if (this.needFill)
575
584
  canvas.fillWorld(bounds, this.config.fill);
576
585
  if (core.Debug.showRepaint)
@@ -597,22 +606,14 @@ class Renderer {
597
606
  }
598
607
  __requestRender() {
599
608
  const target = this.target;
600
- if (target.parentApp)
601
- return target.parentApp.renderer.update(false);
602
- if (this.requestTime)
609
+ if (this.requestTime || !target)
603
610
  return;
611
+ if (target.parentApp)
612
+ return target.parentApp.requestRender(false);
604
613
  const requestTime = this.requestTime = Date.now();
605
614
  core.Platform.requestRender(() => {
606
615
  this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - requestTime)));
607
616
  this.requestTime = 0;
608
- if (target.isApp) {
609
- target.emit(core.RenderEvent.CHILD_START, target);
610
- target.children.forEach(leafer => {
611
- leafer.renderer.FPS = this.FPS;
612
- leafer.renderer.checkRender();
613
- });
614
- target.emit(core.RenderEvent.CHILD_END, target);
615
- }
616
617
  this.checkRender();
617
618
  });
618
619
  }