@leafer/miniapp 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.
@@ -58,8 +58,8 @@ function isEmptyData(value) {
58
58
 
59
59
  const DataHelper = {
60
60
  default(t, defaultData) {
61
- assign$1(defaultData, t);
62
- assign$1(t, defaultData);
61
+ assign$2(defaultData, t);
62
+ assign$2(t, defaultData);
63
63
  return t;
64
64
  },
65
65
  assign(t, merge, exclude) {
@@ -67,9 +67,9 @@ const DataHelper = {
67
67
  Object.keys(merge).forEach(key => {
68
68
  var _a, _b;
69
69
  value = merge[key];
70
- 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]);
70
+ 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]);
71
71
  if (exclude && key in exclude) {
72
- if (((_b = exclude[key]) === null || _b === void 0 ? void 0 : _b.constructor) === Object) assign$1(t[key] = {}, merge[key], exclude[key]);
72
+ if (((_b = exclude[key]) === null || _b === void 0 ? void 0 : _b.constructor) === Object) assign$2(t[key] = {}, merge[key], exclude[key]);
73
73
  return;
74
74
  }
75
75
  t[key] = merge[key];
@@ -95,7 +95,7 @@ const DataHelper = {
95
95
  }
96
96
  };
97
97
 
98
- const {assign: assign$1} = DataHelper;
98
+ const {assign: assign$2} = DataHelper;
99
99
 
100
100
  class LeafData {
101
101
  get __useNaturalRatio() {
@@ -410,7 +410,7 @@ function getMatrixData() {
410
410
 
411
411
  const {sin: sin$6, cos: cos$6, acos: acos, sqrt: sqrt$5} = Math;
412
412
 
413
- const {float: float$5} = MathHelper;
413
+ const {float: float$6} = MathHelper;
414
414
 
415
415
  const tempPoint$5 = {};
416
416
 
@@ -661,12 +661,12 @@ const MatrixHelper = {
661
661
  const cosR = c / scaleY;
662
662
  rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
663
663
  }
664
- const cosR = float$5(cos$6(rotation));
664
+ const cosR = float$6(cos$6(rotation));
665
665
  const sinR = sin$6(rotation);
666
- scaleX = float$5(scaleX), scaleY = float$5(scaleY);
667
- skewX = cosR ? float$5((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
668
- skewY = cosR ? float$5((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
669
- rotation = float$5(rotation / OneRadian);
666
+ scaleX = float$6(scaleX), scaleY = float$6(scaleY);
667
+ skewX = cosR ? float$6((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
668
+ skewY = cosR ? float$6((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
669
+ rotation = float$6(rotation / OneRadian);
670
670
  } else {
671
671
  scaleX = a;
672
672
  scaleY = d;
@@ -710,7 +710,7 @@ const MatrixHelper = {
710
710
 
711
711
  const M$b = MatrixHelper;
712
712
 
713
- const {float: float$4} = MathHelper;
713
+ const {float: float$5} = MathHelper;
714
714
 
715
715
  const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
716
716
 
@@ -851,7 +851,7 @@ const PointHelper = {
851
851
  return points;
852
852
  },
853
853
  isSame(t, point) {
854
- return float$4(t.x) === float$4(point.x) && float$4(t.y) === float$4(point.y);
854
+ return float$5(t.x) === float$5(point.x) && float$5(t.y) === float$5(point.y);
855
855
  },
856
856
  reset(t) {
857
857
  P$7.reset(t);
@@ -1206,7 +1206,7 @@ const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$5, addPoint: addPo
1206
1206
 
1207
1207
  const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
1208
1208
 
1209
- const {float: float$3, fourNumber: fourNumber$1} = MathHelper;
1209
+ const {float: float$4, fourNumber: fourNumber$1} = MathHelper;
1210
1210
 
1211
1211
  const {floor: floor$2, ceil: ceil$2} = Math;
1212
1212
 
@@ -1216,10 +1216,10 @@ const point$2 = {};
1216
1216
 
1217
1217
  const toPoint$5 = {};
1218
1218
 
1219
- const tempBounds$3 = {};
1219
+ const tempBounds$4 = {};
1220
1220
 
1221
1221
  const BoundsHelper = {
1222
- tempBounds: tempBounds$3,
1222
+ tempBounds: tempBounds$4,
1223
1223
  set(t, x = 0, y = 0, width = 0, height = 0) {
1224
1224
  t.x = x;
1225
1225
  t.y = y;
@@ -1288,9 +1288,9 @@ const BoundsHelper = {
1288
1288
  t.height *= scaleY;
1289
1289
  },
1290
1290
  tempToOuterOf(t, matrix) {
1291
- B.copy(tempBounds$3, t);
1292
- B.toOuterOf(tempBounds$3, matrix);
1293
- return tempBounds$3;
1291
+ B.copy(tempBounds$4, t);
1292
+ B.toOuterOf(tempBounds$4, matrix);
1293
+ return tempBounds$4;
1294
1294
  },
1295
1295
  getOuterOf(t, matrix) {
1296
1296
  t = Object.assign({}, t);
@@ -1348,9 +1348,9 @@ const BoundsHelper = {
1348
1348
  put(t, put, align = "center", putScale = 1, changeSize = true, to) {
1349
1349
  to || (to = put);
1350
1350
  if (isString(putScale)) putScale = B.getFitScale(t, put, putScale === "cover");
1351
- tempBounds$3.width = changeSize ? put.width *= putScale : put.width * putScale;
1352
- tempBounds$3.height = changeSize ? put.height *= putScale : put.height * putScale;
1353
- AlignHelper.toPoint(align, tempBounds$3, t, to, true, true);
1351
+ tempBounds$4.width = changeSize ? put.width *= putScale : put.width * putScale;
1352
+ tempBounds$4.height = changeSize ? put.height *= putScale : put.height * putScale;
1353
+ AlignHelper.toPoint(align, tempBounds$4, t, to, true, true);
1354
1354
  },
1355
1355
  getSpread(t, spread, side) {
1356
1356
  const n = {};
@@ -1381,10 +1381,10 @@ const BoundsHelper = {
1381
1381
  }
1382
1382
  },
1383
1383
  float(t, maxLength) {
1384
- t.x = float$3(t.x, maxLength);
1385
- t.y = float$3(t.y, maxLength);
1386
- t.width = float$3(t.width, maxLength);
1387
- t.height = float$3(t.height, maxLength);
1384
+ t.x = float$4(t.x, maxLength);
1385
+ t.y = float$4(t.y, maxLength);
1386
+ t.width = float$4(t.width, maxLength);
1387
+ t.height = float$4(t.height, maxLength);
1388
1388
  },
1389
1389
  add(t, bounds, isPoint) {
1390
1390
  right$4 = t.x + t.width;
@@ -1653,7 +1653,7 @@ class Bounds {
1653
1653
  }
1654
1654
  }
1655
1655
 
1656
- const tempBounds$2 = new Bounds;
1656
+ const tempBounds$3 = new Bounds;
1657
1657
 
1658
1658
  class AutoBounds {
1659
1659
  constructor(top, right, bottom, left, width, height) {
@@ -1727,7 +1727,7 @@ const Platform = {
1727
1727
  resize(view, width, height, xGap, yGap, clip, smooth, opacity, _filters, interlace) {
1728
1728
  const realWidth = max$5(floor$1(width + (xGap || 0)), 1), realHeight = max$5(floor$1(height + (yGap || 0)), 1);
1729
1729
  let interlaceX, interlaceY, interlaceOffset;
1730
- if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset, (interlaceX = interlace.type === "x") ? width : height))) interlaceX || (interlaceY = true);
1730
+ if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset, interlace.type === "x" ? width : height))) interlace.type === "x" ? interlaceX = true : interlaceY = true;
1731
1731
  const canvas = Platform.origin.createCanvas(interlaceY ? realWidth * 2 : realWidth, interlaceX ? realHeight * 2 : realHeight);
1732
1732
  const ctx = canvas.getContext("2d");
1733
1733
  if (opacity) ctx.globalAlpha = opacity;
@@ -2931,7 +2931,7 @@ const PathCommandNodeHelper = {
2931
2931
  }
2932
2932
  };
2933
2933
 
2934
- 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;
2934
+ 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;
2935
2935
 
2936
2936
  const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
2937
2937
 
@@ -3064,10 +3064,10 @@ const PathConvert = {
3064
3064
  old[i + 2] += y;
3065
3065
  old[i + 3] += x;
3066
3066
  old[i + 4] += y;
3067
- command = S;
3067
+ command = S$1;
3068
3068
 
3069
- case S:
3070
- smooth = lastCommand === C$7 || lastCommand === S;
3069
+ case S$1:
3070
+ smooth = lastCommand === C$7 || lastCommand === S$1;
3071
3071
  x1 = smooth ? x * 2 - controlX : old[i + 1];
3072
3072
  y1 = smooth ? y * 2 - controlY : old[i + 2];
3073
3073
  controlX = old[i + 1];
@@ -3317,10 +3317,10 @@ const PathCommandDataHelper = {
3317
3317
  data.push(O$5, x, y, radius, startAngle, endAngle, anticlockwise ? 1 : 0);
3318
3318
  }
3319
3319
  },
3320
- arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
3320
+ arcTo(data, x1, y1, x2, y2, radius, lastX, lastY, fullRadius) {
3321
3321
  if (!isUndefined(lastX)) {
3322
- const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
3323
- radius = min$2(radius, min$2(d / 2, d / 2 * abs$8(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3322
+ const r = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / (fullRadius ? 1 : 2);
3323
+ radius = min$2(radius, min$2(r, r * abs$8(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3324
3324
  }
3325
3325
  data.push(U$4, x1, y1, x2, y2, radius);
3326
3326
  },
@@ -3664,7 +3664,7 @@ const PathCorner = {
3664
3664
  let command, lastCommand, commandLen;
3665
3665
  let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
3666
3666
  if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
3667
- const len = data.length;
3667
+ const len = data.length, three = len === 9;
3668
3668
  const smooth = [];
3669
3669
  while (i < len) {
3670
3670
  command = data[i];
@@ -3676,7 +3676,7 @@ const PathCorner = {
3676
3676
  if (data[i] === L$5) {
3677
3677
  secondX = data[i + 1];
3678
3678
  secondY = data[i + 2];
3679
- smooth.push(M$5, getCenterX(startX, secondX), getCenterY(startY, secondY));
3679
+ three ? smooth.push(M$5, startX, startY) : smooth.push(M$5, getCenterX(startX, secondX), getCenterY(startY, secondY));
3680
3680
  } else {
3681
3681
  smooth.push(M$5, startX, startY);
3682
3682
  }
@@ -3688,11 +3688,11 @@ const PathCorner = {
3688
3688
  i += 3;
3689
3689
  switch (data[i]) {
3690
3690
  case L$5:
3691
- arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY);
3691
+ arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY, three);
3692
3692
  break;
3693
3693
 
3694
3694
  case Z$3:
3695
- arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY);
3695
+ arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY, three);
3696
3696
  break;
3697
3697
 
3698
3698
  default:
@@ -3704,7 +3704,7 @@ const PathCorner = {
3704
3704
 
3705
3705
  case Z$3:
3706
3706
  if (lastCommand !== Z$3) {
3707
- arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY);
3707
+ arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY, three);
3708
3708
  smooth.push(Z$3);
3709
3709
  }
3710
3710
  i += 1;
@@ -6979,7 +6979,7 @@ class LeafLevelList {
6979
6979
  }
6980
6980
  }
6981
6981
 
6982
- const version = "2.0.0";
6982
+ const version = "2.0.1";
6983
6983
 
6984
6984
  class LeaferCanvas extends LeaferCanvasBase {
6985
6985
  get allowBackgroundColor() {
@@ -8146,16 +8146,16 @@ class UIData extends LeafData {
8146
8146
  return t.fill || t.stroke;
8147
8147
  }
8148
8148
  get __autoWidth() {
8149
- return !this._width;
8149
+ return this._width == null;
8150
8150
  }
8151
8151
  get __autoHeight() {
8152
- return !this._height;
8152
+ return this._height == null;
8153
8153
  }
8154
8154
  get __autoSide() {
8155
- return !this._width || !this._height;
8155
+ return this._width == null || this._height == null;
8156
8156
  }
8157
8157
  get __autoSize() {
8158
- return !this._width && !this._height;
8158
+ return this._width == null && this._height == null;
8159
8159
  }
8160
8160
  setVisible(value) {
8161
8161
  this._visible = value;
@@ -10111,7 +10111,7 @@ class UIEvent extends Event {
10111
10111
  }
10112
10112
  }
10113
10113
 
10114
- 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;
10114
+ 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;
10115
10115
 
10116
10116
  const tempContent = new Bounds, tempDragBounds = new Bounds;
10117
10117
 
@@ -10151,8 +10151,8 @@ const DragBoundsHelper = {
10151
10151
  } else {
10152
10152
  if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
10153
10153
  }
10154
- move.x = float$2(move.x);
10155
- move.y = float$2(move.y);
10154
+ move.x = float$3(move.x);
10155
+ move.y = float$3(move.y);
10156
10156
  return move;
10157
10157
  },
10158
10158
  getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, lockRatio, change) {
@@ -10164,26 +10164,26 @@ const DragBoundsHelper = {
10164
10164
  let correctScaleX = 1, correctScaleY = 1, aScale, bScale, aSize, bSize;
10165
10165
  if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
10166
10166
  if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
10167
- aSize = float$2(tempContent.minX - tempDragBounds.minX);
10168
- bSize = float$2(tempDragBounds.maxX - tempContent.maxX);
10167
+ aSize = float$3(tempContent.minX - tempDragBounds.minX);
10168
+ bSize = float$3(tempDragBounds.maxX - tempContent.maxX);
10169
10169
  aScale = originLeftScale && aSize > 0 ? 1 + aSize / (originLeftScale * tempContent.width) : 1;
10170
10170
  bScale = originRightScale && bSize > 0 ? 1 + bSize / (originRightScale * tempContent.width) : 1;
10171
10171
  correctScaleX *= max$3(aScale, bScale);
10172
10172
  } else {
10173
10173
  if (scale.x < 0) {
10174
- if (float$2(minX(content) - minX(dragBounds)) <= 0 || float$2(maxX(dragBounds) - maxX(content)) <= 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
10174
+ if (float$3(minX(content) - minX(dragBounds)) <= 0 || float$3(maxX(dragBounds) - maxX(content)) <= 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
10175
10175
  tempContent.unsign();
10176
10176
  }
10177
- aSize = float$2(tempDragBounds.minX - tempContent.minX);
10178
- bSize = float$2(tempContent.maxX - tempDragBounds.maxX);
10177
+ aSize = float$3(tempDragBounds.minX - tempContent.minX);
10178
+ bSize = float$3(tempContent.maxX - tempDragBounds.maxX);
10179
10179
  aScale = originLeftScale && aSize > 0 ? 1 - aSize / (originLeftScale * tempContent.width) : 1;
10180
10180
  bScale = originRightScale && bSize > 0 ? 1 - bSize / (originRightScale * tempContent.width) : 1;
10181
10181
  correctScaleX *= min$1(aScale, bScale);
10182
10182
  }
10183
10183
  if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
10184
10184
  if (scale.y < 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
10185
- aSize = float$2(tempContent.minY - tempDragBounds.minY);
10186
- bSize = float$2(tempDragBounds.maxY - tempContent.maxY);
10185
+ aSize = float$3(tempContent.minY - tempDragBounds.minY);
10186
+ bSize = float$3(tempDragBounds.maxY - tempContent.maxY);
10187
10187
  aScale = originTopScale && aSize > 0 ? 1 + aSize / (originTopScale * tempContent.height) : 1;
10188
10188
  bScale = originBottomScale && bSize > 0 ? 1 + bSize / (originBottomScale * tempContent.height) : 1;
10189
10189
  correctScaleY *= max$3(aScale, bScale);
@@ -10194,11 +10194,11 @@ const DragBoundsHelper = {
10194
10194
  }
10195
10195
  } else {
10196
10196
  if (scale.y < 0) {
10197
- if (float$2(minY(content) - minY(dragBounds)) <= 0 || float$2(maxY(dragBounds) - maxY(content)) <= 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
10197
+ if (float$3(minY(content) - minY(dragBounds)) <= 0 || float$3(maxY(dragBounds) - maxY(content)) <= 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
10198
10198
  tempContent.unsign();
10199
10199
  }
10200
- aSize = float$2(tempDragBounds.minY - tempContent.minY);
10201
- bSize = float$2(tempContent.maxY - tempDragBounds.maxY);
10200
+ aSize = float$3(tempDragBounds.minY - tempContent.minY);
10201
+ bSize = float$3(tempContent.maxY - tempDragBounds.maxY);
10202
10202
  aScale = originTopScale && aSize > 0 ? 1 - aSize / (originTopScale * tempContent.height) : 1;
10203
10203
  bScale = originBottomScale && bSize > 0 ? 1 - bSize / (originBottomScale * tempContent.height) : 1;
10204
10204
  correctScaleY *= min$1(aScale, bScale);
@@ -10719,7 +10719,7 @@ function exclude(leaf, excludePath) {
10719
10719
  return excludePath && excludePath.has(leaf);
10720
10720
  }
10721
10721
 
10722
- const config$1 = {
10722
+ const config$2 = {
10723
10723
  wheel: {
10724
10724
  zoomSpeed: .5,
10725
10725
  moveSpeed: .5,
@@ -10793,7 +10793,7 @@ class InteractionBase {
10793
10793
  return this.p.hitRadius;
10794
10794
  }
10795
10795
  constructor(target, canvas, selector, userConfig) {
10796
- this.config = DataHelper.clone(config$1);
10796
+ this.config = DataHelper.clone(config$2);
10797
10797
  this.tapCount = 0;
10798
10798
  this.downKeyMap = {};
10799
10799
  this.target = target;
@@ -11313,8 +11313,8 @@ ui$5.__updateHitCanvas = function() {
11313
11313
  if (isHitPixel) {
11314
11314
  const {renderBounds: renderBounds} = this.__layout;
11315
11315
  const size = Platform.image.hitCanvasSize;
11316
- const scale = h.hitScale = tempBounds$2.set(0, 0, size, size).getFitMatrix(renderBounds).a;
11317
- const {x: x, y: y, width: width, height: height} = tempBounds$2.set(renderBounds).scale(scale);
11316
+ const scale = h.hitScale = tempBounds$3.set(0, 0, size, size).getFitMatrix(renderBounds).a;
11317
+ const {x: x, y: y, width: width, height: height} = tempBounds$3.set(renderBounds).scale(scale);
11318
11318
  h.resize({
11319
11319
  width: width,
11320
11320
  height: height,
@@ -11374,13 +11374,13 @@ ui$5.__hit = function(inner, forceHitFill) {
11374
11374
  return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
11375
11375
  };
11376
11376
 
11377
- const ui$4 = UI.prototype, rect = Rect.prototype, box$2 = Box.prototype;
11377
+ const ui$4 = UI.prototype, rect = Rect.prototype, box$3 = Box.prototype;
11378
11378
 
11379
- rect.__updateHitCanvas = box$2.__updateHitCanvas = function() {
11379
+ rect.__updateHitCanvas = box$3.__updateHitCanvas = function() {
11380
11380
  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;
11381
11381
  };
11382
11382
 
11383
- rect.__hitFill = box$2.__hitFill = function(inner) {
11383
+ rect.__hitFill = box$3.__hitFill = function(inner) {
11384
11384
  return this.__hitCanvas ? ui$4.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
11385
11385
  };
11386
11386
 
@@ -11412,8 +11412,8 @@ canvas$1.hitStroke = function(point, strokeWidth) {
11412
11412
  canvas$1.hitPixel = function(radiusPoint, offset, scale = 1) {
11413
11413
  let {x: x, y: y, radiusX: radiusX, radiusY: radiusY} = radiusPoint;
11414
11414
  if (offset) x -= offset.x, y -= offset.y;
11415
- tempBounds$2.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
11416
- const {data: data} = this.context.getImageData(tempBounds$2.x, tempBounds$2.y, tempBounds$2.width || 1, tempBounds$2.height || 1);
11415
+ tempBounds$3.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
11416
+ const {data: data} = this.context.getImageData(tempBounds$3.x, tempBounds$3.y, tempBounds$3.width || 1, tempBounds$3.height || 1);
11417
11417
  for (let i = 0, len = data.length; i < len; i += 4) {
11418
11418
  if (data[i + 3] > 0) return true;
11419
11419
  }
@@ -11728,14 +11728,14 @@ function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas, renderO
11728
11728
 
11729
11729
  const {getSpread: getSpread, copyAndSpread: copyAndSpread$1, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$7, getIntersectData: getIntersectData} = BoundsHelper;
11730
11730
 
11731
- const tempBounds$1 = {};
11731
+ const tempBounds$2 = {};
11732
11732
 
11733
11733
  function shape(ui, current, options) {
11734
11734
  const canvas = current.getSameCanvas();
11735
11735
  const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
11736
11736
  const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
11737
- toOuterOf(layout.strokeSpread ? (copyAndSpread$1(tempBounds$1, layout.boxBounds, layout.strokeSpread),
11738
- tempBounds$1) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
11737
+ toOuterOf(layout.strokeSpread ? (copyAndSpread$1(tempBounds$2, layout.boxBounds, layout.strokeSpread),
11738
+ tempBounds$2) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
11739
11739
  let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
11740
11740
  let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
11741
11741
  if (currentBounds.includes(nowWorldShapeBounds)) {
@@ -11887,7 +11887,7 @@ const PaintModule = {
11887
11887
  shape: shape
11888
11888
  };
11889
11889
 
11890
- let cache$1, box$1 = new Bounds;
11890
+ let cache$1, box$2 = new Bounds;
11891
11891
 
11892
11892
  const {isSame: isSame} = BoundsHelper;
11893
11893
 
@@ -11905,7 +11905,7 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
11905
11905
  cache$1 = image.use > 1 ? {
11906
11906
  leafPaint: leafPaint,
11907
11907
  paint: paint,
11908
- boxBounds: box$1.set(boxBounds)
11908
+ boxBounds: box$2.set(boxBounds)
11909
11909
  } : null;
11910
11910
  }
11911
11911
  if (firstUse || image.loading) event = {
@@ -12441,7 +12441,7 @@ const PaintGradientModule = {
12441
12441
 
12442
12442
  const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$2, abs: abs$5} = Math;
12443
12443
 
12444
- const tempBounds = {}, tempMatrix = new Matrix;
12444
+ const tempBounds$1 = {}, tempMatrix = new Matrix;
12445
12445
 
12446
12446
  const offsetOutBounds$1 = {};
12447
12447
 
@@ -12508,9 +12508,9 @@ function drawWorldShadow(canvas, outBounds, shape) {
12508
12508
  const {shapeBounds: shapeBounds} = shape;
12509
12509
  let from, to;
12510
12510
  if (Platform.fullImageShadow) {
12511
- copy$3(tempBounds, canvas.bounds);
12512
- move$6(tempBounds, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
12513
- from = canvas.bounds, to = tempBounds;
12511
+ copy$3(tempBounds$1, canvas.bounds);
12512
+ move$6(tempBounds$1, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
12513
+ from = canvas.bounds, to = tempBounds$1;
12514
12514
  } else {
12515
12515
  from = shapeBounds, to = outBounds;
12516
12516
  }
@@ -12993,7 +12993,7 @@ function layoutText(drawData, style) {
12993
12993
  let {x: x, y: y, width: width, height: height} = bounds, realHeight = __lineHeight * countRows + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
12994
12994
  let starY = __baseLine;
12995
12995
  if (__clipText && realHeight > height) {
12996
- realHeight = Math.max(height, __lineHeight);
12996
+ realHeight = Math.max(style.__autoHeight ? realHeight : height, __lineHeight);
12997
12997
  if (countRows > 1) drawData.overflow = countRows;
12998
12998
  } else if (height || autoSizeAlign) {
12999
12999
  switch (verticalAlign) {
@@ -13050,10 +13050,10 @@ function layoutText(drawData, style) {
13050
13050
  }
13051
13051
 
13052
13052
  function clipText(drawData, style, x, width) {
13053
- if (!width) return;
13054
13053
  const {rows: rows, overflow: overflow} = drawData;
13055
13054
  let {textOverflow: textOverflow} = style;
13056
- rows.splice(overflow);
13055
+ if (overflow) rows.splice(overflow);
13056
+ if (!width) return;
13057
13057
  if (textOverflow && textOverflow !== "show") {
13058
13058
  if (textOverflow === "hide") textOverflow = ""; else if (textOverflow === "ellipsis") textOverflow = "...";
13059
13059
  let char, charRight;
@@ -13378,8 +13378,13 @@ class Stroker extends UI {
13378
13378
  if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
13379
13379
  }
13380
13380
  data.strokeWidth = strokeWidth / Math.max(aScaleX, aScaleY);
13381
+ if (data.shadow) {
13382
+ const shadow = data.shadow[0], {scaleX: scaleX, scaleY: scaleY} = this.getRenderScaleData(true, shadow.scaleFixed);
13383
+ canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
13384
+ }
13381
13385
  if (stroke) isString(stroke) ? Paint.stroke(stroke, this, canvas, options) : Paint.strokes(stroke, this, canvas, options);
13382
13386
  if (fill) isString(fill) ? Paint.fill(fill, this, canvas, options) : Paint.fills(fill, this, canvas, options);
13387
+ if (data.shadow) canvas.restore();
13383
13388
  }
13384
13389
  }
13385
13390
  data.strokeWidth = strokeWidth;
@@ -14543,7 +14548,7 @@ const rotateSVG = `\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/s
14543
14548
 
14544
14549
  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`;
14545
14550
 
14546
- const config = {
14551
+ const config$1 = {
14547
14552
  editSize: "size",
14548
14553
  keyEvent: true,
14549
14554
  stroke: "#836DFF",
@@ -15188,7 +15193,7 @@ let Editor = class Editor extends Group {
15188
15193
  this.selector = new EditSelect(this);
15189
15194
  this.editMask = new EditMask(this);
15190
15195
  this.targetEventIds = [];
15191
- let mergedConfig = DataHelper.clone(config);
15196
+ let mergedConfig = DataHelper.clone(config$1);
15192
15197
  if (userConfig) mergedConfig = DataHelper.default(userConfig, mergedConfig);
15193
15198
  this.mergedConfig = this.config = mergedConfig;
15194
15199
  this.addMany(this.editMask, this.selector, this.editBox);
@@ -15470,7 +15475,10 @@ class InnerEditor {
15470
15475
  return "focus";
15471
15476
  }
15472
15477
  get editBox() {
15473
- return this.editor.editBox;
15478
+ return this._editBox || this.editor.editBox;
15479
+ }
15480
+ set editBox(value) {
15481
+ this._editBox = value;
15474
15482
  }
15475
15483
  constructor(editor) {
15476
15484
  this.eventIds = [];
@@ -15661,7 +15669,7 @@ let LineEditTool = class LineEditTool extends EditTool {
15661
15669
  onSkew(_e) {}
15662
15670
  onUpdate() {
15663
15671
  const {editBox: editBox} = this, {rotatePoints: rotatePoints, resizeLines: resizeLines, resizePoints: resizePoints, rect: rect} = editBox;
15664
- const line = this.editor.element;
15672
+ const line = editBox.target;
15665
15673
  let fromTo, leftOrRight;
15666
15674
  if (line.pathInputed) fromTo = this.getFromToByPath(line.__.path); else if (line.points) fromTo = this.getFromToByPoints(line.__.points);
15667
15675
  if (fromTo) {
@@ -17563,7 +17571,7 @@ function autoBoundsType(defaultValue) {
17563
17571
 
17564
17572
  Plugin.add("flow", "resize");
17565
17573
 
17566
- const box = Box.prototype, {__updateBoxBounds: __updateBoxBounds} = Group.prototype;
17574
+ const box$1 = Box.prototype, {__updateBoxBounds: __updateBoxBounds} = Group.prototype;
17567
17575
 
17568
17576
  UI.addAttr("flow", false, autoLayoutType);
17569
17577
 
@@ -17585,7 +17593,7 @@ UI.addAttr("autoBox", undefined, boundsType);
17585
17593
 
17586
17594
  const {copyAndSpread: copyAndSpread} = BoundsHelper;
17587
17595
 
17588
- box.__updateFlowLayout = function() {
17596
+ box$1.__updateFlowLayout = function() {
17589
17597
  const {leaferIsCreated: leaferIsCreated, flow: flow} = this;
17590
17598
  if (leaferIsCreated) this.leafer.created = false;
17591
17599
  switch (flow) {
@@ -17609,7 +17617,7 @@ box.__updateFlowLayout = function() {
17609
17617
  if (leaferIsCreated) this.leafer.created = true;
17610
17618
  };
17611
17619
 
17612
- box.__updateContentBounds = function() {
17620
+ box$1.__updateContentBounds = function() {
17613
17621
  const {padding: padding} = this.__;
17614
17622
  const layout = this.__layout;
17615
17623
  const same = layout.contentBounds === layout.boxBounds;
@@ -17621,7 +17629,7 @@ box.__updateContentBounds = function() {
17621
17629
  }
17622
17630
  };
17623
17631
 
17624
- box.__updateBoxBounds = function(secondLayout) {
17632
+ box$1.__updateBoxBounds = function(secondLayout) {
17625
17633
  if (this.children.length && !this.pathInputed) {
17626
17634
  const data = this.__, {flow: flow} = data;
17627
17635
  if (data.__autoSide) {
@@ -18423,7 +18431,7 @@ const hslMatch = /^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i;
18423
18431
 
18424
18432
  const hslaMatch = /^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i;
18425
18433
 
18426
- const int = parseInt, float$1 = parseFloat, {round: round$1} = Math;
18434
+ const int = parseInt, float$2 = parseFloat, {round: round$1} = Math;
18427
18435
 
18428
18436
  let cache = {}, totalCache = 0;
18429
18437
 
@@ -18536,18 +18544,18 @@ function rgbaToRGBA(color) {
18536
18544
  r: int(match[1]),
18537
18545
  g: int(match[2]),
18538
18546
  b: int(match[3]),
18539
- a: float$1(match[4])
18547
+ a: float$2(match[4])
18540
18548
  };
18541
18549
  }
18542
18550
 
18543
18551
  function hslToRGBA(color) {
18544
18552
  const match = hslMatch.exec(color);
18545
- return hsla(float$1(match[1]), float$1(match[2]), float$1(match[3]), 1);
18553
+ return hsla(float$2(match[1]), float$2(match[2]), float$2(match[3]), 1);
18546
18554
  }
18547
18555
 
18548
18556
  function hslaToRGBA(color) {
18549
18557
  const match = hslaMatch.exec(color);
18550
- return hsla(float$1(match[1]), float$1(match[2]), float$1(match[3]), float$1(match[4]));
18558
+ return hsla(float$2(match[1]), float$2(match[2]), float$2(match[3]), float$2(match[4]));
18551
18559
  }
18552
18560
 
18553
18561
  const n1 = 1 / 6, n2 = .5, n3 = 2 / 3, n4 = 1 / 3;
@@ -18786,7 +18794,7 @@ const HighBezierHelper = {
18786
18794
 
18787
18795
  const {getDistance: getDistance} = HighBezierHelper;
18788
18796
 
18789
- const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float} = MathHelper;
18797
+ const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float$1} = MathHelper;
18790
18798
 
18791
18799
  const tempPoint = {}, tempFrom = {};
18792
18800
 
@@ -18941,7 +18949,7 @@ const HighCurveHelper = {
18941
18949
  tempFrom.y = y;
18942
18950
  to.x = toX;
18943
18951
  to.y = toY;
18944
- cutDistance = float(motionDistance - total);
18952
+ cutDistance = float$1(motionDistance - total);
18945
18953
  if (cutDistance) {
18946
18954
  PointHelper.getDistancePoint(tempFrom, to, cutDistance, true);
18947
18955
  path.push(command, to.x, to.y);
@@ -18960,7 +18968,7 @@ const HighCurveHelper = {
18960
18968
  toY = data[i + 6];
18961
18969
  distance = segments[index];
18962
18970
  if (total + distance > motionDistance) {
18963
- cutDistance = float(motionDistance - total);
18971
+ cutDistance = float$1(motionDistance - total);
18964
18972
  if (cutDistance) {
18965
18973
  t = HighBezierHelper.getT(cutDistance, distance, x, y, x1, y1, x2, y2, toX, toY, motionPrecision);
18966
18974
  HighBezierHelper.cut(path, t, x, y, x1, y1, x2, y2, toX, toY);
@@ -19179,21 +19187,21 @@ function getStyle(leaf) {
19179
19187
  const style = {}, button = findParentButton(leaf);
19180
19188
  const state = button ? leaf.state || button.state : leaf.state;
19181
19189
  const stateStyle = state && leaf.states[state];
19182
- if (stateStyle && State.isState(state, leaf, button)) exist = assign(style, stateStyle);
19190
+ if (stateStyle && State.isState(state, leaf, button)) exist = assign$1(style, stateStyle);
19183
19191
  const selectedStyle = style.selectedStyle || leaf.selectedStyle;
19184
- if (selectedStyle && State.isSelected(leaf, button)) exist = assign(style, selectedStyle);
19192
+ if (selectedStyle && State.isSelected(leaf, button)) exist = assign$1(style, selectedStyle);
19185
19193
  const placeholderStyle = style.placeholderStyle || leaf.placeholderStyle;
19186
- if (placeholderStyle && State.isPlacehold(leaf, button)) exist = assign(style, placeholderStyle);
19194
+ if (placeholderStyle && State.isPlacehold(leaf, button)) exist = assign$1(style, placeholderStyle);
19187
19195
  if (State.isDisabled(leaf, button)) {
19188
19196
  const disabledStyle = style.disabledStyle || leaf.disabledStyle;
19189
- if (disabledStyle) exist = assign(style, disabledStyle);
19197
+ if (disabledStyle) exist = assign$1(style, disabledStyle);
19190
19198
  } else {
19191
19199
  const focusStyle = style.focusStyle || leaf.focusStyle;
19192
- if (focusStyle && State.isFocus(leaf, button)) exist = assign(style, focusStyle);
19200
+ if (focusStyle && State.isFocus(leaf, button)) exist = assign$1(style, focusStyle);
19193
19201
  const hoverStyle = style.hoverStyle || leaf.hoverStyle;
19194
- if (hoverStyle && State.isHover(leaf, button)) exist = assign(style, hoverStyle);
19202
+ if (hoverStyle && State.isHover(leaf, button)) exist = assign$1(style, hoverStyle);
19195
19203
  const pressStyle = style.pressStyle || leaf.pressStyle;
19196
- if (pressStyle && State.isPress(leaf, button)) exist = assign(style, pressStyle);
19204
+ if (pressStyle && State.isPress(leaf, button)) exist = assign$1(style, pressStyle);
19197
19205
  }
19198
19206
  return exist ? style : undefined;
19199
19207
  }
@@ -19224,7 +19232,7 @@ function getTransition(type, style, data) {
19224
19232
  return isNull(style[name]) ? data[name] : style[name];
19225
19233
  }
19226
19234
 
19227
- function assign(style, stateStyle) {
19235
+ function assign$1(style, stateStyle) {
19228
19236
  Object.assign(style, stateStyle);
19229
19237
  return true;
19230
19238
  }
@@ -20045,4 +20053,258 @@ Plugin.add("bright");
20045
20053
 
20046
20054
  UI.addAttr("bright", false, dimType);
20047
20055
 
20048
- export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, FourNumberHelper, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TouchEvent, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite$1 as isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$4 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
20056
+ const config = {
20057
+ theme: "light",
20058
+ style: {
20059
+ dragBoundsType: "outer",
20060
+ strokeAlign: "center",
20061
+ strokeWidthFixed: "zoom-in",
20062
+ width: 6,
20063
+ height: 6,
20064
+ opacity: .5,
20065
+ cornerRadius: 3,
20066
+ hoverStyle: {
20067
+ opacity: .6
20068
+ },
20069
+ pressStyle: {
20070
+ opacity: .66
20071
+ }
20072
+ },
20073
+ size: 6,
20074
+ endsMargin: 2,
20075
+ sideMargin: 2,
20076
+ minSize: 10,
20077
+ scaleFixed: "zoom-in",
20078
+ scrollType: "both",
20079
+ hideOnActionEnd: "hover"
20080
+ };
20081
+
20082
+ const tempBounds = new Bounds, {float: float} = MathHelper, {clone: clone, assign: assign} = DataHelper;
20083
+
20084
+ class Scroller extends Group {
20085
+ get canUse() {
20086
+ return this.target.hasScroller;
20087
+ }
20088
+ constructor(target) {
20089
+ super();
20090
+ this.targetWorldBounds = new Bounds;
20091
+ this.viewportBounds = new Bounds;
20092
+ this.contentBounds = new Bounds;
20093
+ this.scrollXBounds = new Bounds;
20094
+ this.scrollYBounds = new Bounds;
20095
+ this.target = target;
20096
+ this.config = clone(config);
20097
+ this.updateConfig();
20098
+ this.__listenEvents();
20099
+ target.waitLeafer(() => {
20100
+ this.parent = target;
20101
+ this.__bindLeafer(target.leafer);
20102
+ });
20103
+ if (this.mergedConfig.hideOnActionEnd) this.opacity = 0;
20104
+ }
20105
+ static registerTheme(theme, themeConfig) {
20106
+ S.themeMap[theme] = themeConfig;
20107
+ }
20108
+ static getTheme(theme) {
20109
+ return theme && S.themeMap[theme];
20110
+ }
20111
+ static hasTheme(theme) {
20112
+ return theme && !!S.themeMap[theme];
20113
+ }
20114
+ updateConfig() {
20115
+ const {scrollConfig: scrollConfig} = this.target;
20116
+ const themeConfig = S.getTheme(scrollConfig && S.hasTheme(scrollConfig.theme) && scrollConfig.theme || this.config.theme);
20117
+ const mergedConfig = this.mergedConfig = clone(this.config);
20118
+ assign(mergedConfig, themeConfig);
20119
+ if (scrollConfig) assign(mergedConfig, scrollConfig);
20120
+ this.updateStyle(mergedConfig.style);
20121
+ }
20122
+ updateStyle(style) {
20123
+ if (!this.scrollXBar) this.addMany(this.scrollXBar = new Box, this.scrollYBar = new Box);
20124
+ const {scrollXBar: scrollXBar, scrollYBar: scrollYBar} = this;
20125
+ scrollXBar.set(style);
20126
+ scrollYBar.set(style);
20127
+ scrollXBar.draggable = "x";
20128
+ scrollYBar.draggable = "y";
20129
+ }
20130
+ update(check = true) {
20131
+ if (this.dragScrolling) return;
20132
+ const {target: target, targetOverflow: targetOverflow, targetWorldBounds: targetWorldBounds, viewportBounds: viewportBounds, contentBounds: contentBounds} = this, layout = target.__layout, {overflow: overflow} = target.__;
20133
+ const {childrenRenderBounds: childrenRenderBounds} = layout;
20134
+ const {boxBounds: boxBounds, worldBoxBounds: worldBoxBounds} = layout;
20135
+ const isSameWorldBounds = check && targetOverflow === overflow && targetWorldBounds.isSame(worldBoxBounds);
20136
+ const isSameConfig = layout.scrollConfigChanged ? (this.updateConfig(), layout.scrollConfigChanged = false) : true;
20137
+ const nowContentBounds = tempBounds.set(viewportBounds).add(childrenRenderBounds);
20138
+ if (isSameWorldBounds && isSameConfig && contentBounds.isSame(nowContentBounds)) return;
20139
+ this.targetOverflow = overflow;
20140
+ viewportBounds.set(boxBounds);
20141
+ targetWorldBounds.set(worldBoxBounds);
20142
+ contentBounds.set(nowContentBounds);
20143
+ const {scrollXBar: scrollXBar, scrollYBar: scrollYBar} = this, {size: size, endsMargin: endsMargin, minSize: minSize} = this.mergedConfig, {width: width, height: height} = viewportBounds;
20144
+ this.contentRealX = contentBounds.x - target.scrollX;
20145
+ this.contentRealY = contentBounds.y - target.scrollY;
20146
+ this.ratioX = viewportBounds.width / contentBounds.width;
20147
+ this.ratioY = viewportBounds.height / contentBounds.height;
20148
+ const min = size + endsMargin * 2 + minSize;
20149
+ scrollXBar.visible = float(contentBounds.width) > float(width) && overflow !== "y-scroll" && width > min;
20150
+ scrollYBar.visible = float(contentBounds.height) > float(height) && overflow !== "x-scroll" && height > min;
20151
+ this.updateScrollBar();
20152
+ }
20153
+ updateScrollBar() {
20154
+ const {target: target, viewportBounds: viewportBounds, contentBounds: contentBounds, ratioX: ratioX, ratioY: ratioY, scrollXBar: scrollXBar, scrollYBar: scrollYBar, scrollXBounds: scrollXBounds, scrollYBounds: scrollYBounds} = this;
20155
+ let {size: size, cornerRadius: cornerRadius, endsMargin: endsMargin, sideMargin: sideMargin, minSize: minSize, scaleFixed: scaleFixed, scrollType: scrollType} = this.mergedConfig;
20156
+ const scale = scaleFixed ? target.getClampRenderScale() : 1;
20157
+ endsMargin /= scale;
20158
+ sideMargin /= scale;
20159
+ size /= scale;
20160
+ if (isUndefined(cornerRadius)) cornerRadius = size / 2;
20161
+ if (scrollXBar.visible) {
20162
+ scrollXBounds.set(viewportBounds).shrink([ endsMargin, scrollYBar.visible ? size + sideMargin : endsMargin, sideMargin, endsMargin ]);
20163
+ const scrollRatioX = this.scrollRatioX = scrollXBounds.width / contentBounds.width;
20164
+ scrollXBar.set({
20165
+ x: scrollXBounds.x - contentBounds.x * scrollRatioX,
20166
+ y: scrollXBounds.maxY - size,
20167
+ width: Math.max(scrollXBounds.width * ratioX, minSize),
20168
+ height: size,
20169
+ cornerRadius: cornerRadius,
20170
+ dragBounds: scrollXBounds,
20171
+ hittable: scrollType !== "move"
20172
+ });
20173
+ }
20174
+ if (scrollYBar.visible) {
20175
+ scrollYBounds.set(viewportBounds).shrink([ endsMargin, sideMargin, scrollXBar.visible ? size + sideMargin : endsMargin, endsMargin ]);
20176
+ const scrollRatioY = this.scrollRatioY = scrollYBounds.height / contentBounds.height;
20177
+ scrollYBar.set({
20178
+ x: scrollYBounds.maxX - size,
20179
+ y: scrollYBounds.y - contentBounds.y * scrollRatioY,
20180
+ width: size,
20181
+ height: Math.max(scrollYBounds.height * ratioY, minSize),
20182
+ cornerRadius: cornerRadius,
20183
+ dragBounds: scrollYBounds,
20184
+ hittable: scrollType !== "move"
20185
+ });
20186
+ }
20187
+ this.x = -this.target.scrollX;
20188
+ this.y = -this.target.scrollY;
20189
+ LeafHelper.updateAllMatrix(this);
20190
+ BranchHelper.updateBounds(this);
20191
+ LeafHelper.updateAllChange(this);
20192
+ }
20193
+ onDrag(e) {
20194
+ if (this.mergedConfig.scrollType === "move") return;
20195
+ this.dragScrolling = true;
20196
+ const {scrollXBar: scrollXBar, scrollYBar: scrollYBar, target: target, scrollXBounds: scrollXBounds, scrollYBounds: scrollYBounds} = this;
20197
+ const scrollX = e.current === scrollXBar;
20198
+ if (scrollX) target.scrollX = -((scrollXBar.x - scrollXBounds.x) / this.scrollRatioX + this.contentRealX); else target.scrollY = -((scrollYBar.y - scrollYBounds.y) / this.scrollRatioY + this.contentRealY);
20199
+ }
20200
+ onDragEnd() {
20201
+ if (this.mergedConfig.scrollType === "move") return;
20202
+ this.dragScrolling = false;
20203
+ }
20204
+ onMove(e) {
20205
+ if (!this.canUse) return;
20206
+ this.onEnter();
20207
+ const {scrollType: scrollType, stopDefault: stopDefault} = this.mergedConfig;
20208
+ if (scrollType === "drag") return;
20209
+ const {viewportBounds: viewportBounds, contentBounds: contentBounds, scrollXBar: scrollXBar, scrollYBar: scrollYBar} = this;
20210
+ if (scrollXBar.visible || scrollYBar.visible) {
20211
+ const move = e.getInnerMove(this.target);
20212
+ DragBoundsHelper.getValidMove(contentBounds, viewportBounds, "inner", move, true);
20213
+ let needStop;
20214
+ if (move.x && scrollXBar.visible) this.target.scrollX += move.x, needStop = true;
20215
+ if (move.y && scrollYBar.visible) this.target.scrollY += move.y, needStop = true;
20216
+ if (needStop || stopDefault) e.stop();
20217
+ if (stopDefault) e.stopDefault();
20218
+ }
20219
+ }
20220
+ onMoveEnd(e) {
20221
+ if (!this.canUse) return;
20222
+ if (!this.target.hit(e)) this.onLeave();
20223
+ }
20224
+ onEnter() {
20225
+ if (!this.canUse) return;
20226
+ clearTimeout(this.hideTimer);
20227
+ this.killAnimate();
20228
+ this.opacity = 1;
20229
+ }
20230
+ onLeave() {
20231
+ if (!this.canUse) return;
20232
+ clearTimeout(this.hideTimer);
20233
+ if (this.mergedConfig.hideOnActionEnd) this.hideTimer = setTimeout(() => {
20234
+ this.set({
20235
+ opacity: 0
20236
+ }, Plugin.has("animate"));
20237
+ }, 600);
20238
+ }
20239
+ onResize() {
20240
+ if (this.canUse) this.update();
20241
+ }
20242
+ __listenEvents() {
20243
+ const {scrollXBar: scrollXBar, scrollYBar: scrollYBar, target: target} = this;
20244
+ this.__eventIds = [ scrollXBar.on_(DragEvent.DRAG, this.onDrag, this), scrollXBar.on_(DragEvent.END, this.onDragEnd, this), scrollYBar.on_(DragEvent.DRAG, this.onDrag, this), scrollYBar.on_(DragEvent.END, this.onDragEnd, this), target.on_(PointerEvent.ENTER, this.onEnter, this), target.on_(PointerEvent.LEAVE, this.onLeave, this), target.on_(MoveEvent.BEFORE_MOVE, this.onMove, this), target.on_(MoveEvent.END, this.onMoveEnd, this), target.on_(BoundsEvent.WORLD, this.onResize, this), target.on_(ChildEvent.DESTROY, this.destroy, this) ];
20245
+ }
20246
+ __removeListenEvents() {
20247
+ this.off_(this.__eventIds);
20248
+ }
20249
+ destroy() {
20250
+ if (!this.destroyed) {
20251
+ this.__removeListenEvents();
20252
+ const {target: target} = this;
20253
+ target.scroller = target.topChildren = target.hasScroller = undefined;
20254
+ this.target = this.config = null;
20255
+ super.destroy();
20256
+ }
20257
+ }
20258
+ }
20259
+
20260
+ Scroller.themeMap = {};
20261
+
20262
+ const S = Scroller;
20263
+
20264
+ function scrollConfigType(defaultValue) {
20265
+ return decorateLeafAttr(defaultValue, key => attr({
20266
+ set(value) {
20267
+ if (this.__setAttr(key, value)) {
20268
+ const layout = this.__layout;
20269
+ layout.scrollConfigChanged = true;
20270
+ doBoundsType(this);
20271
+ }
20272
+ }
20273
+ }));
20274
+ }
20275
+
20276
+ Plugin.add("scroller");
20277
+
20278
+ const box = Box.prototype;
20279
+
20280
+ Box.addAttr("scrollConfig", undefined, scrollConfigType);
20281
+
20282
+ box.__checkScroll = function(isScrollMode) {
20283
+ if (isScrollMode && this.isOverflow) {
20284
+ if (!this.scroller) {
20285
+ this.scroller = new Scroller(this);
20286
+ if (!this.topChildren) this.topChildren = [];
20287
+ this.topChildren.push(this.scroller);
20288
+ }
20289
+ this.hasScroller = true;
20290
+ } else {
20291
+ if (this.hasScroller && !this.scroller.dragScrolling) {
20292
+ this.hasScroller = undefined;
20293
+ this.scroller.update();
20294
+ }
20295
+ }
20296
+ };
20297
+
20298
+ Scroller.registerTheme("light", {
20299
+ style: {
20300
+ fill: "black"
20301
+ }
20302
+ });
20303
+
20304
+ Scroller.registerTheme("dark", {
20305
+ style: {
20306
+ fill: "white"
20307
+ }
20308
+ });
20309
+
20310
+ export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, FourNumberHelper, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, Scroller, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TouchEvent, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite$1 as isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$3 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$4 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };