@leafer/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.
@@ -6125,7 +6125,7 @@ class LeafLevelList {
6125
6125
  }
6126
6126
  }
6127
6127
 
6128
- const version = "1.6.0";
6128
+ const version = "1.6.1";
6129
6129
 
6130
6130
  class LeaferCanvas extends LeaferCanvasBase {
6131
6131
  get allowBackgroundColor() { return true; }
@@ -6582,6 +6582,15 @@ class Renderer {
6582
6582
  }
6583
6583
  checkRender() {
6584
6584
  if (this.running) {
6585
+ const { target } = this;
6586
+ if (target.isApp) {
6587
+ target.emit(RenderEvent.CHILD_START, target);
6588
+ target.children.forEach(leafer => {
6589
+ leafer.renderer.FPS = this.FPS;
6590
+ leafer.renderer.checkRender();
6591
+ });
6592
+ target.emit(RenderEvent.CHILD_END, target);
6593
+ }
6585
6594
  if (this.changed && this.canvas.view)
6586
6595
  this.render();
6587
6596
  this.target.emit(RenderEvent.NEXT);
@@ -6667,7 +6676,7 @@ class Renderer {
6667
6676
  bounds.spread(Renderer.clipSpread).ceil();
6668
6677
  canvas.clearWorld(bounds, true);
6669
6678
  canvas.clipWorld(bounds, true);
6670
- this.__render(bounds, block.includes(this.target.__world), realBounds);
6679
+ this.__render(bounds, realBounds);
6671
6680
  canvas.restore();
6672
6681
  Run.end(t);
6673
6682
  }
@@ -6676,12 +6685,12 @@ class Renderer {
6676
6685
  const { canvas } = this;
6677
6686
  canvas.save();
6678
6687
  canvas.clear();
6679
- this.__render(canvas.bounds, true);
6688
+ this.__render(canvas.bounds);
6680
6689
  canvas.restore();
6681
6690
  Run.end(t);
6682
6691
  }
6683
- __render(bounds, includes, realBounds) {
6684
- const { canvas } = this, options = includes ? { includes } : { bounds, includes };
6692
+ __render(bounds, realBounds) {
6693
+ const { canvas } = this, includes = bounds.includes(this.target.__world), options = includes ? { includes } : { bounds, includes };
6685
6694
  if (this.needFill)
6686
6695
  canvas.fillWorld(bounds, this.config.fill);
6687
6696
  if (Debug.showRepaint)
@@ -6708,22 +6717,14 @@ class Renderer {
6708
6717
  }
6709
6718
  __requestRender() {
6710
6719
  const target = this.target;
6711
- if (target.parentApp)
6712
- return target.parentApp.renderer.update(false);
6713
- if (this.requestTime)
6720
+ if (this.requestTime || !target)
6714
6721
  return;
6722
+ if (target.parentApp)
6723
+ return target.parentApp.requestRender(false);
6715
6724
  const requestTime = this.requestTime = Date.now();
6716
6725
  Platform.requestRender(() => {
6717
6726
  this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - requestTime)));
6718
6727
  this.requestTime = 0;
6719
- if (target.isApp) {
6720
- target.emit(RenderEvent.CHILD_START, target);
6721
- target.children.forEach(leafer => {
6722
- leafer.renderer.FPS = this.FPS;
6723
- leafer.renderer.checkRender();
6724
- });
6725
- target.emit(RenderEvent.CHILD_END, target);
6726
- }
6727
6728
  this.checkRender();
6728
6729
  });
6729
6730
  }
@@ -9694,8 +9695,7 @@ class InteractionBase {
9694
9695
  if (this.downData) {
9695
9696
  const canDrag = PointHelper.getDistance(this.downData, data) > this.p.dragDistance;
9696
9697
  if (canDrag) {
9697
- if (this.waitTap || this.longPressTimer)
9698
- this.pointerWaitCancel();
9698
+ this.pointerWaitCancel();
9699
9699
  this.waitRightTap = false;
9700
9700
  }
9701
9701
  this.dragger.checkDrag(data, canDrag);
@@ -9977,9 +9977,11 @@ class InteractionBase {
9977
9977
  this.waitTap = true;
9978
9978
  }
9979
9979
  tapWaitCancel() {
9980
- clearTimeout(this.tapTimer);
9981
- this.waitTap = false;
9982
- this.tapCount = 0;
9980
+ if (this.waitTap) {
9981
+ clearTimeout(this.tapTimer);
9982
+ this.waitTap = false;
9983
+ this.tapCount = 0;
9984
+ }
9983
9985
  }
9984
9986
  longPressWait(data) {
9985
9987
  clearTimeout(this.longPressTimer);
@@ -9999,8 +10001,10 @@ class InteractionBase {
9999
10001
  return hasLong;
10000
10002
  }
10001
10003
  longPressWaitCancel() {
10002
- clearTimeout(this.longPressTimer);
10003
- this.longPressed = false;
10004
+ if (this.longPressTimer) {
10005
+ clearTimeout(this.longPressTimer);
10006
+ this.longPressed = false;
10007
+ }
10004
10008
  }
10005
10009
  __onResize() {
10006
10010
  const { dragOut } = this.m;
@@ -14543,6 +14547,7 @@ interaction.multiTouch = function (data, list) {
14543
14547
  return;
14544
14548
  const { move, rotation, scale, center } = MultiTouchHelper.getData(list);
14545
14549
  Object.assign(data, center);
14550
+ this.pointerWaitCancel();
14546
14551
  this.rotate(getRotateEventData(rotation, data));
14547
14552
  this.zoom(getZoomEventData(scale, data));
14548
14553
  this.move(getMoveEventData(move, data));