@leafer/worker 1.9.2 → 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) {
@@ -1129,10 +1132,8 @@ var LeaferUI = function(exports) {
1129
1132
  t.y += y;
1130
1133
  },
1131
1134
  scroll(t, data) {
1132
- if (data.scrollY || data.scrollX) {
1133
- t.x += data.scrollX;
1134
- t.y += data.scrollY;
1135
- }
1135
+ t.x += data.scrollX;
1136
+ t.y += data.scrollY;
1136
1137
  },
1137
1138
  getByMove(t, x, y) {
1138
1139
  t = Object.assign({}, t);
@@ -2371,7 +2372,7 @@ var LeaferUI = function(exports) {
2371
2372
  data[0] ? drawer.arcTo(x, y, right, y, data[0]) : drawer.lineTo(x, y);
2372
2373
  }
2373
2374
  };
2374
- 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;
2375
2376
  const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
2376
2377
  const {set: set, toNumberPoints: toNumberPoints$1} = PointHelper;
2377
2378
  const {M: M$9, L: L$a, C: C$8, Q: Q$7, Z: Z$8} = PathCommandMap;
@@ -2439,7 +2440,7 @@ var LeaferUI = function(exports) {
2439
2440
  let endRadian = atan2$1(CBy, CBx);
2440
2441
  let totalRadian = endRadian - startRadian;
2441
2442
  if (totalRadian < 0) totalRadian += PI2;
2442
- 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) {
2443
2444
  if (data) data.push(L$a, x1, y1);
2444
2445
  if (setPointBounds) {
2445
2446
  setPoint$4(setPointBounds, fromX, fromY);
@@ -2472,7 +2473,7 @@ var LeaferUI = function(exports) {
2472
2473
  let totalRadian = endRadian - startRadian;
2473
2474
  if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
2474
2475
  if (anticlockwise) totalRadian -= PI2;
2475
- const parts = ceil$1(abs$5(totalRadian / PI_2));
2476
+ const parts = ceil$1(abs$6(totalRadian / PI_2));
2476
2477
  const partRadian = totalRadian / parts;
2477
2478
  const partRadian4Sin = sin$4(partRadian / 4);
2478
2479
  const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$4(partRadian / 2);
@@ -2925,7 +2926,7 @@ var LeaferUI = function(exports) {
2925
2926
  const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
2926
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;
2927
2928
  const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
2928
- const {tan: tan, min: min, abs: abs$4} = Math;
2929
+ const {tan: tan, min: min, abs: abs$5} = Math;
2929
2930
  const startPoint = {};
2930
2931
  const PathCommandDataHelper = {
2931
2932
  beginPath(data) {
@@ -2981,7 +2982,7 @@ var LeaferUI = function(exports) {
2981
2982
  arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
2982
2983
  if (!isUndefined(lastX)) {
2983
2984
  const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
2984
- 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))));
2985
2986
  }
2986
2987
  data.push(U$4, x1, y1, x2, y2, radius);
2987
2988
  },
@@ -3740,7 +3741,7 @@ var LeaferUI = function(exports) {
3740
3741
  };
3741
3742
  const I$1 = ImageManager;
3742
3743
  const {IMAGE: IMAGE, create: create$1} = IncrementId;
3743
- const {floor: floor$2, max: max$1} = Math;
3744
+ const {floor: floor$2, max: max$2} = Math;
3744
3745
  class LeaferImage {
3745
3746
  get url() {
3746
3747
  return this.config.url;
@@ -3828,7 +3829,7 @@ var LeaferUI = function(exports) {
3828
3829
  }
3829
3830
  if (data) return data;
3830
3831
  }
3831
- 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));
3832
3833
  const ctx = canvas.getContext("2d");
3833
3834
  if (opacity) ctx.globalAlpha = opacity;
3834
3835
  ctx.drawImage(this.view, 0, 0, width, height);
@@ -3869,7 +3870,7 @@ var LeaferUI = function(exports) {
3869
3870
  return {
3870
3871
  get() {
3871
3872
  const v = this[privateKey];
3872
- return isUndefined(v) ? defaultValue : v;
3873
+ return v == null ? defaultValue : v;
3873
3874
  },
3874
3875
  set(value) {
3875
3876
  this[privateKey] = value;
@@ -4122,21 +4123,21 @@ var LeaferUI = function(exports) {
4122
4123
  };
4123
4124
  } else if (typeof defaultValue === "function") {
4124
4125
  property.get = function() {
4125
- let v = this[computedKey];
4126
- return v === undefined ? defaultValue(this.__leaf) : v;
4126
+ const v = this[computedKey];
4127
+ return v == null ? defaultValue(this.__leaf) : v;
4127
4128
  };
4128
4129
  } else if (isObject(defaultValue)) {
4129
4130
  const isEmpty = isEmptyData(defaultValue);
4130
4131
  property.get = function() {
4131
- let v = this[computedKey];
4132
- 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;
4133
4134
  };
4134
4135
  }
4135
4136
  const isBox = target.isBranchLeaf;
4136
4137
  if (key === "width") {
4137
4138
  property.get = function() {
4138
4139
  const v = this[computedKey];
4139
- if (v === undefined) {
4140
+ if (v == null) {
4140
4141
  const t = this, naturalWidth = t.__naturalWidth, leaf = t.__leaf;
4141
4142
  if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.width;
4142
4143
  if (naturalWidth) return t._height && t.__useNaturalRatio ? t._height * naturalWidth / t.__naturalHeight : naturalWidth;
@@ -4146,7 +4147,7 @@ var LeaferUI = function(exports) {
4146
4147
  } else if (key === "height") {
4147
4148
  property.get = function() {
4148
4149
  const v = this[computedKey];
4149
- if (v === undefined) {
4150
+ if (v == null) {
4150
4151
  const t = this, naturalHeight = t.__naturalHeight, leaf = t.__leaf;
4151
4152
  if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.height;
4152
4153
  if (naturalHeight) return t._width && t.__useNaturalRatio ? t._width * naturalHeight / t.__naturalWidth : naturalHeight;
@@ -4878,7 +4879,7 @@ var LeaferUI = function(exports) {
4878
4879
  }
4879
4880
  boxChange() {
4880
4881
  this.boxChanged = true;
4881
- this.localBoxChanged || this.localBoxChange();
4882
+ this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
4882
4883
  this.hitCanvasChanged = true;
4883
4884
  }
4884
4885
  localBoxChange() {
@@ -4912,7 +4913,7 @@ var LeaferUI = function(exports) {
4912
4913
  }
4913
4914
  matrixChange() {
4914
4915
  this.matrixChanged = true;
4915
- this.localBoxChanged || this.localBoxChange();
4916
+ this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
4916
4917
  }
4917
4918
  surfaceChange() {
4918
4919
  this.surfaceChanged = true;
@@ -5886,10 +5887,10 @@ var LeaferUI = function(exports) {
5886
5887
  relative.innerToWorld(world, to, distance);
5887
5888
  world = to ? to : world;
5888
5889
  }
5889
- toInnerPoint(this.worldTransform, world, to, distance);
5890
+ toInnerPoint(this.scrollWorldTransform, world, to, distance);
5890
5891
  }
5891
5892
  innerToWorld(inner, to, distance, relative) {
5892
- toOuterPoint(this.worldTransform, inner, to, distance);
5893
+ toOuterPoint(this.scrollWorldTransform, inner, to, distance);
5893
5894
  if (relative) relative.worldToInner(to ? to : inner, null, distance);
5894
5895
  }
5895
5896
  getBoxPoint(world, relative, distance, change) {
@@ -6343,7 +6344,7 @@ var LeaferUI = function(exports) {
6343
6344
  this.levelMap = null;
6344
6345
  }
6345
6346
  }
6346
- const version = "1.9.2";
6347
+ const version = "1.9.4";
6347
6348
  class LeaferCanvas extends LeaferCanvasBase {
6348
6349
  get allowBackgroundColor() {
6349
6350
  return true;
@@ -8370,26 +8371,24 @@ var LeaferUI = function(exports) {
8370
8371
  }
8371
8372
  __updateStrokeBounds() {}
8372
8373
  __updateRenderBounds() {
8373
- let isOverflow;
8374
+ let isOverflow, isScrollMode;
8374
8375
  if (this.children.length) {
8375
- 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;
8376
8377
  const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
8377
8378
  super.__updateRenderBounds(childrenRenderBounds);
8378
- scroll(childrenRenderBounds, data);
8379
+ if (isScrollMode = overflow.includes("scroll")) {
8380
+ add(childrenRenderBounds, boxBounds);
8381
+ scroll(childrenRenderBounds, data);
8382
+ }
8379
8383
  this.__updateRectRenderBounds();
8380
8384
  isOverflow = !includes$1(boxBounds, childrenRenderBounds);
8381
- if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
8385
+ if (isOverflow && overflow === "show") add(renderBounds, childrenRenderBounds);
8382
8386
  } else this.__updateRectRenderBounds();
8383
8387
  DataHelper.stintSet(this, "isOverflow", isOverflow);
8384
- this.__checkScroll();
8388
+ this.__checkScroll(isScrollMode);
8385
8389
  }
8386
8390
  __updateRectRenderBounds() {}
8387
- __updateWorldBounds() {
8388
- if (this.hasScroller) this.__updateScroll();
8389
- super.__updateWorldBounds();
8390
- }
8391
- __checkScroll() {}
8392
- __updateScroll() {}
8391
+ __checkScroll(_isScrollMode) {}
8393
8392
  __updateRectChange() {}
8394
8393
  __updateChange() {
8395
8394
  super.__updateChange();
@@ -10731,7 +10730,7 @@ var LeaferUI = function(exports) {
10731
10730
  if (leafer && leafer.viewReady) leafer.renderer.ignore = value;
10732
10731
  }
10733
10732
  const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
10734
- const {floor: floor$1, max: max, abs: abs$3} = Math;
10733
+ const {floor: floor$1, max: max$1, abs: abs$4} = Math;
10735
10734
  function createPattern(ui, paint, pixelRatio) {
10736
10735
  let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
10737
10736
  const id = scaleX + "-" + scaleY + "-" + pixelRatio;
@@ -10743,8 +10742,8 @@ var LeaferUI = function(exports) {
10743
10742
  const xGap = gap && gap.x * scaleX;
10744
10743
  const yGap = gap && gap.y * scaleY;
10745
10744
  if (sx) {
10746
- sx = abs$3(sx);
10747
- sy = abs$3(sy);
10745
+ sx = abs$4(sx);
10746
+ sy = abs$4(sy);
10748
10747
  imageMatrix = get$1();
10749
10748
  copy$4(imageMatrix, transform);
10750
10749
  scale$2(imageMatrix, 1 / sx, 1 / sy);
@@ -10782,7 +10781,7 @@ var LeaferUI = function(exports) {
10782
10781
  }
10783
10782
  if (imageMatrix) {
10784
10783
  const canvasWidth = width + (xGap || 0), canvasHeight = height + (yGap || 0);
10785
- 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));
10786
10785
  }
10787
10786
  const canvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap);
10788
10787
  const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
@@ -11697,7 +11696,7 @@ var LeaferUI = function(exports) {
11697
11696
  return (target, key) => {
11698
11697
  defineKey(target, key, {
11699
11698
  get() {
11700
- 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);
11701
11700
  if (element && element.editConfig) Object.assign(mergeConfig, element.editConfig);
11702
11701
  if (editBox.config) Object.assign(mergeConfig, editBox.config);
11703
11702
  if (dragPoint) {
@@ -11708,12 +11707,13 @@ var LeaferUI = function(exports) {
11708
11707
  isNull(mergeConfig.lockRatio) && (mergeConfig.lockRatio = true);
11709
11708
  }
11710
11709
  }
11710
+ if (isUndefined(mergeConfig.dragLimitAnimate)) mergeConfig.dragLimitAnimate = app && app.config.pointer.dragLimitAnimate;
11711
11711
  return this.mergedConfig = mergeConfig;
11712
11712
  }
11713
11713
  });
11714
11714
  };
11715
11715
  }
11716
- const {abs: abs$2} = Math;
11716
+ const {abs: abs$3} = Math;
11717
11717
  const {copy: copy$2, scale: scale$1} = MatrixHelper;
11718
11718
  const {setListWithFn: setListWithFn} = BoundsHelper;
11719
11719
  const {worldBounds: worldBounds} = LeafBoundsHelper;
@@ -11750,7 +11750,7 @@ var LeaferUI = function(exports) {
11750
11750
  leaf = list[i];
11751
11751
  const {worldTransform: worldTransform, worldRenderBounds: worldRenderBounds} = leaf;
11752
11752
  if (worldRenderBounds.width && worldRenderBounds.height && (!bounds || bounds.hit(worldRenderBounds, options.matrix))) {
11753
- const aScaleX = abs$2(worldTransform.scaleX), aScaleY = abs$2(worldTransform.scaleY);
11753
+ const aScaleX = abs$3(worldTransform.scaleX), aScaleY = abs$3(worldTransform.scaleY);
11754
11754
  copy$2(matrix$1, worldTransform);
11755
11755
  matrix$1.half = strokeWidth % 2;
11756
11756
  if (aScaleX !== aScaleY) {
@@ -11764,7 +11764,7 @@ var LeaferUI = function(exports) {
11764
11764
  canvas.setWorld(matrix$1, options.matrix);
11765
11765
  canvas.beginPath();
11766
11766
  if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
11767
- data.strokeWidth = strokeWidth / abs$2(worldTransform.scaleX);
11767
+ data.strokeWidth = strokeWidth / abs$3(worldTransform.scaleX);
11768
11768
  }
11769
11769
  if (stroke) isString(stroke) ? Paint.stroke(stroke, this, canvas) : Paint.strokes(stroke, this, canvas);
11770
11770
  if (fill) isString(fill) ? Paint.fill(fill, this, canvas) : Paint.fills(fill, this, canvas);
@@ -12048,7 +12048,7 @@ var LeaferUI = function(exports) {
12048
12048
  }
12049
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;
12050
12050
  const {toPoint: toPoint} = AroundHelper;
12051
- const {within: within$2} = MathHelper;
12051
+ const {within: within$3, sign: sign$1} = MathHelper;
12052
12052
  const EditDataHelper = {
12053
12053
  getScaleData(target, startBounds, direction, totalMove, lockRatio, around, flipable, scaleMode) {
12054
12054
  let align, origin = {}, scaleX = 1, scaleY = 1;
@@ -12060,8 +12060,8 @@ var LeaferUI = function(exports) {
12060
12060
  }
12061
12061
  const originChangedScaleX = target.scaleX / startBounds.scaleX;
12062
12062
  const originChangedScaleY = target.scaleY / startBounds.scaleY;
12063
- const signX = originChangedScaleX < 0 ? -1 : 1;
12064
- const signY = originChangedScaleY < 0 ? -1 : 1;
12063
+ const signX = sign$1(originChangedScaleX);
12064
+ const signY = sign$1(originChangedScaleY);
12065
12065
  const changedScaleX = scaleMode ? originChangedScaleX : signX * boxBounds.width / width;
12066
12066
  const changedScaleY = scaleMode ? originChangedScaleY : signY * boxBounds.height / height;
12067
12067
  totalMove.x *= scaleMode ? originChangedScaleX : signX;
@@ -12161,14 +12161,14 @@ var LeaferUI = function(exports) {
12161
12161
  }
12162
12162
  if (useScaleX && widthRange) {
12163
12163
  const nowWidth = boxBounds.width * target.scaleX;
12164
- scaleX = within$2(nowWidth * scaleX, widthRange) / nowWidth;
12164
+ scaleX = within$3(nowWidth * scaleX, widthRange) / nowWidth;
12165
12165
  }
12166
12166
  if (useScaleY && heightRange) {
12167
12167
  const nowHeight = boxBounds.height * target.scaleY;
12168
- scaleY = within$2(nowHeight * scaleY, heightRange) / nowHeight;
12168
+ scaleY = within$3(nowHeight * scaleY, heightRange) / nowHeight;
12169
12169
  }
12170
- if (useScaleX && Math.abs(scaleX * worldBoxBounds.width) < 1) scaleX = (scaleX < 0 ? -1 : 1) / worldBoxBounds.width;
12171
- 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;
12172
12172
  if (lockRatio && scaleX !== scaleY) scaleY = scaleX = Math.min(scaleX, scaleY);
12173
12173
  return {
12174
12174
  origin: origin,
@@ -12663,7 +12663,7 @@ var LeaferUI = function(exports) {
12663
12663
  if (pointType && pointType.includes("resize")) ResizeEvent.resizingKeys = editor.leafList.keys;
12664
12664
  }
12665
12665
  onDragEnd(e) {
12666
- if (this.moving) this.transformTool.onMove(e);
12666
+ if (this.moving && this.mergeConfig.dragLimitAnimate && this.target.dragBounds) this.transformTool.onMove(e);
12667
12667
  this.dragPoint = null;
12668
12668
  this.resetDoing();
12669
12669
  const {name: name, pointType: pointType} = e.current;
@@ -13134,9 +13134,8 @@ var LeaferUI = function(exports) {
13134
13134
  EditorSkewEvent.SKEW = "editor.skew";
13135
13135
  class TransformTool {
13136
13136
  onMove(e) {
13137
- const {target: target, mergeConfig: mergeConfig, dragStartData: dragStartData, app: app} = this.editBox;
13137
+ const {target: target, mergeConfig: mergeConfig, dragStartData: dragStartData} = this.editBox;
13138
13138
  let move, {dragLimitAnimate: dragLimitAnimate} = mergeConfig;
13139
- if (isUndefined(dragLimitAnimate)) dragLimitAnimate = app && app.config.pointer.dragLimitAnimate;
13140
13139
  const isMoveEnd = e.type === exports.MoveEvent.END || e.type === exports.DragEvent.END;
13141
13140
  const axisDrag = isString(target.draggable);
13142
13141
  const checkLimitMove = !dragLimitAnimate || isMoveEnd || axisDrag;
@@ -13482,11 +13481,22 @@ var LeaferUI = function(exports) {
13482
13481
  updateEditTool() {
13483
13482
  this.unloadEditTool();
13484
13483
  if (this.editing) {
13485
- const name = this.element.editOuter || "EditTool";
13486
- const tool = this.editTool = this.editToolList[name] = this.editToolList[name] || EditToolCreator.get(name, this);
13487
- this.editBox.load();
13488
- tool.load();
13489
- this.update();
13484
+ const target = this.element;
13485
+ let name = target.editOuter || "EditTool";
13486
+ const {beforeEditOuter: beforeEditOuter} = this.mergeConfig;
13487
+ if (beforeEditOuter) {
13488
+ const check = beforeEditOuter({
13489
+ target: target,
13490
+ name: name
13491
+ });
13492
+ if (isString(check)) name = check; else if (check === false) return;
13493
+ }
13494
+ if (EditToolCreator.list[name]) {
13495
+ const tool = this.editTool = this.editToolList[name] = this.editToolList[name] || EditToolCreator.get(name, this);
13496
+ this.editBox.load();
13497
+ tool.load();
13498
+ this.update();
13499
+ }
13490
13500
  }
13491
13501
  }
13492
13502
  unloadEditTool() {
@@ -13579,13 +13589,21 @@ var LeaferUI = function(exports) {
13579
13589
  if (isString(nameOrSelect)) name = nameOrSelect; else if (!select) select = nameOrSelect;
13580
13590
  if (target && select) this.target = target;
13581
13591
  if (this.single) {
13582
- const editTarget = target || this.element;
13583
- name || (name = editTarget.editInner);
13584
- if (name && EditToolCreator.list[name]) {
13592
+ if (!target) target = this.element;
13593
+ if (!name) name = target.editInner;
13594
+ const {beforeEditInner: beforeEditInner} = this.mergeConfig;
13595
+ if (beforeEditInner) {
13596
+ const check = beforeEditInner({
13597
+ target: target,
13598
+ name: name
13599
+ });
13600
+ if (isString(check)) name = check; else if (check === false) return;
13601
+ }
13602
+ if (EditToolCreator.list[name]) {
13585
13603
  this.editTool.unload();
13586
13604
  this.innerEditing = true;
13587
13605
  this.innerEditor = this.editToolList[name] = this.editToolList[name] || EditToolCreator.get(name, this);
13588
- this.innerEditor.editTarget = editTarget;
13606
+ this.innerEditor.editTarget = target;
13589
13607
  this.emitInnerEvent(InnerEditorEvent.BEFORE_OPEN);
13590
13608
  this.innerEditor.load();
13591
13609
  this.emitInnerEvent(InnerEditorEvent.OPEN);
@@ -14459,6 +14477,7 @@ var LeaferUI = function(exports) {
14459
14477
  };
14460
14478
  }
14461
14479
  };
14480
+ const {abs: abs$2, max: max} = Math, {sign: sign, within: within$2} = MathHelper;
14462
14481
  const WheelEventHelper = {
14463
14482
  getMove(event, config) {
14464
14483
  let {moveSpeed: moveSpeed} = config;
@@ -14467,8 +14486,9 @@ var LeaferUI = function(exports) {
14467
14486
  deltaX = deltaY;
14468
14487
  deltaY = 0;
14469
14488
  }
14470
- if (deltaX > 50) deltaX = Math.max(50, deltaX / 3);
14471
- 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);
14472
14492
  return {
14473
14493
  x: -deltaX * moveSpeed * 2,
14474
14494
  y: -deltaY * moveSpeed * 2
@@ -14486,11 +14506,9 @@ var LeaferUI = function(exports) {
14486
14506
  zoom = !event.shiftKey && (event.metaKey || event.ctrlKey);
14487
14507
  }
14488
14508
  if (zoom) {
14489
- zoomSpeed = MathHelper.within(zoomSpeed, 0, 1);
14509
+ zoomSpeed = within$2(zoomSpeed, 0, 1);
14490
14510
  const min = event.deltaY ? config.delta.y : config.delta.x;
14491
- scale = 1 - delta / (min * 4) * zoomSpeed;
14492
- if (scale < .5) scale = .5;
14493
- if (scale >= 1.5) scale = 1.5;
14511
+ scale = within$2(1 - delta / (min * 4) * zoomSpeed, .5, 1.5);
14494
14512
  }
14495
14513
  return scale;
14496
14514
  }