@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.
package/dist/worker.js CHANGED
@@ -6128,7 +6128,7 @@ var LeaferUI = (function (exports) {
6128
6128
  }
6129
6129
  }
6130
6130
 
6131
- const version = "1.6.0";
6131
+ const version = "1.6.1";
6132
6132
 
6133
6133
  class LeaferCanvas extends LeaferCanvasBase {
6134
6134
  get allowBackgroundColor() { return true; }
@@ -6585,6 +6585,15 @@ var LeaferUI = (function (exports) {
6585
6585
  }
6586
6586
  checkRender() {
6587
6587
  if (this.running) {
6588
+ const { target } = this;
6589
+ if (target.isApp) {
6590
+ target.emit(RenderEvent.CHILD_START, target);
6591
+ target.children.forEach(leafer => {
6592
+ leafer.renderer.FPS = this.FPS;
6593
+ leafer.renderer.checkRender();
6594
+ });
6595
+ target.emit(RenderEvent.CHILD_END, target);
6596
+ }
6588
6597
  if (this.changed && this.canvas.view)
6589
6598
  this.render();
6590
6599
  this.target.emit(RenderEvent.NEXT);
@@ -6670,7 +6679,7 @@ var LeaferUI = (function (exports) {
6670
6679
  bounds.spread(Renderer.clipSpread).ceil();
6671
6680
  canvas.clearWorld(bounds, true);
6672
6681
  canvas.clipWorld(bounds, true);
6673
- this.__render(bounds, block.includes(this.target.__world), realBounds);
6682
+ this.__render(bounds, realBounds);
6674
6683
  canvas.restore();
6675
6684
  Run.end(t);
6676
6685
  }
@@ -6679,12 +6688,12 @@ var LeaferUI = (function (exports) {
6679
6688
  const { canvas } = this;
6680
6689
  canvas.save();
6681
6690
  canvas.clear();
6682
- this.__render(canvas.bounds, true);
6691
+ this.__render(canvas.bounds);
6683
6692
  canvas.restore();
6684
6693
  Run.end(t);
6685
6694
  }
6686
- __render(bounds, includes, realBounds) {
6687
- const { canvas } = this, options = includes ? { includes } : { bounds, includes };
6695
+ __render(bounds, realBounds) {
6696
+ const { canvas } = this, includes = bounds.includes(this.target.__world), options = includes ? { includes } : { bounds, includes };
6688
6697
  if (this.needFill)
6689
6698
  canvas.fillWorld(bounds, this.config.fill);
6690
6699
  if (Debug.showRepaint)
@@ -6711,22 +6720,14 @@ var LeaferUI = (function (exports) {
6711
6720
  }
6712
6721
  __requestRender() {
6713
6722
  const target = this.target;
6714
- if (target.parentApp)
6715
- return target.parentApp.renderer.update(false);
6716
- if (this.requestTime)
6723
+ if (this.requestTime || !target)
6717
6724
  return;
6725
+ if (target.parentApp)
6726
+ return target.parentApp.requestRender(false);
6718
6727
  const requestTime = this.requestTime = Date.now();
6719
6728
  Platform.requestRender(() => {
6720
6729
  this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - requestTime)));
6721
6730
  this.requestTime = 0;
6722
- if (target.isApp) {
6723
- target.emit(RenderEvent.CHILD_START, target);
6724
- target.children.forEach(leafer => {
6725
- leafer.renderer.FPS = this.FPS;
6726
- leafer.renderer.checkRender();
6727
- });
6728
- target.emit(RenderEvent.CHILD_END, target);
6729
- }
6730
6731
  this.checkRender();
6731
6732
  });
6732
6733
  }
@@ -9697,8 +9698,7 @@ var LeaferUI = (function (exports) {
9697
9698
  if (this.downData) {
9698
9699
  const canDrag = PointHelper.getDistance(this.downData, data) > this.p.dragDistance;
9699
9700
  if (canDrag) {
9700
- if (this.waitTap || this.longPressTimer)
9701
- this.pointerWaitCancel();
9701
+ this.pointerWaitCancel();
9702
9702
  this.waitRightTap = false;
9703
9703
  }
9704
9704
  this.dragger.checkDrag(data, canDrag);
@@ -9980,9 +9980,11 @@ var LeaferUI = (function (exports) {
9980
9980
  this.waitTap = true;
9981
9981
  }
9982
9982
  tapWaitCancel() {
9983
- clearTimeout(this.tapTimer);
9984
- this.waitTap = false;
9985
- this.tapCount = 0;
9983
+ if (this.waitTap) {
9984
+ clearTimeout(this.tapTimer);
9985
+ this.waitTap = false;
9986
+ this.tapCount = 0;
9987
+ }
9986
9988
  }
9987
9989
  longPressWait(data) {
9988
9990
  clearTimeout(this.longPressTimer);
@@ -10002,8 +10004,10 @@ var LeaferUI = (function (exports) {
10002
10004
  return hasLong;
10003
10005
  }
10004
10006
  longPressWaitCancel() {
10005
- clearTimeout(this.longPressTimer);
10006
- this.longPressed = false;
10007
+ if (this.longPressTimer) {
10008
+ clearTimeout(this.longPressTimer);
10009
+ this.longPressed = false;
10010
+ }
10007
10011
  }
10008
10012
  __onResize() {
10009
10013
  const { dragOut } = this.m;
@@ -14546,6 +14550,7 @@ ${filterStyle$1}
14546
14550
  return;
14547
14551
  const { move, rotation, scale, center } = MultiTouchHelper.getData(list);
14548
14552
  Object.assign(data, center);
14553
+ this.pointerWaitCancel();
14549
14554
  this.rotate(getRotateEventData(rotation, data));
14550
14555
  this.zoom(getZoomEventData(scale, data));
14551
14556
  this.move(getMoveEventData(move, data));