@leafer/worker 1.9.3 → 1.9.4

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
@@ -49,7 +49,7 @@ var LeaferUI = function(exports) {
49
49
  return value === undefined;
50
50
  }
51
51
  function isNull(value) {
52
- return value === undefined || value === null;
52
+ return value == null;
53
53
  }
54
54
  function isString(value) {
55
55
  return typeof value === "string";
@@ -285,6 +285,9 @@ var LeaferUI = function(exports) {
285
285
  num = round$6(num * a) / a;
286
286
  return num === -0 ? 0 : num;
287
287
  },
288
+ sign(num) {
289
+ return num < 0 ? -1 : 1;
290
+ },
288
291
  getScaleData(scale, size, originSize, scaleData) {
289
292
  if (!scaleData) scaleData = {};
290
293
  if (size) {
@@ -625,7 +628,7 @@ var LeaferUI = function(exports) {
625
628
  };
626
629
  const M$a = MatrixHelper;
627
630
  const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
628
- const {sin: sin$5, cos: cos$5, abs: abs$6, sqrt: sqrt$4, atan2: atan2$2, min: min$1, round: round$5} = Math;
631
+ const {sin: sin$5, cos: cos$5, abs: abs$7, sqrt: sqrt$4, atan2: atan2$2, min: min$1, round: round$5} = Math;
629
632
  const PointHelper = {
630
633
  defaultPoint: getPointData(),
631
634
  tempPoint: {},
@@ -717,8 +720,8 @@ var LeaferUI = function(exports) {
717
720
  return getDistanceFrom(t.x, t.y, point.x, point.y);
718
721
  },
719
722
  getDistanceFrom(x1, y1, x2, y2) {
720
- const x = abs$6(x2 - x1);
721
- const y = abs$6(y2 - y1);
723
+ const x = abs$7(x2 - x1);
724
+ const y = abs$7(y2 - y1);
722
725
  return sqrt$4(x * x + y * y);
723
726
  },
724
727
  getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
@@ -2369,7 +2372,7 @@ var LeaferUI = function(exports) {
2369
2372
  data[0] ? drawer.arcTo(x, y, right, y, data[0]) : drawer.lineTo(x, y);
2370
2373
  }
2371
2374
  };
2372
- const {sin: sin$4, cos: cos$4, atan2: atan2$1, ceil: ceil$1, abs: abs$5, PI: PI$3, sqrt: sqrt$3, pow: pow$1} = Math;
2375
+ const {sin: sin$4, cos: cos$4, atan2: atan2$1, ceil: ceil$1, abs: abs$6, PI: PI$3, sqrt: sqrt$3, pow: pow$1} = Math;
2373
2376
  const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
2374
2377
  const {set: set, toNumberPoints: toNumberPoints$1} = PointHelper;
2375
2378
  const {M: M$9, L: L$a, C: C$8, Q: Q$7, Z: Z$8} = PathCommandMap;
@@ -2437,7 +2440,7 @@ var LeaferUI = function(exports) {
2437
2440
  let endRadian = atan2$1(CBy, CBx);
2438
2441
  let totalRadian = endRadian - startRadian;
2439
2442
  if (totalRadian < 0) totalRadian += PI2;
2440
- if (totalRadian === PI$3 || abs$5(BAx + BAy) < 1e-12 || abs$5(CBx + CBy) < 1e-12) {
2443
+ if (totalRadian === PI$3 || abs$6(BAx + BAy) < 1e-12 || abs$6(CBx + CBy) < 1e-12) {
2441
2444
  if (data) data.push(L$a, x1, y1);
2442
2445
  if (setPointBounds) {
2443
2446
  setPoint$4(setPointBounds, fromX, fromY);
@@ -2470,7 +2473,7 @@ var LeaferUI = function(exports) {
2470
2473
  let totalRadian = endRadian - startRadian;
2471
2474
  if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
2472
2475
  if (anticlockwise) totalRadian -= PI2;
2473
- const parts = ceil$1(abs$5(totalRadian / PI_2));
2476
+ const parts = ceil$1(abs$6(totalRadian / PI_2));
2474
2477
  const partRadian = totalRadian / parts;
2475
2478
  const partRadian4Sin = sin$4(partRadian / 4);
2476
2479
  const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$4(partRadian / 2);
@@ -2923,7 +2926,7 @@ var LeaferUI = function(exports) {
2923
2926
  const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
2924
2927
  const {M: M$7, L: L$8, C: C$6, Q: Q$5, Z: Z$6, N: N$4, D: D$5, X: X$4, G: G$4, F: F$5, O: O$5, P: P$4, U: U$4} = PathCommandMap;
2925
2928
  const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
2926
- const {tan: tan, min: min, abs: abs$4} = Math;
2929
+ const {tan: tan, min: min, abs: abs$5} = Math;
2927
2930
  const startPoint = {};
2928
2931
  const PathCommandDataHelper = {
2929
2932
  beginPath(data) {
@@ -2979,7 +2982,7 @@ var LeaferUI = function(exports) {
2979
2982
  arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
2980
2983
  if (!isUndefined(lastX)) {
2981
2984
  const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
2982
- radius = min(radius, min(d / 2, d / 2 * abs$4(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
2985
+ radius = min(radius, min(d / 2, d / 2 * abs$5(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
2983
2986
  }
2984
2987
  data.push(U$4, x1, y1, x2, y2, radius);
2985
2988
  },
@@ -3738,7 +3741,7 @@ var LeaferUI = function(exports) {
3738
3741
  };
3739
3742
  const I$1 = ImageManager;
3740
3743
  const {IMAGE: IMAGE, create: create$1} = IncrementId;
3741
- const {floor: floor$2, max: max$1} = Math;
3744
+ const {floor: floor$2, max: max$2} = Math;
3742
3745
  class LeaferImage {
3743
3746
  get url() {
3744
3747
  return this.config.url;
@@ -3826,7 +3829,7 @@ var LeaferUI = function(exports) {
3826
3829
  }
3827
3830
  if (data) return data;
3828
3831
  }
3829
- const canvas = Platform.origin.createCanvas(max$1(floor$2(width + (xGap || 0)), 1), max$1(floor$2(height + (yGap || 0)), 1));
3832
+ const canvas = Platform.origin.createCanvas(max$2(floor$2(width + (xGap || 0)), 1), max$2(floor$2(height + (yGap || 0)), 1));
3830
3833
  const ctx = canvas.getContext("2d");
3831
3834
  if (opacity) ctx.globalAlpha = opacity;
3832
3835
  ctx.drawImage(this.view, 0, 0, width, height);
@@ -3867,7 +3870,7 @@ var LeaferUI = function(exports) {
3867
3870
  return {
3868
3871
  get() {
3869
3872
  const v = this[privateKey];
3870
- return isUndefined(v) ? defaultValue : v;
3873
+ return v == null ? defaultValue : v;
3871
3874
  },
3872
3875
  set(value) {
3873
3876
  this[privateKey] = value;
@@ -4120,21 +4123,21 @@ var LeaferUI = function(exports) {
4120
4123
  };
4121
4124
  } else if (typeof defaultValue === "function") {
4122
4125
  property.get = function() {
4123
- let v = this[computedKey];
4124
- return v === undefined ? defaultValue(this.__leaf) : v;
4126
+ const v = this[computedKey];
4127
+ return v == null ? defaultValue(this.__leaf) : v;
4125
4128
  };
4126
4129
  } else if (isObject(defaultValue)) {
4127
4130
  const isEmpty = isEmptyData(defaultValue);
4128
4131
  property.get = function() {
4129
- let v = this[computedKey];
4130
- return v === undefined ? this[computedKey] = isEmpty ? {} : DataHelper.clone(defaultValue) : v;
4132
+ const v = this[computedKey];
4133
+ return v == null ? this[computedKey] = isEmpty ? {} : DataHelper.clone(defaultValue) : v;
4131
4134
  };
4132
4135
  }
4133
4136
  const isBox = target.isBranchLeaf;
4134
4137
  if (key === "width") {
4135
4138
  property.get = function() {
4136
4139
  const v = this[computedKey];
4137
- if (v === undefined) {
4140
+ if (v == null) {
4138
4141
  const t = this, naturalWidth = t.__naturalWidth, leaf = t.__leaf;
4139
4142
  if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.width;
4140
4143
  if (naturalWidth) return t._height && t.__useNaturalRatio ? t._height * naturalWidth / t.__naturalHeight : naturalWidth;
@@ -4144,7 +4147,7 @@ var LeaferUI = function(exports) {
4144
4147
  } else if (key === "height") {
4145
4148
  property.get = function() {
4146
4149
  const v = this[computedKey];
4147
- if (v === undefined) {
4150
+ if (v == null) {
4148
4151
  const t = this, naturalHeight = t.__naturalHeight, leaf = t.__leaf;
4149
4152
  if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.height;
4150
4153
  if (naturalHeight) return t._width && t.__useNaturalRatio ? t._width * naturalHeight / t.__naturalWidth : naturalHeight;
@@ -4876,7 +4879,7 @@ var LeaferUI = function(exports) {
4876
4879
  }
4877
4880
  boxChange() {
4878
4881
  this.boxChanged = true;
4879
- this.localBoxChanged || this.localBoxChange();
4882
+ this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
4880
4883
  this.hitCanvasChanged = true;
4881
4884
  }
4882
4885
  localBoxChange() {
@@ -4910,7 +4913,7 @@ var LeaferUI = function(exports) {
4910
4913
  }
4911
4914
  matrixChange() {
4912
4915
  this.matrixChanged = true;
4913
- this.localBoxChanged || this.localBoxChange();
4916
+ this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
4914
4917
  }
4915
4918
  surfaceChange() {
4916
4919
  this.surfaceChanged = true;
@@ -5884,10 +5887,10 @@ var LeaferUI = function(exports) {
5884
5887
  relative.innerToWorld(world, to, distance);
5885
5888
  world = to ? to : world;
5886
5889
  }
5887
- toInnerPoint(this.worldTransform, world, to, distance);
5890
+ toInnerPoint(this.scrollWorldTransform, world, to, distance);
5888
5891
  }
5889
5892
  innerToWorld(inner, to, distance, relative) {
5890
- toOuterPoint(this.worldTransform, inner, to, distance);
5893
+ toOuterPoint(this.scrollWorldTransform, inner, to, distance);
5891
5894
  if (relative) relative.worldToInner(to ? to : inner, null, distance);
5892
5895
  }
5893
5896
  getBoxPoint(world, relative, distance, change) {
@@ -6341,7 +6344,7 @@ var LeaferUI = function(exports) {
6341
6344
  this.levelMap = null;
6342
6345
  }
6343
6346
  }
6344
- const version = "1.9.3";
6347
+ const version = "1.9.4";
6345
6348
  class LeaferCanvas extends LeaferCanvasBase {
6346
6349
  get allowBackgroundColor() {
6347
6350
  return true;
@@ -8368,29 +8371,24 @@ var LeaferUI = function(exports) {
8368
8371
  }
8369
8372
  __updateStrokeBounds() {}
8370
8373
  __updateRenderBounds() {
8371
- let isOverflow;
8374
+ let isOverflow, isScrollMode;
8372
8375
  if (this.children.length) {
8373
- const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
8376
+ const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout, {overflow: overflow} = data;
8374
8377
  const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
8375
8378
  super.__updateRenderBounds(childrenRenderBounds);
8376
- if (data.overflow.includes("scroll")) {
8379
+ if (isScrollMode = overflow.includes("scroll")) {
8377
8380
  add(childrenRenderBounds, boxBounds);
8378
8381
  scroll(childrenRenderBounds, data);
8379
8382
  }
8380
8383
  this.__updateRectRenderBounds();
8381
8384
  isOverflow = !includes$1(boxBounds, childrenRenderBounds);
8382
- if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
8385
+ if (isOverflow && overflow === "show") add(renderBounds, childrenRenderBounds);
8383
8386
  } else this.__updateRectRenderBounds();
8384
8387
  DataHelper.stintSet(this, "isOverflow", isOverflow);
8385
- this.__checkScroll();
8388
+ this.__checkScroll(isScrollMode);
8386
8389
  }
8387
8390
  __updateRectRenderBounds() {}
8388
- __updateWorldBounds() {
8389
- if (this.hasScroller) this.__updateScroll();
8390
- super.__updateWorldBounds();
8391
- }
8392
- __checkScroll() {}
8393
- __updateScroll() {}
8391
+ __checkScroll(_isScrollMode) {}
8394
8392
  __updateRectChange() {}
8395
8393
  __updateChange() {
8396
8394
  super.__updateChange();
@@ -10732,7 +10730,7 @@ var LeaferUI = function(exports) {
10732
10730
  if (leafer && leafer.viewReady) leafer.renderer.ignore = value;
10733
10731
  }
10734
10732
  const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
10735
- const {floor: floor$1, max: max, abs: abs$3} = Math;
10733
+ const {floor: floor$1, max: max$1, abs: abs$4} = Math;
10736
10734
  function createPattern(ui, paint, pixelRatio) {
10737
10735
  let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
10738
10736
  const id = scaleX + "-" + scaleY + "-" + pixelRatio;
@@ -10744,8 +10742,8 @@ var LeaferUI = function(exports) {
10744
10742
  const xGap = gap && gap.x * scaleX;
10745
10743
  const yGap = gap && gap.y * scaleY;
10746
10744
  if (sx) {
10747
- sx = abs$3(sx);
10748
- sy = abs$3(sy);
10745
+ sx = abs$4(sx);
10746
+ sy = abs$4(sy);
10749
10747
  imageMatrix = get$1();
10750
10748
  copy$4(imageMatrix, transform);
10751
10749
  scale$2(imageMatrix, 1 / sx, 1 / sy);
@@ -10783,7 +10781,7 @@ var LeaferUI = function(exports) {
10783
10781
  }
10784
10782
  if (imageMatrix) {
10785
10783
  const canvasWidth = width + (xGap || 0), canvasHeight = height + (yGap || 0);
10786
- scale$2(imageMatrix, canvasWidth / max(floor$1(canvasWidth), 1), canvasHeight / max(floor$1(canvasHeight), 1));
10784
+ scale$2(imageMatrix, canvasWidth / max$1(floor$1(canvasWidth), 1), canvasHeight / max$1(floor$1(canvasHeight), 1));
10787
10785
  }
10788
10786
  const canvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap);
10789
10787
  const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
@@ -11698,7 +11696,7 @@ var LeaferUI = function(exports) {
11698
11696
  return (target, key) => {
11699
11697
  defineKey(target, key, {
11700
11698
  get() {
11701
- const {config: config, element: element, dragPoint: dragPoint, editBox: editBox} = this, mergeConfig = Object.assign({}, config);
11699
+ const {config: config, element: element, dragPoint: dragPoint, editBox: editBox, app: app} = this, mergeConfig = Object.assign({}, config);
11702
11700
  if (element && element.editConfig) Object.assign(mergeConfig, element.editConfig);
11703
11701
  if (editBox.config) Object.assign(mergeConfig, editBox.config);
11704
11702
  if (dragPoint) {
@@ -11709,12 +11707,13 @@ var LeaferUI = function(exports) {
11709
11707
  isNull(mergeConfig.lockRatio) && (mergeConfig.lockRatio = true);
11710
11708
  }
11711
11709
  }
11710
+ if (isUndefined(mergeConfig.dragLimitAnimate)) mergeConfig.dragLimitAnimate = app && app.config.pointer.dragLimitAnimate;
11712
11711
  return this.mergedConfig = mergeConfig;
11713
11712
  }
11714
11713
  });
11715
11714
  };
11716
11715
  }
11717
- const {abs: abs$2} = Math;
11716
+ const {abs: abs$3} = Math;
11718
11717
  const {copy: copy$2, scale: scale$1} = MatrixHelper;
11719
11718
  const {setListWithFn: setListWithFn} = BoundsHelper;
11720
11719
  const {worldBounds: worldBounds} = LeafBoundsHelper;
@@ -11751,7 +11750,7 @@ var LeaferUI = function(exports) {
11751
11750
  leaf = list[i];
11752
11751
  const {worldTransform: worldTransform, worldRenderBounds: worldRenderBounds} = leaf;
11753
11752
  if (worldRenderBounds.width && worldRenderBounds.height && (!bounds || bounds.hit(worldRenderBounds, options.matrix))) {
11754
- const aScaleX = abs$2(worldTransform.scaleX), aScaleY = abs$2(worldTransform.scaleY);
11753
+ const aScaleX = abs$3(worldTransform.scaleX), aScaleY = abs$3(worldTransform.scaleY);
11755
11754
  copy$2(matrix$1, worldTransform);
11756
11755
  matrix$1.half = strokeWidth % 2;
11757
11756
  if (aScaleX !== aScaleY) {
@@ -11765,7 +11764,7 @@ var LeaferUI = function(exports) {
11765
11764
  canvas.setWorld(matrix$1, options.matrix);
11766
11765
  canvas.beginPath();
11767
11766
  if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
11768
- data.strokeWidth = strokeWidth / abs$2(worldTransform.scaleX);
11767
+ data.strokeWidth = strokeWidth / abs$3(worldTransform.scaleX);
11769
11768
  }
11770
11769
  if (stroke) isString(stroke) ? Paint.stroke(stroke, this, canvas) : Paint.strokes(stroke, this, canvas);
11771
11770
  if (fill) isString(fill) ? Paint.fill(fill, this, canvas) : Paint.fills(fill, this, canvas);
@@ -12049,7 +12048,7 @@ var LeaferUI = function(exports) {
12049
12048
  }
12050
12049
  const {topLeft: topLeft$1, top: top$1, topRight: topRight$1, right: right$2, bottomRight: bottomRight, bottom: bottom$1, bottomLeft: bottomLeft, left: left$2} = exports.Direction9;
12051
12050
  const {toPoint: toPoint} = AroundHelper;
12052
- const {within: within$2} = MathHelper;
12051
+ const {within: within$3, sign: sign$1} = MathHelper;
12053
12052
  const EditDataHelper = {
12054
12053
  getScaleData(target, startBounds, direction, totalMove, lockRatio, around, flipable, scaleMode) {
12055
12054
  let align, origin = {}, scaleX = 1, scaleY = 1;
@@ -12061,8 +12060,8 @@ var LeaferUI = function(exports) {
12061
12060
  }
12062
12061
  const originChangedScaleX = target.scaleX / startBounds.scaleX;
12063
12062
  const originChangedScaleY = target.scaleY / startBounds.scaleY;
12064
- const signX = originChangedScaleX < 0 ? -1 : 1;
12065
- const signY = originChangedScaleY < 0 ? -1 : 1;
12063
+ const signX = sign$1(originChangedScaleX);
12064
+ const signY = sign$1(originChangedScaleY);
12066
12065
  const changedScaleX = scaleMode ? originChangedScaleX : signX * boxBounds.width / width;
12067
12066
  const changedScaleY = scaleMode ? originChangedScaleY : signY * boxBounds.height / height;
12068
12067
  totalMove.x *= scaleMode ? originChangedScaleX : signX;
@@ -12162,14 +12161,14 @@ var LeaferUI = function(exports) {
12162
12161
  }
12163
12162
  if (useScaleX && widthRange) {
12164
12163
  const nowWidth = boxBounds.width * target.scaleX;
12165
- scaleX = within$2(nowWidth * scaleX, widthRange) / nowWidth;
12164
+ scaleX = within$3(nowWidth * scaleX, widthRange) / nowWidth;
12166
12165
  }
12167
12166
  if (useScaleY && heightRange) {
12168
12167
  const nowHeight = boxBounds.height * target.scaleY;
12169
- scaleY = within$2(nowHeight * scaleY, heightRange) / nowHeight;
12168
+ scaleY = within$3(nowHeight * scaleY, heightRange) / nowHeight;
12170
12169
  }
12171
- if (useScaleX && Math.abs(scaleX * worldBoxBounds.width) < 1) scaleX = (scaleX < 0 ? -1 : 1) / worldBoxBounds.width;
12172
- if (useScaleY && Math.abs(scaleY * worldBoxBounds.height) < 1) scaleY = (scaleY < 0 ? -1 : 1) / worldBoxBounds.height;
12170
+ if (useScaleX && Math.abs(scaleX * worldBoxBounds.width) < 1) scaleX = sign$1(scaleX) / worldBoxBounds.width;
12171
+ if (useScaleY && Math.abs(scaleY * worldBoxBounds.height) < 1) scaleY = sign$1(scaleY) / worldBoxBounds.height;
12173
12172
  if (lockRatio && scaleX !== scaleY) scaleY = scaleX = Math.min(scaleX, scaleY);
12174
12173
  return {
12175
12174
  origin: origin,
@@ -12664,7 +12663,7 @@ var LeaferUI = function(exports) {
12664
12663
  if (pointType && pointType.includes("resize")) ResizeEvent.resizingKeys = editor.leafList.keys;
12665
12664
  }
12666
12665
  onDragEnd(e) {
12667
- if (this.moving) this.transformTool.onMove(e);
12666
+ if (this.moving && this.mergeConfig.dragLimitAnimate && this.target.dragBounds) this.transformTool.onMove(e);
12668
12667
  this.dragPoint = null;
12669
12668
  this.resetDoing();
12670
12669
  const {name: name, pointType: pointType} = e.current;
@@ -13135,9 +13134,8 @@ var LeaferUI = function(exports) {
13135
13134
  EditorSkewEvent.SKEW = "editor.skew";
13136
13135
  class TransformTool {
13137
13136
  onMove(e) {
13138
- const {target: target, mergeConfig: mergeConfig, dragStartData: dragStartData, app: app} = this.editBox;
13137
+ const {target: target, mergeConfig: mergeConfig, dragStartData: dragStartData} = this.editBox;
13139
13138
  let move, {dragLimitAnimate: dragLimitAnimate} = mergeConfig;
13140
- if (isUndefined(dragLimitAnimate)) dragLimitAnimate = app && app.config.pointer.dragLimitAnimate;
13141
13139
  const isMoveEnd = e.type === exports.MoveEvent.END || e.type === exports.DragEvent.END;
13142
13140
  const axisDrag = isString(target.draggable);
13143
13141
  const checkLimitMove = !dragLimitAnimate || isMoveEnd || axisDrag;
@@ -14479,6 +14477,7 @@ var LeaferUI = function(exports) {
14479
14477
  };
14480
14478
  }
14481
14479
  };
14480
+ const {abs: abs$2, max: max} = Math, {sign: sign, within: within$2} = MathHelper;
14482
14481
  const WheelEventHelper = {
14483
14482
  getMove(event, config) {
14484
14483
  let {moveSpeed: moveSpeed} = config;
@@ -14487,8 +14486,9 @@ var LeaferUI = function(exports) {
14487
14486
  deltaX = deltaY;
14488
14487
  deltaY = 0;
14489
14488
  }
14490
- if (deltaX > 50) deltaX = Math.max(50, deltaX / 3);
14491
- if (deltaY > 50) deltaY = Math.max(50, deltaY / 3);
14489
+ const absX = abs$2(deltaX), absY = abs$2(deltaY);
14490
+ if (absX > 50) deltaX = max(50, absX / 3) * sign(deltaX);
14491
+ if (absY > 50) deltaY = max(50, absY / 3) * sign(deltaY);
14492
14492
  return {
14493
14493
  x: -deltaX * moveSpeed * 2,
14494
14494
  y: -deltaY * moveSpeed * 2
@@ -14506,11 +14506,9 @@ var LeaferUI = function(exports) {
14506
14506
  zoom = !event.shiftKey && (event.metaKey || event.ctrlKey);
14507
14507
  }
14508
14508
  if (zoom) {
14509
- zoomSpeed = MathHelper.within(zoomSpeed, 0, 1);
14509
+ zoomSpeed = within$2(zoomSpeed, 0, 1);
14510
14510
  const min = event.deltaY ? config.delta.y : config.delta.x;
14511
- scale = 1 - delta / (min * 4) * zoomSpeed;
14512
- if (scale < .5) scale = .5;
14513
- if (scale >= 1.5) scale = 1.5;
14511
+ scale = within$2(1 - delta / (min * 4) * zoomSpeed, .5, 1.5);
14514
14512
  }
14515
14513
  return scale;
14516
14514
  }