@leafer/worker 2.0.0 → 2.0.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
@@ -44,8 +44,8 @@ var LeaferUI = function(exports) {
44
44
  }
45
45
  const DataHelper = {
46
46
  default(t, defaultData) {
47
- assign$1(defaultData, t);
48
- assign$1(t, defaultData);
47
+ assign$2(defaultData, t);
48
+ assign$2(t, defaultData);
49
49
  return t;
50
50
  },
51
51
  assign(t, merge, exclude) {
@@ -53,9 +53,9 @@ var LeaferUI = function(exports) {
53
53
  Object.keys(merge).forEach(key => {
54
54
  var _a, _b;
55
55
  value = merge[key];
56
- if ((value === null || value === void 0 ? void 0 : value.constructor) === Object && ((_a = t[key]) === null || _a === void 0 ? void 0 : _a.constructor) === Object) return assign$1(t[key], merge[key], exclude && exclude[key]);
56
+ if ((value === null || value === void 0 ? void 0 : value.constructor) === Object && ((_a = t[key]) === null || _a === void 0 ? void 0 : _a.constructor) === Object) return assign$2(t[key], merge[key], exclude && exclude[key]);
57
57
  if (exclude && key in exclude) {
58
- if (((_b = exclude[key]) === null || _b === void 0 ? void 0 : _b.constructor) === Object) assign$1(t[key] = {}, merge[key], exclude[key]);
58
+ if (((_b = exclude[key]) === null || _b === void 0 ? void 0 : _b.constructor) === Object) assign$2(t[key] = {}, merge[key], exclude[key]);
59
59
  return;
60
60
  }
61
61
  t[key] = merge[key];
@@ -80,7 +80,7 @@ var LeaferUI = function(exports) {
80
80
  data[attrName] !== value && (data[attrName] = value);
81
81
  }
82
82
  };
83
- const {assign: assign$1} = DataHelper;
83
+ const {assign: assign$2} = DataHelper;
84
84
  class LeafData {
85
85
  get __useNaturalRatio() {
86
86
  return true;
@@ -377,7 +377,7 @@ var LeaferUI = function(exports) {
377
377
  };
378
378
  }
379
379
  const {sin: sin$6, cos: cos$6, acos: acos, sqrt: sqrt$5} = Math;
380
- const {float: float$5} = MathHelper;
380
+ const {float: float$6} = MathHelper;
381
381
  const tempPoint$5 = {};
382
382
  function getWorld() {
383
383
  return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
@@ -625,12 +625,12 @@ var LeaferUI = function(exports) {
625
625
  const cosR = c / scaleY;
626
626
  rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
627
627
  }
628
- const cosR = float$5(cos$6(rotation));
628
+ const cosR = float$6(cos$6(rotation));
629
629
  const sinR = sin$6(rotation);
630
- scaleX = float$5(scaleX), scaleY = float$5(scaleY);
631
- skewX = cosR ? float$5((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
632
- skewY = cosR ? float$5((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
633
- rotation = float$5(rotation / OneRadian);
630
+ scaleX = float$6(scaleX), scaleY = float$6(scaleY);
631
+ skewX = cosR ? float$6((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
632
+ skewY = cosR ? float$6((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
633
+ rotation = float$6(rotation / OneRadian);
634
634
  } else {
635
635
  scaleX = a;
636
636
  scaleY = d;
@@ -672,7 +672,7 @@ var LeaferUI = function(exports) {
672
672
  }
673
673
  };
674
674
  const M$b = MatrixHelper;
675
- const {float: float$4} = MathHelper;
675
+ const {float: float$5} = MathHelper;
676
676
  const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
677
677
  const {sin: sin$5, cos: cos$5, abs: abs$a, sqrt: sqrt$4, atan2: atan2$2, min: min$3, round: round$5} = Math;
678
678
  const PointHelper = {
@@ -810,7 +810,7 @@ var LeaferUI = function(exports) {
810
810
  return points;
811
811
  },
812
812
  isSame(t, point) {
813
- return float$4(t.x) === float$4(point.x) && float$4(t.y) === float$4(point.y);
813
+ return float$5(t.x) === float$5(point.x) && float$5(t.y) === float$5(point.y);
814
814
  },
815
815
  reset(t) {
816
816
  P$7.reset(t);
@@ -1144,14 +1144,14 @@ var LeaferUI = function(exports) {
1144
1144
  };
1145
1145
  const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$5, addPoint: addPoint$3, toBounds: toBounds$3} = TwoPointBoundsHelper;
1146
1146
  const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
1147
- const {float: float$3, fourNumber: fourNumber$1} = MathHelper;
1147
+ const {float: float$4, fourNumber: fourNumber$1} = MathHelper;
1148
1148
  const {floor: floor$2, ceil: ceil$2} = Math;
1149
1149
  let right$4, bottom$3, boundsRight, boundsBottom;
1150
1150
  const point$2 = {};
1151
1151
  const toPoint$5 = {};
1152
- const tempBounds$3 = {};
1152
+ const tempBounds$4 = {};
1153
1153
  const BoundsHelper = {
1154
- tempBounds: tempBounds$3,
1154
+ tempBounds: tempBounds$4,
1155
1155
  set(t, x = 0, y = 0, width = 0, height = 0) {
1156
1156
  t.x = x;
1157
1157
  t.y = y;
@@ -1220,9 +1220,9 @@ var LeaferUI = function(exports) {
1220
1220
  t.height *= scaleY;
1221
1221
  },
1222
1222
  tempToOuterOf(t, matrix) {
1223
- B.copy(tempBounds$3, t);
1224
- B.toOuterOf(tempBounds$3, matrix);
1225
- return tempBounds$3;
1223
+ B.copy(tempBounds$4, t);
1224
+ B.toOuterOf(tempBounds$4, matrix);
1225
+ return tempBounds$4;
1226
1226
  },
1227
1227
  getOuterOf(t, matrix) {
1228
1228
  t = Object.assign({}, t);
@@ -1280,9 +1280,9 @@ var LeaferUI = function(exports) {
1280
1280
  put(t, put, align = "center", putScale = 1, changeSize = true, to) {
1281
1281
  to || (to = put);
1282
1282
  if (isString(putScale)) putScale = B.getFitScale(t, put, putScale === "cover");
1283
- tempBounds$3.width = changeSize ? put.width *= putScale : put.width * putScale;
1284
- tempBounds$3.height = changeSize ? put.height *= putScale : put.height * putScale;
1285
- AlignHelper.toPoint(align, tempBounds$3, t, to, true, true);
1283
+ tempBounds$4.width = changeSize ? put.width *= putScale : put.width * putScale;
1284
+ tempBounds$4.height = changeSize ? put.height *= putScale : put.height * putScale;
1285
+ AlignHelper.toPoint(align, tempBounds$4, t, to, true, true);
1286
1286
  },
1287
1287
  getSpread(t, spread, side) {
1288
1288
  const n = {};
@@ -1313,10 +1313,10 @@ var LeaferUI = function(exports) {
1313
1313
  }
1314
1314
  },
1315
1315
  float(t, maxLength) {
1316
- t.x = float$3(t.x, maxLength);
1317
- t.y = float$3(t.y, maxLength);
1318
- t.width = float$3(t.width, maxLength);
1319
- t.height = float$3(t.height, maxLength);
1316
+ t.x = float$4(t.x, maxLength);
1317
+ t.y = float$4(t.y, maxLength);
1318
+ t.width = float$4(t.width, maxLength);
1319
+ t.height = float$4(t.height, maxLength);
1320
1320
  },
1321
1321
  add(t, bounds, isPoint) {
1322
1322
  right$4 = t.x + t.width;
@@ -1581,7 +1581,7 @@ var LeaferUI = function(exports) {
1581
1581
  BoundsHelper.reset(this);
1582
1582
  }
1583
1583
  }
1584
- const tempBounds$2 = new Bounds;
1584
+ const tempBounds$3 = new Bounds;
1585
1585
  class AutoBounds {
1586
1586
  constructor(top, right, bottom, left, width, height) {
1587
1587
  isObject(top) ? this.copy(top) : this.set(top, right, bottom, left, width, height);
@@ -1650,7 +1650,7 @@ var LeaferUI = function(exports) {
1650
1650
  resize(view, width, height, xGap, yGap, clip, smooth, opacity, _filters, interlace) {
1651
1651
  const realWidth = max$5(floor$1(width + (xGap || 0)), 1), realHeight = max$5(floor$1(height + (yGap || 0)), 1);
1652
1652
  let interlaceX, interlaceY, interlaceOffset;
1653
- if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset, (interlaceX = interlace.type === "x") ? width : height))) interlaceX || (interlaceY = true);
1653
+ if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset, interlace.type === "x" ? width : height))) interlace.type === "x" ? interlaceX = true : interlaceY = true;
1654
1654
  const canvas = Platform.origin.createCanvas(interlaceY ? realWidth * 2 : realWidth, interlaceX ? realHeight * 2 : realHeight);
1655
1655
  const ctx = canvas.getContext("2d");
1656
1656
  if (opacity) ctx.globalAlpha = opacity;
@@ -2739,7 +2739,7 @@ var LeaferUI = function(exports) {
2739
2739
  return [];
2740
2740
  }
2741
2741
  };
2742
- const {M: M$9, m: m, L: L$9, l: l, H: H, h: h, V: V, v: v, C: C$7, c: c, S: S, s: s, Q: Q$6, q: q, T: T, t: t, A: A, a: a, Z: Z$7, z: z, N: N$5, D: D$6, X: X$5, G: G$5, F: F$6, O: O$6, P: P$5, U: U$5} = PathCommandMap;
2742
+ const {M: M$9, m: m, L: L$9, l: l, H: H, h: h, V: V, v: v, C: C$7, c: c, S: S$1, s: s, Q: Q$6, q: q, T: T, t: t, A: A, a: a, Z: Z$7, z: z, N: N$5, D: D$6, X: X$5, G: G$5, F: F$6, O: O$6, P: P$5, U: U$5} = PathCommandMap;
2743
2743
  const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
2744
2744
  const {ellipticalArc: ellipticalArc} = EllipseHelper;
2745
2745
  const debug$f = Debug.get("PathConvert");
@@ -2867,10 +2867,10 @@ var LeaferUI = function(exports) {
2867
2867
  old[i + 2] += y;
2868
2868
  old[i + 3] += x;
2869
2869
  old[i + 4] += y;
2870
- command = S;
2870
+ command = S$1;
2871
2871
 
2872
- case S:
2873
- smooth = lastCommand === C$7 || lastCommand === S;
2872
+ case S$1:
2873
+ smooth = lastCommand === C$7 || lastCommand === S$1;
2874
2874
  x1 = smooth ? x * 2 - controlX : old[i + 1];
2875
2875
  y1 = smooth ? y * 2 - controlY : old[i + 2];
2876
2876
  controlX = old[i + 1];
@@ -3114,10 +3114,10 @@ var LeaferUI = function(exports) {
3114
3114
  data.push(O$5, x, y, radius, startAngle, endAngle, anticlockwise ? 1 : 0);
3115
3115
  }
3116
3116
  },
3117
- arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
3117
+ arcTo(data, x1, y1, x2, y2, radius, lastX, lastY, fullRadius) {
3118
3118
  if (!isUndefined(lastX)) {
3119
- const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
3120
- radius = min$2(radius, min$2(d / 2, d / 2 * abs$8(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3119
+ const r = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / (fullRadius ? 1 : 2);
3120
+ radius = min$2(radius, min$2(r, r * abs$8(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3121
3121
  }
3122
3122
  data.push(U$4, x1, y1, x2, y2, radius);
3123
3123
  },
@@ -3442,7 +3442,7 @@ var LeaferUI = function(exports) {
3442
3442
  let command, lastCommand, commandLen;
3443
3443
  let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
3444
3444
  if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
3445
- const len = data.length;
3445
+ const len = data.length, three = len === 9;
3446
3446
  const smooth = [];
3447
3447
  while (i < len) {
3448
3448
  command = data[i];
@@ -3454,7 +3454,7 @@ var LeaferUI = function(exports) {
3454
3454
  if (data[i] === L$5) {
3455
3455
  secondX = data[i + 1];
3456
3456
  secondY = data[i + 2];
3457
- smooth.push(M$5, getCenterX(startX, secondX), getCenterY(startY, secondY));
3457
+ three ? smooth.push(M$5, startX, startY) : smooth.push(M$5, getCenterX(startX, secondX), getCenterY(startY, secondY));
3458
3458
  } else {
3459
3459
  smooth.push(M$5, startX, startY);
3460
3460
  }
@@ -3466,11 +3466,11 @@ var LeaferUI = function(exports) {
3466
3466
  i += 3;
3467
3467
  switch (data[i]) {
3468
3468
  case L$5:
3469
- arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY);
3469
+ arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY, three);
3470
3470
  break;
3471
3471
 
3472
3472
  case Z$3:
3473
- arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY);
3473
+ arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY, three);
3474
3474
  break;
3475
3475
 
3476
3476
  default:
@@ -3482,7 +3482,7 @@ var LeaferUI = function(exports) {
3482
3482
 
3483
3483
  case Z$3:
3484
3484
  if (lastCommand !== Z$3) {
3485
- arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY);
3485
+ arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY, three);
3486
3486
  smooth.push(Z$3);
3487
3487
  }
3488
3488
  i += 1;
@@ -6567,7 +6567,7 @@ var LeaferUI = function(exports) {
6567
6567
  this.levelMap = null;
6568
6568
  }
6569
6569
  }
6570
- const version = "2.0.0";
6570
+ const version = "2.0.1";
6571
6571
  class LeaferCanvas extends LeaferCanvasBase {
6572
6572
  get allowBackgroundColor() {
6573
6573
  return true;
@@ -7523,16 +7523,16 @@ var LeaferUI = function(exports) {
7523
7523
  return t.fill || t.stroke;
7524
7524
  }
7525
7525
  get __autoWidth() {
7526
- return !this._width;
7526
+ return this._width == null;
7527
7527
  }
7528
7528
  get __autoHeight() {
7529
- return !this._height;
7529
+ return this._height == null;
7530
7530
  }
7531
7531
  get __autoSide() {
7532
- return !this._width || !this._height;
7532
+ return this._width == null || this._height == null;
7533
7533
  }
7534
7534
  get __autoSize() {
7535
- return !this._width && !this._height;
7535
+ return this._width == null && this._height == null;
7536
7536
  }
7537
7537
  setVisible(value) {
7538
7538
  this._visible = value;
@@ -9260,7 +9260,7 @@ var LeaferUI = function(exports) {
9260
9260
  EventCreator.changeName(oldName, newName);
9261
9261
  }
9262
9262
  }
9263
- const {min: min$1, max: max$3, abs: abs$7} = Math, {float: float$2, sign: sign$2} = MathHelper, {minX: minX, maxX: maxX, minY: minY, maxY: maxY} = BoundsHelper;
9263
+ const {min: min$1, max: max$3, abs: abs$7} = Math, {float: float$3, sign: sign$2} = MathHelper, {minX: minX, maxX: maxX, minY: minY, maxY: maxY} = BoundsHelper;
9264
9264
  const tempContent = new Bounds, tempDragBounds = new Bounds;
9265
9265
  const DragBoundsHelper = {
9266
9266
  limitMove(leaf, move) {
@@ -9298,8 +9298,8 @@ var LeaferUI = function(exports) {
9298
9298
  } else {
9299
9299
  if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
9300
9300
  }
9301
- move.x = float$2(move.x);
9302
- move.y = float$2(move.y);
9301
+ move.x = float$3(move.x);
9302
+ move.y = float$3(move.y);
9303
9303
  return move;
9304
9304
  },
9305
9305
  getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, lockRatio, change) {
@@ -9311,26 +9311,26 @@ var LeaferUI = function(exports) {
9311
9311
  let correctScaleX = 1, correctScaleY = 1, aScale, bScale, aSize, bSize;
9312
9312
  if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
9313
9313
  if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
9314
- aSize = float$2(tempContent.minX - tempDragBounds.minX);
9315
- bSize = float$2(tempDragBounds.maxX - tempContent.maxX);
9314
+ aSize = float$3(tempContent.minX - tempDragBounds.minX);
9315
+ bSize = float$3(tempDragBounds.maxX - tempContent.maxX);
9316
9316
  aScale = originLeftScale && aSize > 0 ? 1 + aSize / (originLeftScale * tempContent.width) : 1;
9317
9317
  bScale = originRightScale && bSize > 0 ? 1 + bSize / (originRightScale * tempContent.width) : 1;
9318
9318
  correctScaleX *= max$3(aScale, bScale);
9319
9319
  } else {
9320
9320
  if (scale.x < 0) {
9321
- if (float$2(minX(content) - minX(dragBounds)) <= 0 || float$2(maxX(dragBounds) - maxX(content)) <= 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
9321
+ if (float$3(minX(content) - minX(dragBounds)) <= 0 || float$3(maxX(dragBounds) - maxX(content)) <= 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
9322
9322
  tempContent.unsign();
9323
9323
  }
9324
- aSize = float$2(tempDragBounds.minX - tempContent.minX);
9325
- bSize = float$2(tempContent.maxX - tempDragBounds.maxX);
9324
+ aSize = float$3(tempDragBounds.minX - tempContent.minX);
9325
+ bSize = float$3(tempContent.maxX - tempDragBounds.maxX);
9326
9326
  aScale = originLeftScale && aSize > 0 ? 1 - aSize / (originLeftScale * tempContent.width) : 1;
9327
9327
  bScale = originRightScale && bSize > 0 ? 1 - bSize / (originRightScale * tempContent.width) : 1;
9328
9328
  correctScaleX *= min$1(aScale, bScale);
9329
9329
  }
9330
9330
  if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
9331
9331
  if (scale.y < 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
9332
- aSize = float$2(tempContent.minY - tempDragBounds.minY);
9333
- bSize = float$2(tempDragBounds.maxY - tempContent.maxY);
9332
+ aSize = float$3(tempContent.minY - tempDragBounds.minY);
9333
+ bSize = float$3(tempDragBounds.maxY - tempContent.maxY);
9334
9334
  aScale = originTopScale && aSize > 0 ? 1 + aSize / (originTopScale * tempContent.height) : 1;
9335
9335
  bScale = originBottomScale && bSize > 0 ? 1 + bSize / (originBottomScale * tempContent.height) : 1;
9336
9336
  correctScaleY *= max$3(aScale, bScale);
@@ -9341,11 +9341,11 @@ var LeaferUI = function(exports) {
9341
9341
  }
9342
9342
  } else {
9343
9343
  if (scale.y < 0) {
9344
- if (float$2(minY(content) - minY(dragBounds)) <= 0 || float$2(maxY(dragBounds) - maxY(content)) <= 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
9344
+ if (float$3(minY(content) - minY(dragBounds)) <= 0 || float$3(maxY(dragBounds) - maxY(content)) <= 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
9345
9345
  tempContent.unsign();
9346
9346
  }
9347
- aSize = float$2(tempDragBounds.minY - tempContent.minY);
9348
- bSize = float$2(tempContent.maxY - tempDragBounds.maxY);
9347
+ aSize = float$3(tempDragBounds.minY - tempContent.minY);
9348
+ bSize = float$3(tempContent.maxY - tempDragBounds.maxY);
9349
9349
  aScale = originTopScale && aSize > 0 ? 1 - aSize / (originTopScale * tempContent.height) : 1;
9350
9350
  bScale = originBottomScale && bSize > 0 ? 1 - bSize / (originBottomScale * tempContent.height) : 1;
9351
9351
  correctScaleY *= min$1(aScale, bScale);
@@ -9778,7 +9778,7 @@ var LeaferUI = function(exports) {
9778
9778
  function exclude(leaf, excludePath) {
9779
9779
  return excludePath && excludePath.has(leaf);
9780
9780
  }
9781
- const config$1 = {
9781
+ const config$2 = {
9782
9782
  wheel: {
9783
9783
  zoomSpeed: .5,
9784
9784
  moveSpeed: .5,
@@ -9850,7 +9850,7 @@ var LeaferUI = function(exports) {
9850
9850
  return this.p.hitRadius;
9851
9851
  }
9852
9852
  constructor(target, canvas, selector, userConfig) {
9853
- this.config = DataHelper.clone(config$1);
9853
+ this.config = DataHelper.clone(config$2);
9854
9854
  this.tapCount = 0;
9855
9855
  this.downKeyMap = {};
9856
9856
  this.target = target;
@@ -10353,8 +10353,8 @@ var LeaferUI = function(exports) {
10353
10353
  if (isHitPixel) {
10354
10354
  const {renderBounds: renderBounds} = this.__layout;
10355
10355
  const size = Platform.image.hitCanvasSize;
10356
- const scale = h.hitScale = tempBounds$2.set(0, 0, size, size).getFitMatrix(renderBounds).a;
10357
- const {x: x, y: y, width: width, height: height} = tempBounds$2.set(renderBounds).scale(scale);
10356
+ const scale = h.hitScale = tempBounds$3.set(0, 0, size, size).getFitMatrix(renderBounds).a;
10357
+ const {x: x, y: y, width: width, height: height} = tempBounds$3.set(renderBounds).scale(scale);
10358
10358
  h.resize({
10359
10359
  width: width,
10360
10360
  height: height,
@@ -10412,11 +10412,11 @@ var LeaferUI = function(exports) {
10412
10412
  }
10413
10413
  return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
10414
10414
  };
10415
- const ui$4 = exports.UI.prototype, rect = exports.Rect.prototype, box$2 = exports.Box.prototype;
10416
- rect.__updateHitCanvas = box$2.__updateHitCanvas = function() {
10415
+ const ui$4 = exports.UI.prototype, rect = exports.Rect.prototype, box$3 = exports.Box.prototype;
10416
+ rect.__updateHitCanvas = box$3.__updateHitCanvas = function() {
10417
10417
  if (this.stroke || this.cornerRadius || (this.fill || this.__.__isCanvas) && this.hitFill === "pixel" || this.hitStroke === "all") ui$4.__updateHitCanvas.call(this); else if (this.__hitCanvas) this.__hitCanvas = null;
10418
10418
  };
10419
- rect.__hitFill = box$2.__hitFill = function(inner) {
10419
+ rect.__hitFill = box$3.__hitFill = function(inner) {
10420
10420
  return this.__hitCanvas ? ui$4.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
10421
10421
  };
10422
10422
  exports.Text.prototype.__drawHitPath = function(canvas) {
@@ -10442,8 +10442,8 @@ var LeaferUI = function(exports) {
10442
10442
  canvas$1.hitPixel = function(radiusPoint, offset, scale = 1) {
10443
10443
  let {x: x, y: y, radiusX: radiusX, radiusY: radiusY} = radiusPoint;
10444
10444
  if (offset) x -= offset.x, y -= offset.y;
10445
- tempBounds$2.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
10446
- const {data: data} = this.context.getImageData(tempBounds$2.x, tempBounds$2.y, tempBounds$2.width || 1, tempBounds$2.height || 1);
10445
+ tempBounds$3.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
10446
+ const {data: data} = this.context.getImageData(tempBounds$3.x, tempBounds$3.y, tempBounds$3.width || 1, tempBounds$3.height || 1);
10447
10447
  for (let i = 0, len = data.length; i < len; i += 4) {
10448
10448
  if (data[i + 3] > 0) return true;
10449
10449
  }
@@ -10630,13 +10630,13 @@ var LeaferUI = function(exports) {
10630
10630
  }
10631
10631
  }
10632
10632
  const {getSpread: getSpread, copyAndSpread: copyAndSpread$1, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$7, getIntersectData: getIntersectData} = BoundsHelper;
10633
- const tempBounds$1 = {};
10633
+ const tempBounds$2 = {};
10634
10634
  function shape(ui, current, options) {
10635
10635
  const canvas = current.getSameCanvas();
10636
10636
  const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
10637
10637
  const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
10638
- toOuterOf(layout.strokeSpread ? (copyAndSpread$1(tempBounds$1, layout.boxBounds, layout.strokeSpread),
10639
- tempBounds$1) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
10638
+ toOuterOf(layout.strokeSpread ? (copyAndSpread$1(tempBounds$2, layout.boxBounds, layout.strokeSpread),
10639
+ tempBounds$2) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
10640
10640
  let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
10641
10641
  let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
10642
10642
  if (currentBounds.includes(nowWorldShapeBounds)) {
@@ -10782,7 +10782,7 @@ var LeaferUI = function(exports) {
10782
10782
  drawStrokesStyle: drawStrokesStyle,
10783
10783
  shape: shape
10784
10784
  };
10785
- let cache$1, box$1 = new Bounds;
10785
+ let cache$1, box$2 = new Bounds;
10786
10786
  const {isSame: isSame} = BoundsHelper;
10787
10787
  function image(ui, attrName, paint, boxBounds, firstUse) {
10788
10788
  let leafPaint, event;
@@ -10798,7 +10798,7 @@ var LeaferUI = function(exports) {
10798
10798
  cache$1 = image.use > 1 ? {
10799
10799
  leafPaint: leafPaint,
10800
10800
  paint: paint,
10801
- boxBounds: box$1.set(boxBounds)
10801
+ boxBounds: box$2.set(boxBounds)
10802
10802
  } : null;
10803
10803
  }
10804
10804
  if (firstUse || image.loading) event = {
@@ -11283,7 +11283,7 @@ var LeaferUI = function(exports) {
11283
11283
  getTransform: getTransform
11284
11284
  };
11285
11285
  const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$2, abs: abs$5} = Math;
11286
- const tempBounds = {}, tempMatrix = new Matrix;
11286
+ const tempBounds$1 = {}, tempMatrix = new Matrix;
11287
11287
  const offsetOutBounds$1 = {};
11288
11288
  function shadow$1(ui, current, shape) {
11289
11289
  let copyBounds, transform;
@@ -11345,9 +11345,9 @@ var LeaferUI = function(exports) {
11345
11345
  const {shapeBounds: shapeBounds} = shape;
11346
11346
  let from, to;
11347
11347
  if (Platform.fullImageShadow) {
11348
- copy$3(tempBounds, canvas.bounds);
11349
- move$6(tempBounds, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
11350
- from = canvas.bounds, to = tempBounds;
11348
+ copy$3(tempBounds$1, canvas.bounds);
11349
+ move$6(tempBounds$1, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
11350
+ from = canvas.bounds, to = tempBounds$1;
11351
11351
  } else {
11352
11352
  from = shapeBounds, to = outBounds;
11353
11353
  }
@@ -11774,7 +11774,7 @@ var LeaferUI = function(exports) {
11774
11774
  let {x: x, y: y, width: width, height: height} = bounds, realHeight = __lineHeight * countRows + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
11775
11775
  let starY = __baseLine;
11776
11776
  if (__clipText && realHeight > height) {
11777
- realHeight = Math.max(height, __lineHeight);
11777
+ realHeight = Math.max(style.__autoHeight ? realHeight : height, __lineHeight);
11778
11778
  if (countRows > 1) drawData.overflow = countRows;
11779
11779
  } else if (height || autoSizeAlign) {
11780
11780
  switch (verticalAlign) {
@@ -11830,10 +11830,10 @@ var LeaferUI = function(exports) {
11830
11830
  bounds.height = realHeight;
11831
11831
  }
11832
11832
  function clipText(drawData, style, x, width) {
11833
- if (!width) return;
11834
11833
  const {rows: rows, overflow: overflow} = drawData;
11835
11834
  let {textOverflow: textOverflow} = style;
11836
- rows.splice(overflow);
11835
+ if (overflow) rows.splice(overflow);
11836
+ if (!width) return;
11837
11837
  if (textOverflow && textOverflow !== "show") {
11838
11838
  if (textOverflow === "hide") textOverflow = ""; else if (textOverflow === "ellipsis") textOverflow = "...";
11839
11839
  let char, charRight;
@@ -12119,8 +12119,13 @@ var LeaferUI = function(exports) {
12119
12119
  if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
12120
12120
  }
12121
12121
  data.strokeWidth = strokeWidth / Math.max(aScaleX, aScaleY);
12122
+ if (data.shadow) {
12123
+ const shadow = data.shadow[0], {scaleX: scaleX, scaleY: scaleY} = this.getRenderScaleData(true, shadow.scaleFixed);
12124
+ canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
12125
+ }
12122
12126
  if (stroke) isString(stroke) ? Paint.stroke(stroke, this, canvas, options) : Paint.strokes(stroke, this, canvas, options);
12123
12127
  if (fill) isString(fill) ? Paint.fill(fill, this, canvas, options) : Paint.fills(fill, this, canvas, options);
12128
+ if (data.shadow) canvas.restore();
12124
12129
  }
12125
12130
  }
12126
12131
  data.strokeWidth = strokeWidth;
@@ -13259,7 +13264,7 @@ var LeaferUI = function(exports) {
13259
13264
  const resizeSVG = `\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate({{rotation}},12,12)">\n<path d="M7.5 8.0H8.5V5.9L6.8 7.2L7.5 8.0ZM3 11.4L2.3 10.6L1.3 11.4L2.3 12.2L3 11.4ZM7.5 10.4H6.5V11.4H7.5V10.4ZM16.5 10.4V11.4H17.5V10.4H16.5ZM16.5 8.0L17.1 7.2L15.5 5.9V8.0H16.5ZM21 11.4L21.6 12.2L22.6 11.4L21.6 10.6L21 11.4ZM16.5 14.9H15.5V16.9L17.1 15.7L16.5 14.9ZM16.5 12.4H17.5V11.4H16.5V12.4ZM7.5 12.4V11.4H6.5V12.4H7.5ZM7.5 14.9L6.8 15.7L8.5 16.9V14.9H7.5ZM6.8 7.2L2.3 10.6L3.6 12.2L8.1 8.7L6.8 7.2ZM8.5 10.4V8.0H6.5V10.4H8.5ZM16.5 9.4H7.5V11.4H16.5V9.4ZM17.5 10.4V8.0H15.5V10.4H17.5ZM15.8 8.7L20.3 12.2L21.6 10.6L17.1 7.2L15.8 8.7ZM20.3 10.6L15.8 14.1L17.1 15.7L21.6 12.2L20.3 10.6ZM17.5 14.9V12.4H15.5V14.9H17.5ZM7.5 13.4H16.5V11.4H7.5V13.4ZM8.5 14.9V12.4H6.5V14.9H8.5ZM2.3 12.2L6.8 15.7L8.1 14.1L3.6 10.6L2.3 12.2Z" fill="white"/>\n<path fill-rule="evenodd" d="M3 11.4L7.5 8.0V10.4H16.5V8.0L21 11.4L16.5 14.9V12.4H7.5V14.9L3 11.4Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="3.9" width="27.2" height="16.9" filterUnits="userSpaceOnUse">\n${filterStyle$1}\n</filter>\n</defs>\n</svg>\n`;
13260
13265
  const rotateSVG = `\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(135,12,12),rotate({{rotation}},12,12)">\n<path d="M20.4 8H21.4L20.8 7.1L17.3 2.6L17 2.1L16.6 2.6L13.1 7.1L12.5 8H13.5H15.4C14.9 11.8 11.8 14.9 8 15.4V13.5V12.5L7.1 13.1L2.6 16.6L2.1 17L2.6 17.3L7.1 20.8L8 21.4V20.4V18.4C13.5 17.9 17.9 13.5 18.4 8H20.4Z" stroke="white"/>\n<path fill-rule="evenodd" d="M17 3L20.4 7.5H17.9C17.7 13.1 13.1 17.7 7.5 17.9V20.4L3 17L7.5 13.5V15.9C12.0 15.7 15.7 12.0 15.9 7.5H13.5L17 3Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="-0.6" width="27.1" height="27.1" filterUnits="userSpaceOnUse">\n${filterStyle$1}\n</filter>\n</defs>\n</svg>\n`;
13261
13266
  const skewSVG = `\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(90,12,12),rotate({{rotation}},12,12)">\n<path d="M21 10.4L21 11.4L23.8 11.4L21.6 9.6L21 10.4ZM17 10.4V11.4L17 11.4L17 10.4ZM15.5 6L16.1 5.2L14.5 3.9V6H15.5ZM15.5 8.4V9.4H16.5V8.4H15.5ZM6 8.4V7.4H5V8.4H6ZM6 10.4H5V11.4H6V10.4ZM7 14.4V13.4L7 13.4L7 14.4ZM3 14.4L3 13.4L0.1 13.4L2.3 15.2L3 14.4ZM8.5 18.9L7.8 19.7L9.5 21.0V18.9H8.5ZM8.5 16.4V15.4H7.5V16.4H8.5ZM19 16.4V17.4H20V16.4H19ZM19 14.4H20V13.4H19V14.4ZM21 9.4L17 9.4L17 11.4L21 11.4L21 9.4ZM14.8 6.7L20.3 11.2L21.6 9.6L16.1 5.2L14.8 6.7ZM16.5 8.4V6H14.5V8.4H16.5ZM6 9.4H15.5V7.4H6V9.4ZM7 10.4V8.4H5V10.4H7ZM15.5 9.4H6V11.4H15.5V9.4ZM17 9.4H15.5V11.4H17V9.4ZM7 15.4H8.5V13.4H7V15.4ZM3 15.4L7 15.4L7 13.4L3 13.4L3 15.4ZM9.1 18.1L3.6 13.6L2.3 15.2L7.8 19.7L9.1 18.1ZM7.5 16.4V18.9H9.5V16.4H7.5ZM19 15.4H8.5V17.4H19V15.4ZM18 14.4V16.4H20V14.4H18ZM8.5 15.4H19V13.4H8.5V15.4Z" fill="white"/>\n<path fill-rule="evenodd" d="M17 10.4L21 10.4L15.5 6V8.4H6V10.4H15.5H17ZM8.5 14.4H7L3 14.4L8.5 18.9V16.4H19V14.4H8.5Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter x="-2.8" y="1.9" width="29.6" height="23.1" filterUnits="userSpaceOnUse" >\n${filterStyle$1}\n</filter>\n</defs>\n</svg>\n`;
13262
- const config = {
13267
+ const config$1 = {
13263
13268
  editSize: "size",
13264
13269
  keyEvent: true,
13265
13270
  stroke: "#836DFF",
@@ -13861,7 +13866,7 @@ var LeaferUI = function(exports) {
13861
13866
  this.selector = new EditSelect(this);
13862
13867
  this.editMask = new EditMask(this);
13863
13868
  this.targetEventIds = [];
13864
- let mergedConfig = DataHelper.clone(config);
13869
+ let mergedConfig = DataHelper.clone(config$1);
13865
13870
  if (userConfig) mergedConfig = DataHelper.default(userConfig, mergedConfig);
13866
13871
  this.mergedConfig = this.config = mergedConfig;
13867
13872
  this.addMany(this.editMask, this.selector, this.editBox);
@@ -14138,7 +14143,10 @@ var LeaferUI = function(exports) {
14138
14143
  return "focus";
14139
14144
  }
14140
14145
  get editBox() {
14141
- return this.editor.editBox;
14146
+ return this._editBox || this.editor.editBox;
14147
+ }
14148
+ set editBox(value) {
14149
+ this._editBox = value;
14142
14150
  }
14143
14151
  constructor(editor) {
14144
14152
  this.eventIds = [];
@@ -14324,7 +14332,7 @@ var LeaferUI = function(exports) {
14324
14332
  onSkew(_e) {}
14325
14333
  onUpdate() {
14326
14334
  const {editBox: editBox} = this, {rotatePoints: rotatePoints, resizeLines: resizeLines, resizePoints: resizePoints, rect: rect} = editBox;
14327
- const line = this.editor.element;
14335
+ const line = editBox.target;
14328
14336
  let fromTo, leftOrRight;
14329
14337
  if (line.pathInputed) fromTo = this.getFromToByPath(line.__.path); else if (line.points) fromTo = this.getFromToByPoints(line.__.points);
14330
14338
  if (fromTo) {
@@ -16433,7 +16441,7 @@ var LeaferUI = function(exports) {
16433
16441
  }));
16434
16442
  }
16435
16443
  Plugin.add("flow", "resize");
16436
- const box = exports.Box.prototype, {__updateBoxBounds: __updateBoxBounds} = exports.Group.prototype;
16444
+ const box$1 = exports.Box.prototype, {__updateBoxBounds: __updateBoxBounds} = exports.Group.prototype;
16437
16445
  exports.UI.addAttr("flow", false, autoLayoutType);
16438
16446
  exports.UI.addAttr("gap", 0, boundsType);
16439
16447
  exports.UI.addAttr("flowAlign", "top-left", boundsType);
@@ -16444,7 +16452,7 @@ var LeaferUI = function(exports) {
16444
16452
  exports.UI.addAttr("autoHeight", undefined, autoBoundsType);
16445
16453
  exports.UI.addAttr("autoBox", undefined, boundsType);
16446
16454
  const {copyAndSpread: copyAndSpread} = BoundsHelper;
16447
- box.__updateFlowLayout = function() {
16455
+ box$1.__updateFlowLayout = function() {
16448
16456
  const {leaferIsCreated: leaferIsCreated, flow: flow} = this;
16449
16457
  if (leaferIsCreated) this.leafer.created = false;
16450
16458
  switch (flow) {
@@ -16467,7 +16475,7 @@ var LeaferUI = function(exports) {
16467
16475
  }
16468
16476
  if (leaferIsCreated) this.leafer.created = true;
16469
16477
  };
16470
- box.__updateContentBounds = function() {
16478
+ box$1.__updateContentBounds = function() {
16471
16479
  const {padding: padding} = this.__;
16472
16480
  const layout = this.__layout;
16473
16481
  const same = layout.contentBounds === layout.boxBounds;
@@ -16478,7 +16486,7 @@ var LeaferUI = function(exports) {
16478
16486
  if (!same) layout.shrinkContentCancel();
16479
16487
  }
16480
16488
  };
16481
- box.__updateBoxBounds = function(secondLayout) {
16489
+ box$1.__updateBoxBounds = function(secondLayout) {
16482
16490
  if (this.children.length && !this.pathInputed) {
16483
16491
  const data = this.__, {flow: flow} = data;
16484
16492
  if (data.__autoSide) {
@@ -17232,7 +17240,7 @@ var LeaferUI = function(exports) {
17232
17240
  const rgbaMatch = /^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i;
17233
17241
  const hslMatch = /^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i;
17234
17242
  const hslaMatch = /^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i;
17235
- const int = parseInt, float$1 = parseFloat, {round: round$1} = Math;
17243
+ const int = parseInt, float$2 = parseFloat, {round: round$1} = Math;
17236
17244
  let cache = {}, totalCache = 0;
17237
17245
  function colorToRGBA(color, opacity) {
17238
17246
  let RGBA;
@@ -17340,16 +17348,16 @@ var LeaferUI = function(exports) {
17340
17348
  r: int(match[1]),
17341
17349
  g: int(match[2]),
17342
17350
  b: int(match[3]),
17343
- a: float$1(match[4])
17351
+ a: float$2(match[4])
17344
17352
  };
17345
17353
  }
17346
17354
  function hslToRGBA(color) {
17347
17355
  const match = hslMatch.exec(color);
17348
- return hsla(float$1(match[1]), float$1(match[2]), float$1(match[3]), 1);
17356
+ return hsla(float$2(match[1]), float$2(match[2]), float$2(match[3]), 1);
17349
17357
  }
17350
17358
  function hslaToRGBA(color) {
17351
17359
  const match = hslaMatch.exec(color);
17352
- return hsla(float$1(match[1]), float$1(match[2]), float$1(match[3]), float$1(match[4]));
17360
+ return hsla(float$2(match[1]), float$2(match[2]), float$2(match[3]), float$2(match[4]));
17353
17361
  }
17354
17362
  const n1 = 1 / 6, n2 = .5, n3 = 2 / 3, n4 = 1 / 3;
17355
17363
  function hue(p, q, t) {
@@ -17552,7 +17560,7 @@ var LeaferUI = function(exports) {
17552
17560
  }
17553
17561
  };
17554
17562
  const {getDistance: getDistance} = HighBezierHelper;
17555
- const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float} = MathHelper;
17563
+ const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float$1} = MathHelper;
17556
17564
  const tempPoint = {}, tempFrom = {};
17557
17565
  const HighCurveHelper = {
17558
17566
  transform(data, matrix) {
@@ -17705,7 +17713,7 @@ var LeaferUI = function(exports) {
17705
17713
  tempFrom.y = y;
17706
17714
  to.x = toX;
17707
17715
  to.y = toY;
17708
- cutDistance = float(motionDistance - total);
17716
+ cutDistance = float$1(motionDistance - total);
17709
17717
  if (cutDistance) {
17710
17718
  PointHelper.getDistancePoint(tempFrom, to, cutDistance, true);
17711
17719
  path.push(command, to.x, to.y);
@@ -17724,7 +17732,7 @@ var LeaferUI = function(exports) {
17724
17732
  toY = data[i + 6];
17725
17733
  distance = segments[index];
17726
17734
  if (total + distance > motionDistance) {
17727
- cutDistance = float(motionDistance - total);
17735
+ cutDistance = float$1(motionDistance - total);
17728
17736
  if (cutDistance) {
17729
17737
  t = HighBezierHelper.getT(cutDistance, distance, x, y, x1, y1, x2, y2, toX, toY, motionPrecision);
17730
17738
  HighBezierHelper.cut(path, t, x, y, x1, y1, x2, y2, toX, toY);
@@ -17917,21 +17925,21 @@ var LeaferUI = function(exports) {
17917
17925
  const style = {}, button = findParentButton(leaf);
17918
17926
  const state = button ? leaf.state || button.state : leaf.state;
17919
17927
  const stateStyle = state && leaf.states[state];
17920
- if (stateStyle && State.isState(state, leaf, button)) exist = assign(style, stateStyle);
17928
+ if (stateStyle && State.isState(state, leaf, button)) exist = assign$1(style, stateStyle);
17921
17929
  const selectedStyle = style.selectedStyle || leaf.selectedStyle;
17922
- if (selectedStyle && State.isSelected(leaf, button)) exist = assign(style, selectedStyle);
17930
+ if (selectedStyle && State.isSelected(leaf, button)) exist = assign$1(style, selectedStyle);
17923
17931
  const placeholderStyle = style.placeholderStyle || leaf.placeholderStyle;
17924
- if (placeholderStyle && State.isPlacehold(leaf, button)) exist = assign(style, placeholderStyle);
17932
+ if (placeholderStyle && State.isPlacehold(leaf, button)) exist = assign$1(style, placeholderStyle);
17925
17933
  if (State.isDisabled(leaf, button)) {
17926
17934
  const disabledStyle = style.disabledStyle || leaf.disabledStyle;
17927
- if (disabledStyle) exist = assign(style, disabledStyle);
17935
+ if (disabledStyle) exist = assign$1(style, disabledStyle);
17928
17936
  } else {
17929
17937
  const focusStyle = style.focusStyle || leaf.focusStyle;
17930
- if (focusStyle && State.isFocus(leaf, button)) exist = assign(style, focusStyle);
17938
+ if (focusStyle && State.isFocus(leaf, button)) exist = assign$1(style, focusStyle);
17931
17939
  const hoverStyle = style.hoverStyle || leaf.hoverStyle;
17932
- if (hoverStyle && State.isHover(leaf, button)) exist = assign(style, hoverStyle);
17940
+ if (hoverStyle && State.isHover(leaf, button)) exist = assign$1(style, hoverStyle);
17933
17941
  const pressStyle = style.pressStyle || leaf.pressStyle;
17934
- if (pressStyle && State.isPress(leaf, button)) exist = assign(style, pressStyle);
17942
+ if (pressStyle && State.isPress(leaf, button)) exist = assign$1(style, pressStyle);
17935
17943
  }
17936
17944
  return exist ? style : undefined;
17937
17945
  }
@@ -17957,7 +17965,7 @@ var LeaferUI = function(exports) {
17957
17965
  if (type === "out" && isNull(data[name]) && isNull(style[name])) name = "transition";
17958
17966
  return isNull(style[name]) ? data[name] : style[name];
17959
17967
  }
17960
- function assign(style, stateStyle) {
17968
+ function assign$1(style, stateStyle) {
17961
17969
  Object.assign(style, stateStyle);
17962
17970
  return true;
17963
17971
  }
@@ -18694,6 +18702,248 @@ var LeaferUI = function(exports) {
18694
18702
  });
18695
18703
  Plugin.add("bright");
18696
18704
  exports.UI.addAttr("bright", false, dimType);
18705
+ const config = {
18706
+ theme: "light",
18707
+ style: {
18708
+ dragBoundsType: "outer",
18709
+ strokeAlign: "center",
18710
+ strokeWidthFixed: "zoom-in",
18711
+ width: 6,
18712
+ height: 6,
18713
+ opacity: .5,
18714
+ cornerRadius: 3,
18715
+ hoverStyle: {
18716
+ opacity: .6
18717
+ },
18718
+ pressStyle: {
18719
+ opacity: .66
18720
+ }
18721
+ },
18722
+ size: 6,
18723
+ endsMargin: 2,
18724
+ sideMargin: 2,
18725
+ minSize: 10,
18726
+ scaleFixed: "zoom-in",
18727
+ scrollType: "both",
18728
+ hideOnActionEnd: "hover"
18729
+ };
18730
+ const tempBounds = new Bounds, {float: float} = MathHelper, {clone: clone, assign: assign} = DataHelper;
18731
+ class Scroller extends exports.Group {
18732
+ get canUse() {
18733
+ return this.target.hasScroller;
18734
+ }
18735
+ constructor(target) {
18736
+ super();
18737
+ this.targetWorldBounds = new Bounds;
18738
+ this.viewportBounds = new Bounds;
18739
+ this.contentBounds = new Bounds;
18740
+ this.scrollXBounds = new Bounds;
18741
+ this.scrollYBounds = new Bounds;
18742
+ this.target = target;
18743
+ this.config = clone(config);
18744
+ this.updateConfig();
18745
+ this.__listenEvents();
18746
+ target.waitLeafer(() => {
18747
+ this.parent = target;
18748
+ this.__bindLeafer(target.leafer);
18749
+ });
18750
+ if (this.mergedConfig.hideOnActionEnd) this.opacity = 0;
18751
+ }
18752
+ static registerTheme(theme, themeConfig) {
18753
+ S.themeMap[theme] = themeConfig;
18754
+ }
18755
+ static getTheme(theme) {
18756
+ return theme && S.themeMap[theme];
18757
+ }
18758
+ static hasTheme(theme) {
18759
+ return theme && !!S.themeMap[theme];
18760
+ }
18761
+ updateConfig() {
18762
+ const {scrollConfig: scrollConfig} = this.target;
18763
+ const themeConfig = S.getTheme(scrollConfig && S.hasTheme(scrollConfig.theme) && scrollConfig.theme || this.config.theme);
18764
+ const mergedConfig = this.mergedConfig = clone(this.config);
18765
+ assign(mergedConfig, themeConfig);
18766
+ if (scrollConfig) assign(mergedConfig, scrollConfig);
18767
+ this.updateStyle(mergedConfig.style);
18768
+ }
18769
+ updateStyle(style) {
18770
+ if (!this.scrollXBar) this.addMany(this.scrollXBar = new exports.Box, this.scrollYBar = new exports.Box);
18771
+ const {scrollXBar: scrollXBar, scrollYBar: scrollYBar} = this;
18772
+ scrollXBar.set(style);
18773
+ scrollYBar.set(style);
18774
+ scrollXBar.draggable = "x";
18775
+ scrollYBar.draggable = "y";
18776
+ }
18777
+ update(check = true) {
18778
+ if (this.dragScrolling) return;
18779
+ const {target: target, targetOverflow: targetOverflow, targetWorldBounds: targetWorldBounds, viewportBounds: viewportBounds, contentBounds: contentBounds} = this, layout = target.__layout, {overflow: overflow} = target.__;
18780
+ const {childrenRenderBounds: childrenRenderBounds} = layout;
18781
+ const {boxBounds: boxBounds, worldBoxBounds: worldBoxBounds} = layout;
18782
+ const isSameWorldBounds = check && targetOverflow === overflow && targetWorldBounds.isSame(worldBoxBounds);
18783
+ const isSameConfig = layout.scrollConfigChanged ? (this.updateConfig(), layout.scrollConfigChanged = false) : true;
18784
+ const nowContentBounds = tempBounds.set(viewportBounds).add(childrenRenderBounds);
18785
+ if (isSameWorldBounds && isSameConfig && contentBounds.isSame(nowContentBounds)) return;
18786
+ this.targetOverflow = overflow;
18787
+ viewportBounds.set(boxBounds);
18788
+ targetWorldBounds.set(worldBoxBounds);
18789
+ contentBounds.set(nowContentBounds);
18790
+ const {scrollXBar: scrollXBar, scrollYBar: scrollYBar} = this, {size: size, endsMargin: endsMargin, minSize: minSize} = this.mergedConfig, {width: width, height: height} = viewportBounds;
18791
+ this.contentRealX = contentBounds.x - target.scrollX;
18792
+ this.contentRealY = contentBounds.y - target.scrollY;
18793
+ this.ratioX = viewportBounds.width / contentBounds.width;
18794
+ this.ratioY = viewportBounds.height / contentBounds.height;
18795
+ const min = size + endsMargin * 2 + minSize;
18796
+ scrollXBar.visible = float(contentBounds.width) > float(width) && overflow !== "y-scroll" && width > min;
18797
+ scrollYBar.visible = float(contentBounds.height) > float(height) && overflow !== "x-scroll" && height > min;
18798
+ this.updateScrollBar();
18799
+ }
18800
+ updateScrollBar() {
18801
+ const {target: target, viewportBounds: viewportBounds, contentBounds: contentBounds, ratioX: ratioX, ratioY: ratioY, scrollXBar: scrollXBar, scrollYBar: scrollYBar, scrollXBounds: scrollXBounds, scrollYBounds: scrollYBounds} = this;
18802
+ let {size: size, cornerRadius: cornerRadius, endsMargin: endsMargin, sideMargin: sideMargin, minSize: minSize, scaleFixed: scaleFixed, scrollType: scrollType} = this.mergedConfig;
18803
+ const scale = scaleFixed ? target.getClampRenderScale() : 1;
18804
+ endsMargin /= scale;
18805
+ sideMargin /= scale;
18806
+ size /= scale;
18807
+ if (isUndefined(cornerRadius)) cornerRadius = size / 2;
18808
+ if (scrollXBar.visible) {
18809
+ scrollXBounds.set(viewportBounds).shrink([ endsMargin, scrollYBar.visible ? size + sideMargin : endsMargin, sideMargin, endsMargin ]);
18810
+ const scrollRatioX = this.scrollRatioX = scrollXBounds.width / contentBounds.width;
18811
+ scrollXBar.set({
18812
+ x: scrollXBounds.x - contentBounds.x * scrollRatioX,
18813
+ y: scrollXBounds.maxY - size,
18814
+ width: Math.max(scrollXBounds.width * ratioX, minSize),
18815
+ height: size,
18816
+ cornerRadius: cornerRadius,
18817
+ dragBounds: scrollXBounds,
18818
+ hittable: scrollType !== "move"
18819
+ });
18820
+ }
18821
+ if (scrollYBar.visible) {
18822
+ scrollYBounds.set(viewportBounds).shrink([ endsMargin, sideMargin, scrollXBar.visible ? size + sideMargin : endsMargin, endsMargin ]);
18823
+ const scrollRatioY = this.scrollRatioY = scrollYBounds.height / contentBounds.height;
18824
+ scrollYBar.set({
18825
+ x: scrollYBounds.maxX - size,
18826
+ y: scrollYBounds.y - contentBounds.y * scrollRatioY,
18827
+ width: size,
18828
+ height: Math.max(scrollYBounds.height * ratioY, minSize),
18829
+ cornerRadius: cornerRadius,
18830
+ dragBounds: scrollYBounds,
18831
+ hittable: scrollType !== "move"
18832
+ });
18833
+ }
18834
+ this.x = -this.target.scrollX;
18835
+ this.y = -this.target.scrollY;
18836
+ LeafHelper.updateAllMatrix(this);
18837
+ BranchHelper.updateBounds(this);
18838
+ LeafHelper.updateAllChange(this);
18839
+ }
18840
+ onDrag(e) {
18841
+ if (this.mergedConfig.scrollType === "move") return;
18842
+ this.dragScrolling = true;
18843
+ const {scrollXBar: scrollXBar, scrollYBar: scrollYBar, target: target, scrollXBounds: scrollXBounds, scrollYBounds: scrollYBounds} = this;
18844
+ const scrollX = e.current === scrollXBar;
18845
+ if (scrollX) target.scrollX = -((scrollXBar.x - scrollXBounds.x) / this.scrollRatioX + this.contentRealX); else target.scrollY = -((scrollYBar.y - scrollYBounds.y) / this.scrollRatioY + this.contentRealY);
18846
+ }
18847
+ onDragEnd() {
18848
+ if (this.mergedConfig.scrollType === "move") return;
18849
+ this.dragScrolling = false;
18850
+ }
18851
+ onMove(e) {
18852
+ if (!this.canUse) return;
18853
+ this.onEnter();
18854
+ const {scrollType: scrollType, stopDefault: stopDefault} = this.mergedConfig;
18855
+ if (scrollType === "drag") return;
18856
+ const {viewportBounds: viewportBounds, contentBounds: contentBounds, scrollXBar: scrollXBar, scrollYBar: scrollYBar} = this;
18857
+ if (scrollXBar.visible || scrollYBar.visible) {
18858
+ const move = e.getInnerMove(this.target);
18859
+ DragBoundsHelper.getValidMove(contentBounds, viewportBounds, "inner", move, true);
18860
+ let needStop;
18861
+ if (move.x && scrollXBar.visible) this.target.scrollX += move.x, needStop = true;
18862
+ if (move.y && scrollYBar.visible) this.target.scrollY += move.y, needStop = true;
18863
+ if (needStop || stopDefault) e.stop();
18864
+ if (stopDefault) e.stopDefault();
18865
+ }
18866
+ }
18867
+ onMoveEnd(e) {
18868
+ if (!this.canUse) return;
18869
+ if (!this.target.hit(e)) this.onLeave();
18870
+ }
18871
+ onEnter() {
18872
+ if (!this.canUse) return;
18873
+ clearTimeout(this.hideTimer);
18874
+ this.killAnimate();
18875
+ this.opacity = 1;
18876
+ }
18877
+ onLeave() {
18878
+ if (!this.canUse) return;
18879
+ clearTimeout(this.hideTimer);
18880
+ if (this.mergedConfig.hideOnActionEnd) this.hideTimer = setTimeout(() => {
18881
+ this.set({
18882
+ opacity: 0
18883
+ }, Plugin.has("animate"));
18884
+ }, 600);
18885
+ }
18886
+ onResize() {
18887
+ if (this.canUse) this.update();
18888
+ }
18889
+ __listenEvents() {
18890
+ const {scrollXBar: scrollXBar, scrollYBar: scrollYBar, target: target} = this;
18891
+ this.__eventIds = [ scrollXBar.on_(exports.DragEvent.DRAG, this.onDrag, this), scrollXBar.on_(exports.DragEvent.END, this.onDragEnd, this), scrollYBar.on_(exports.DragEvent.DRAG, this.onDrag, this), scrollYBar.on_(exports.DragEvent.END, this.onDragEnd, this), target.on_(exports.PointerEvent.ENTER, this.onEnter, this), target.on_(exports.PointerEvent.LEAVE, this.onLeave, this), target.on_(exports.MoveEvent.BEFORE_MOVE, this.onMove, this), target.on_(exports.MoveEvent.END, this.onMoveEnd, this), target.on_(BoundsEvent.WORLD, this.onResize, this), target.on_(ChildEvent.DESTROY, this.destroy, this) ];
18892
+ }
18893
+ __removeListenEvents() {
18894
+ this.off_(this.__eventIds);
18895
+ }
18896
+ destroy() {
18897
+ if (!this.destroyed) {
18898
+ this.__removeListenEvents();
18899
+ const {target: target} = this;
18900
+ target.scroller = target.topChildren = target.hasScroller = undefined;
18901
+ this.target = this.config = null;
18902
+ super.destroy();
18903
+ }
18904
+ }
18905
+ }
18906
+ Scroller.themeMap = {};
18907
+ const S = Scroller;
18908
+ function scrollConfigType(defaultValue) {
18909
+ return decorateLeafAttr(defaultValue, key => attr({
18910
+ set(value) {
18911
+ if (this.__setAttr(key, value)) {
18912
+ const layout = this.__layout;
18913
+ layout.scrollConfigChanged = true;
18914
+ doBoundsType(this);
18915
+ }
18916
+ }
18917
+ }));
18918
+ }
18919
+ Plugin.add("scroller");
18920
+ const box = exports.Box.prototype;
18921
+ exports.Box.addAttr("scrollConfig", undefined, scrollConfigType);
18922
+ box.__checkScroll = function(isScrollMode) {
18923
+ if (isScrollMode && this.isOverflow) {
18924
+ if (!this.scroller) {
18925
+ this.scroller = new Scroller(this);
18926
+ if (!this.topChildren) this.topChildren = [];
18927
+ this.topChildren.push(this.scroller);
18928
+ }
18929
+ this.hasScroller = true;
18930
+ } else {
18931
+ if (this.hasScroller && !this.scroller.dragScrolling) {
18932
+ this.hasScroller = undefined;
18933
+ this.scroller.update();
18934
+ }
18935
+ }
18936
+ };
18937
+ Scroller.registerTheme("light", {
18938
+ style: {
18939
+ fill: "black"
18940
+ }
18941
+ });
18942
+ Scroller.registerTheme("dark", {
18943
+ style: {
18944
+ fill: "white"
18945
+ }
18946
+ });
18697
18947
  exports.AlignHelper = AlignHelper;
18698
18948
  exports.AnimateEasing = AnimateEasing;
18699
18949
  exports.AnimateEvent = AnimateEvent;
@@ -18826,6 +19076,7 @@ var LeaferUI = function(exports) {
18826
19076
  exports.RobotData = RobotData;
18827
19077
  exports.Run = Run;
18828
19078
  exports.ScrollBar = ScrollBar;
19079
+ exports.Scroller = Scroller;
18829
19080
  exports.SelectArea = SelectArea;
18830
19081
  exports.Selector = Selector;
18831
19082
  exports.StarData = StarData;
@@ -18922,7 +19173,7 @@ var LeaferUI = function(exports) {
18922
19173
  exports.stateType = stateType;
18923
19174
  exports.strokeType = strokeType;
18924
19175
  exports.surfaceType = surfaceType;
18925
- exports.tempBounds = tempBounds$2;
19176
+ exports.tempBounds = tempBounds$3;
18926
19177
  exports.tempMatrix = tempMatrix$2;
18927
19178
  exports.tempPoint = tempPoint$4;
18928
19179
  exports.tryToNumber = tryToNumber;