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