@leafer-ui/worker 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.
@@ -460,6 +460,15 @@ class Renderer {
460
460
  }
461
461
  checkRender() {
462
462
  if (this.running) {
463
+ const { target } = this;
464
+ if (target.isApp) {
465
+ target.emit(RenderEvent.CHILD_START, target);
466
+ target.children.forEach(leafer => {
467
+ leafer.renderer.FPS = this.FPS;
468
+ leafer.renderer.checkRender();
469
+ });
470
+ target.emit(RenderEvent.CHILD_END, target);
471
+ }
463
472
  if (this.changed && this.canvas.view)
464
473
  this.render();
465
474
  this.target.emit(RenderEvent.NEXT);
@@ -545,7 +554,7 @@ class Renderer {
545
554
  bounds.spread(Renderer.clipSpread).ceil();
546
555
  canvas.clearWorld(bounds, true);
547
556
  canvas.clipWorld(bounds, true);
548
- this.__render(bounds, block.includes(this.target.__world), realBounds);
557
+ this.__render(bounds, realBounds);
549
558
  canvas.restore();
550
559
  Run.end(t);
551
560
  }
@@ -554,12 +563,12 @@ class Renderer {
554
563
  const { canvas } = this;
555
564
  canvas.save();
556
565
  canvas.clear();
557
- this.__render(canvas.bounds, true);
566
+ this.__render(canvas.bounds);
558
567
  canvas.restore();
559
568
  Run.end(t);
560
569
  }
561
- __render(bounds, includes, realBounds) {
562
- const { canvas } = this, options = includes ? { includes } : { bounds, includes };
570
+ __render(bounds, realBounds) {
571
+ const { canvas } = this, includes = bounds.includes(this.target.__world), options = includes ? { includes } : { bounds, includes };
563
572
  if (this.needFill)
564
573
  canvas.fillWorld(bounds, this.config.fill);
565
574
  if (Debug.showRepaint)
@@ -586,22 +595,14 @@ class Renderer {
586
595
  }
587
596
  __requestRender() {
588
597
  const target = this.target;
589
- if (target.parentApp)
590
- return target.parentApp.renderer.update(false);
591
- if (this.requestTime)
598
+ if (this.requestTime || !target)
592
599
  return;
600
+ if (target.parentApp)
601
+ return target.parentApp.requestRender(false);
593
602
  const requestTime = this.requestTime = Date.now();
594
603
  Platform.requestRender(() => {
595
604
  this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - requestTime)));
596
605
  this.requestTime = 0;
597
- if (target.isApp) {
598
- target.emit(RenderEvent.CHILD_START, target);
599
- target.children.forEach(leafer => {
600
- leafer.renderer.FPS = this.FPS;
601
- leafer.renderer.checkRender();
602
- });
603
- target.emit(RenderEvent.CHILD_END, target);
604
- }
605
606
  this.checkRender();
606
607
  });
607
608
  }