leafer-ui 1.0.0-rc.4 → 1.0.0-rc.6

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/web.js CHANGED
@@ -129,13 +129,13 @@ var LeaferUI = (function (exports) {
129
129
  t.d *= y;
130
130
  },
131
131
  scaleOfOuter(t, origin, x, y = x) {
132
- M$5.toInnerPoint(t, origin, tempPoint$1);
133
- M$5.scaleOfInner(t, tempPoint$1, x, y);
132
+ M$6.toInnerPoint(t, origin, tempPoint$1);
133
+ M$6.scaleOfInner(t, tempPoint$1, x, y);
134
134
  },
135
135
  scaleOfInner(t, origin, x, y = x) {
136
- M$5.translateInner(t, origin.x, origin.y);
137
- M$5.scale(t, x, y);
138
- M$5.translateInner(t, -origin.x, -origin.y);
136
+ M$6.translateInner(t, origin.x, origin.y);
137
+ M$6.scale(t, x, y);
138
+ M$6.translateInner(t, -origin.x, -origin.y);
139
139
  },
140
140
  rotate(t, angle) {
141
141
  angle *= OneRadian;
@@ -148,13 +148,13 @@ var LeaferUI = (function (exports) {
148
148
  t.d = (c * sinR) + (d * cosR);
149
149
  },
150
150
  rotateOfOuter(t, origin, angle) {
151
- M$5.toInnerPoint(t, origin, tempPoint$1);
152
- M$5.rotateOfInner(t, tempPoint$1, angle);
151
+ M$6.toInnerPoint(t, origin, tempPoint$1);
152
+ M$6.rotateOfInner(t, tempPoint$1, angle);
153
153
  },
154
154
  rotateOfInner(t, origin, angle) {
155
- M$5.translateInner(t, origin.x, origin.y);
156
- M$5.rotate(t, angle);
157
- M$5.translateInner(t, -origin.x, -origin.y);
155
+ M$6.translateInner(t, origin.x, origin.y);
156
+ M$6.rotate(t, angle);
157
+ M$6.translateInner(t, -origin.x, -origin.y);
158
158
  },
159
159
  skew(t, x, y) {
160
160
  const { a, b, c, d } = t;
@@ -170,13 +170,13 @@ var LeaferUI = (function (exports) {
170
170
  }
171
171
  },
172
172
  skewOfOuter(t, origin, x, y) {
173
- M$5.toInnerPoint(t, origin, tempPoint$1);
174
- M$5.skewOfInner(t, tempPoint$1, x, y);
173
+ M$6.toInnerPoint(t, origin, tempPoint$1);
174
+ M$6.skewOfInner(t, tempPoint$1, x, y);
175
175
  },
176
176
  skewOfInner(t, origin, x, y) {
177
- M$5.translateInner(t, origin.x, origin.y);
178
- M$5.skew(t, x, y);
179
- M$5.translateInner(t, -origin.x, -origin.y);
177
+ M$6.translateInner(t, origin.x, origin.y);
178
+ M$6.skew(t, x, y);
179
+ M$6.translateInner(t, -origin.x, -origin.y);
180
180
  },
181
181
  multiply(t, matrix) {
182
182
  const { a, b, c, d, e, f } = t;
@@ -199,12 +199,12 @@ var LeaferUI = (function (exports) {
199
199
  t.f = (e * matrix.b) + (f * matrix.d) + matrix.f;
200
200
  },
201
201
  divide(t, matrix) {
202
- M$5.preMultiply(t, M$5.tempInvert(matrix));
202
+ M$6.preMultiply(t, M$6.tempInvert(matrix));
203
203
  },
204
204
  tempInvert(t) {
205
- const { tempMatrix: temp } = M$5;
206
- M$5.copy(temp, t);
207
- M$5.invert(temp);
205
+ const { tempMatrix: temp } = M$6;
206
+ M$6.copy(temp, t);
207
+ M$6.invert(temp);
208
208
  return temp;
209
209
  },
210
210
  invert(t) {
@@ -267,10 +267,10 @@ var LeaferUI = (function (exports) {
267
267
  return { x: t.e, y: t.f, scaleX, scaleY, rotation, skewX, skewY };
268
268
  },
269
269
  reset(t) {
270
- M$5.set(t);
270
+ M$6.set(t);
271
271
  }
272
272
  };
273
- const M$5 = MatrixHelper;
273
+ const M$6 = MatrixHelper;
274
274
 
275
275
  const { toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$2 } = MatrixHelper;
276
276
  const { sin: sin$5, cos: cos$5, abs: abs$1, sqrt: sqrt$2, atan2: atan2$2 } = Math;
@@ -590,9 +590,7 @@ var LeaferUI = (function (exports) {
590
590
  }
591
591
  B.move(to, -to.offsetX, -to.offsetY);
592
592
  },
593
- scale(t, scaleX, scaleY) {
594
- if (!scaleY)
595
- scaleY = scaleX;
593
+ scale(t, scaleX, scaleY = scaleX) {
596
594
  if (t.x)
597
595
  t.x *= scaleX;
598
596
  if (t.y)
@@ -600,6 +598,12 @@ var LeaferUI = (function (exports) {
600
598
  t.width *= scaleX;
601
599
  t.height *= scaleY;
602
600
  },
601
+ scaleOf(t, origin, scaleX, scaleY) {
602
+ t.x += (t.x - origin.x) * (scaleX - 1);
603
+ t.y += (t.y - origin.y) * (scaleY - 1);
604
+ t.width *= scaleX;
605
+ t.height *= scaleY;
606
+ },
603
607
  tempToOuterOf(t, matrix) {
604
608
  B.copy(B.tempBounds, t);
605
609
  B.toOuterOf(B.tempBounds, matrix);
@@ -650,14 +654,14 @@ var LeaferUI = (function (exports) {
650
654
  },
651
655
  getFitMatrix(t, put) {
652
656
  const scale = Math.min(1, Math.min(t.width / put.width, t.height / put.height));
653
- return new Matrix(scale, 0, 0, scale, -Math.ceil(put.x * scale), -Math.ceil(put.y * scale));
657
+ return new Matrix(scale, 0, 0, scale, -put.x * scale, -put.y * scale);
654
658
  },
655
659
  getSpread(t, spreadX, spreadY) {
656
660
  const n = {};
657
661
  B.copyAndSpread(n, t, spreadX, spreadY);
658
662
  return n;
659
663
  },
660
- spread(t, spreadX, spreadY) {
664
+ spread(t, spreadX, spreadY = spreadX) {
661
665
  B.copyAndSpread(t, t, spreadX, spreadY);
662
666
  },
663
667
  ceil(t) {
@@ -791,6 +795,10 @@ var LeaferUI = (function (exports) {
791
795
  BoundsHelper.scale(this, scaleX, scaleY);
792
796
  return this;
793
797
  }
798
+ scaleOf(origin, scaleX, scaleY) {
799
+ BoundsHelper.scaleOf(this, origin, scaleX, scaleY);
800
+ return this;
801
+ }
794
802
  toOuterOf(matrix, to) {
795
803
  BoundsHelper.toOuterOf(this, matrix, to);
796
804
  return this;
@@ -798,8 +806,8 @@ var LeaferUI = (function (exports) {
798
806
  getFitMatrix(put) {
799
807
  return BoundsHelper.getFitMatrix(this, put);
800
808
  }
801
- spread(size) {
802
- BoundsHelper.spread(this, size);
809
+ spread(spreadX, spreadY) {
810
+ BoundsHelper.spread(this, spreadX, spreadY);
803
811
  return this;
804
812
  }
805
813
  ceil() {
@@ -1343,14 +1351,22 @@ var LeaferUI = (function (exports) {
1343
1351
  if (this.__input && this.__input[name] !== undefined)
1344
1352
  this.__input[name] = undefined;
1345
1353
  }
1346
- __getInputData() {
1354
+ __getInputData(options) {
1347
1355
  const data = { tag: this.__leaf.tag }, { __input } = this;
1348
- let realKey, value;
1349
- for (let key in this) {
1350
- realKey = key.substring(1);
1351
- if (this[realKey] !== undefined) {
1352
- value = __input ? __input[realKey] : undefined;
1353
- data[realKey] = value === undefined ? this[key] : value;
1356
+ if (options) {
1357
+ for (let key in this) {
1358
+ if (key[0] !== '_')
1359
+ data[key] = this[key];
1360
+ }
1361
+ }
1362
+ else {
1363
+ let realKey, value;
1364
+ for (let key in this) {
1365
+ realKey = key.substring(1);
1366
+ if (this[realKey] !== undefined) {
1367
+ value = __input ? __input[realKey] : undefined;
1368
+ data[realKey] = value === undefined ? this[key] : value;
1369
+ }
1354
1370
  }
1355
1371
  }
1356
1372
  return data;
@@ -1381,6 +1397,8 @@ var LeaferUI = (function (exports) {
1381
1397
  }
1382
1398
 
1383
1399
  const FileHelper = {
1400
+ opacityTypes: ['png', 'webp', 'svg'],
1401
+ upperCaseTypeMap: {},
1384
1402
  mineType(type) {
1385
1403
  if (!type || type.startsWith('image'))
1386
1404
  return type;
@@ -1393,6 +1411,7 @@ var LeaferUI = (function (exports) {
1393
1411
  return l[l.length - 1];
1394
1412
  }
1395
1413
  };
1414
+ FileHelper.opacityTypes.forEach(type => FileHelper.upperCaseTypeMap[type] = type.toUpperCase());
1396
1415
 
1397
1416
  /******************************************************************************
1398
1417
  Copyright (c) Microsoft Corporation.
@@ -2086,11 +2105,11 @@ var LeaferUI = (function (exports) {
2086
2105
  const { sin: sin$4, cos: cos$4, atan2: atan2$1, ceil, abs, PI: PI$2, sqrt: sqrt$1, pow } = Math;
2087
2106
  const { setPoint: setPoint$1, addPoint: addPoint$1 } = TwoPointBoundsHelper;
2088
2107
  const { set: set$2 } = PointHelper;
2089
- const { M: M$4, L: L$5, C: C$4, Q: Q$4, Z: Z$4 } = PathCommandMap;
2108
+ const { M: M$5, L: L$6, C: C$5, Q: Q$4, Z: Z$5 } = PathCommandMap;
2090
2109
  const tempPoint = {};
2091
2110
  const BezierHelper = {
2092
2111
  points(data, points, curve, close) {
2093
- data.push(M$4, points[0], points[1]);
2112
+ data.push(M$5, points[0], points[1]);
2094
2113
  if (curve && points.length > 5) {
2095
2114
  let aX, aY, bX, bY, cX, cY, c1X, c1Y, c2X, c2Y;
2096
2115
  let ba, cb, d, len = points.length;
@@ -2120,7 +2139,7 @@ var LeaferUI = (function (exports) {
2120
2139
  data.push(Q$4, c1X, c1Y, bX, bY);
2121
2140
  }
2122
2141
  else {
2123
- data.push(C$4, c2X, c2Y, c1X, c1Y, bX, bY);
2142
+ data.push(C$5, c2X, c2Y, c1X, c1Y, bX, bY);
2124
2143
  }
2125
2144
  c2X = bX + cb * cX;
2126
2145
  c2Y = bY + cb * cY;
@@ -2130,11 +2149,11 @@ var LeaferUI = (function (exports) {
2130
2149
  }
2131
2150
  else {
2132
2151
  for (let i = 2, len = points.length; i < len; i += 2) {
2133
- data.push(L$5, points[i], points[i + 1]);
2152
+ data.push(L$6, points[i], points[i + 1]);
2134
2153
  }
2135
2154
  }
2136
2155
  if (close)
2137
- data.push(Z$4);
2156
+ data.push(Z$5);
2138
2157
  },
2139
2158
  rect(data, x, y, width, height) {
2140
2159
  PathHelper.creator.path = data;
@@ -2157,7 +2176,7 @@ var LeaferUI = (function (exports) {
2157
2176
  totalRadian += PI2;
2158
2177
  if (totalRadian === PI$2 || (abs(BAx + BAy) < 1.e-12) || (abs(CBx + CBy) < 1.e-12)) {
2159
2178
  if (data)
2160
- data.push(L$5, x1, y1);
2179
+ data.push(L$6, x1, y1);
2161
2180
  if (setPointBounds) {
2162
2181
  setPoint$1(setPointBounds, fromX, fromY);
2163
2182
  addPoint$1(setPointBounds, x1, y1);
@@ -2210,7 +2229,7 @@ var LeaferUI = (function (exports) {
2210
2229
  let startY = y = rotationSin * radiusX * startCos + rotationCos * radiusY * startSin;
2211
2230
  let fromX = cx + x, fromY = cy + y;
2212
2231
  if (data)
2213
- data.push(L$5, fromX, fromY);
2232
+ data.push(L$6, fromX, fromY);
2214
2233
  if (setPointBounds)
2215
2234
  setPoint$1(setPointBounds, fromX, fromY);
2216
2235
  if (setStartPoint)
@@ -2225,7 +2244,7 @@ var LeaferUI = (function (exports) {
2225
2244
  x2 = cx + x + control * (rotationCos * radiusX * endSin + rotationSin * radiusY * endCos);
2226
2245
  y2 = cy + y + control * (rotationSin * radiusX * endSin - rotationCos * radiusY * endCos);
2227
2246
  if (data)
2228
- data.push(C$4, x1, y1, x2, y2, cx + x, cy + y);
2247
+ data.push(C$5, x1, y1, x2, y2, cx + x, cy + y);
2229
2248
  if (setPointBounds)
2230
2249
  toTwoPointBounds$1(cx + startX, cy + startY, x1, y1, x2, y2, cx + x, cy + y, setPointBounds, true);
2231
2250
  startX = x;
@@ -2239,7 +2258,7 @@ var LeaferUI = (function (exports) {
2239
2258
  set$2(setEndPoint, cx + x, cy + y);
2240
2259
  },
2241
2260
  quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
2242
- data.push(C$4, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
2261
+ data.push(C$5, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
2243
2262
  },
2244
2263
  toTwoPointBoundsByQuadraticCurve(fromX, fromY, x1, y1, toX, toY, pointBounds, addMode) {
2245
2264
  toTwoPointBounds$1(fromX, fromY, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY, pointBounds, addMode);
@@ -2333,7 +2352,7 @@ var LeaferUI = (function (exports) {
2333
2352
  const centerX = fromX + halfX + rotationCos * cx - rotationSin * cy;
2334
2353
  const centerY = fromY + halfY + rotationSin * cx + rotationCos * cy;
2335
2354
  const anticlockwise = totalRadian < 0 ? 1 : 0;
2336
- if (curveMode) {
2355
+ if (curveMode || Platform.ellipseToCurve) {
2337
2356
  ellipse$5(data, centerX, centerY, radiusX, radiusY, rotation, startRadian / OneRadian, endRadian / OneRadian, anticlockwise);
2338
2357
  }
2339
2358
  else {
@@ -2347,7 +2366,7 @@ var LeaferUI = (function (exports) {
2347
2366
  }
2348
2367
  };
2349
2368
 
2350
- const { M: M$3, m, L: L$4, l, H, h, V, v, C: C$3, c, S, s, Q: Q$3, q, T, t, A, a, Z: Z$3, z, N: N$3, D: D$3, X: X$3, G: G$3, F: F$3, O: O$3, P: P$3, U: U$3 } = PathCommandMap;
2369
+ const { M: M$4, m, L: L$5, l, H, h, V, v, C: C$4, c, S, s, Q: Q$3, q, T, t, A, a, Z: Z$4, z, N: N$3, D: D$3, X: X$3, G: G$3, F: F$3, O: O$3, P: P$3, U: U$4 } = PathCommandMap;
2351
2370
  const { rect: rect$2, roundRect: roundRect$2, arcTo: arcTo$2, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
2352
2371
  const { ellipticalArc } = EllipseHelper;
2353
2372
  const debug$b = Debug.get('PathConvert');
@@ -2435,33 +2454,33 @@ var LeaferUI = (function (exports) {
2435
2454
  case m:
2436
2455
  old[i + 1] += x;
2437
2456
  old[i + 2] += y;
2438
- case M$3:
2457
+ case M$4:
2439
2458
  x = old[i + 1];
2440
2459
  y = old[i + 2];
2441
- data.push(M$3, x, y);
2460
+ data.push(M$4, x, y);
2442
2461
  i += 3;
2443
2462
  break;
2444
2463
  case h:
2445
2464
  old[i + 1] += x;
2446
2465
  case H:
2447
2466
  x = old[i + 1];
2448
- data.push(L$4, x, y);
2467
+ data.push(L$5, x, y);
2449
2468
  i += 2;
2450
2469
  break;
2451
2470
  case v:
2452
2471
  old[i + 1] += y;
2453
2472
  case V:
2454
2473
  y = old[i + 1];
2455
- data.push(L$4, x, y);
2474
+ data.push(L$5, x, y);
2456
2475
  i += 2;
2457
2476
  break;
2458
2477
  case l:
2459
2478
  old[i + 1] += x;
2460
2479
  old[i + 2] += y;
2461
- case L$4:
2480
+ case L$5:
2462
2481
  x = old[i + 1];
2463
2482
  y = old[i + 2];
2464
- data.push(L$4, x, y);
2483
+ data.push(L$5, x, y);
2465
2484
  i += 3;
2466
2485
  break;
2467
2486
  case s:
@@ -2471,14 +2490,14 @@ var LeaferUI = (function (exports) {
2471
2490
  old[i + 4] += y;
2472
2491
  command = S;
2473
2492
  case S:
2474
- smooth = (lastCommand === C$3) || (lastCommand === S);
2493
+ smooth = (lastCommand === C$4) || (lastCommand === S);
2475
2494
  x1 = smooth ? (x * 2 - controlX) : old[i + 1];
2476
2495
  y1 = smooth ? (y * 2 - controlY) : old[i + 2];
2477
2496
  controlX = old[i + 1];
2478
2497
  controlY = old[i + 2];
2479
2498
  x = old[i + 3];
2480
2499
  y = old[i + 4];
2481
- data.push(C$3, x1, y1, controlX, controlY, x, y);
2500
+ data.push(C$4, x1, y1, controlX, controlY, x, y);
2482
2501
  i += 5;
2483
2502
  break;
2484
2503
  case c:
@@ -2488,13 +2507,13 @@ var LeaferUI = (function (exports) {
2488
2507
  old[i + 4] += y;
2489
2508
  old[i + 5] += x;
2490
2509
  old[i + 6] += y;
2491
- command = C$3;
2492
- case C$3:
2510
+ command = C$4;
2511
+ case C$4:
2493
2512
  controlX = old[i + 3];
2494
2513
  controlY = old[i + 4];
2495
2514
  x = old[i + 5];
2496
2515
  y = old[i + 6];
2497
- data.push(C$3, old[i + 1], old[i + 2], controlX, controlY, x, y);
2516
+ data.push(C$4, old[i + 1], old[i + 2], controlX, controlY, x, y);
2498
2517
  i += 7;
2499
2518
  break;
2500
2519
  case t:
@@ -2534,8 +2553,8 @@ var LeaferUI = (function (exports) {
2534
2553
  i += 8;
2535
2554
  break;
2536
2555
  case z:
2537
- case Z$3:
2538
- data.push(Z$3);
2556
+ case Z$4:
2557
+ data.push(Z$4);
2539
2558
  i++;
2540
2559
  break;
2541
2560
  case N$3:
@@ -2580,7 +2599,7 @@ var LeaferUI = (function (exports) {
2580
2599
  y = old[i + 2];
2581
2600
  i += 4;
2582
2601
  break;
2583
- case U$3:
2602
+ case U$4:
2584
2603
  arcTo$2(curveMode ? data : copyData(data, old, i, 6), x, y, old[i + 1], old[i + 2], old[i + 3], old[i + 4], old[i + 5], null, setEndPoint$1);
2585
2604
  x = setEndPoint$1.x;
2586
2605
  y = setEndPoint$1.y;
@@ -2611,26 +2630,26 @@ var LeaferUI = (function (exports) {
2611
2630
  };
2612
2631
  const { current, pushData, copyData } = PathConvert;
2613
2632
 
2614
- const { M: M$2, L: L$3, C: C$2, Q: Q$2, Z: Z$2, N: N$2, D: D$2, X: X$2, G: G$2, F: F$2, O: O$2, P: P$2, U: U$2 } = PathCommandMap;
2633
+ const { M: M$3, L: L$4, C: C$3, Q: Q$2, Z: Z$3, N: N$2, D: D$2, X: X$2, G: G$2, F: F$2, O: O$2, P: P$2, U: U$3 } = PathCommandMap;
2615
2634
  const startPoint = {};
2616
2635
  const PathCommandDataHelper = {
2617
2636
  beginPath(data) {
2618
2637
  data.length = 0;
2619
2638
  },
2620
2639
  moveTo(data, x, y) {
2621
- data.push(M$2, x, y);
2640
+ data.push(M$3, x, y);
2622
2641
  },
2623
2642
  lineTo(data, x, y) {
2624
- data.push(L$3, x, y);
2643
+ data.push(L$4, x, y);
2625
2644
  },
2626
2645
  bezierCurveTo(data, x1, y1, x2, y2, x, y) {
2627
- data.push(C$2, x1, y1, x2, y2, x, y);
2646
+ data.push(C$3, x1, y1, x2, y2, x, y);
2628
2647
  },
2629
2648
  quadraticCurveTo(data, x1, y1, x, y) {
2630
2649
  data.push(Q$2, x1, y1, x, y);
2631
2650
  },
2632
2651
  closePath(data) {
2633
- data.push(Z$2);
2652
+ data.push(Z$3);
2634
2653
  },
2635
2654
  rect(data, x, y, width, height) {
2636
2655
  data.push(N$2, x, y, width, height);
@@ -2672,7 +2691,7 @@ var LeaferUI = (function (exports) {
2672
2691
  }
2673
2692
  },
2674
2693
  arcTo(data, x1, y1, x2, y2, radius) {
2675
- data.push(U$2, x1, y1, x2, y2, radius);
2694
+ data.push(U$3, x1, y1, x2, y2, radius);
2676
2695
  },
2677
2696
  drawEllipse(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
2678
2697
  if (rotation === undefined)
@@ -2682,7 +2701,7 @@ var LeaferUI = (function (exports) {
2682
2701
  if (endAngle === undefined)
2683
2702
  endAngle = 360;
2684
2703
  BezierHelper.ellipse(null, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise, null, null, startPoint);
2685
- data.push(M$2, startPoint.x, startPoint.y);
2704
+ data.push(M$3, startPoint.x, startPoint.y);
2686
2705
  ellipse$3(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
2687
2706
  },
2688
2707
  drawArc(data, x, y, radius, startAngle, endAngle, anticlockwise) {
@@ -2691,7 +2710,7 @@ var LeaferUI = (function (exports) {
2691
2710
  if (endAngle === undefined)
2692
2711
  endAngle = 360;
2693
2712
  BezierHelper.arc(null, x, y, radius, startAngle, endAngle, anticlockwise, null, null, startPoint);
2694
- data.push(M$2, startPoint.x, startPoint.y);
2713
+ data.push(M$3, startPoint.x, startPoint.y);
2695
2714
  arc$2(data, x, y, radius, startAngle, endAngle, anticlockwise);
2696
2715
  },
2697
2716
  drawPoints(data, points, curve, close) {
@@ -2768,7 +2787,7 @@ var LeaferUI = (function (exports) {
2768
2787
  }
2769
2788
  }
2770
2789
 
2771
- const { M: M$1, L: L$2, C: C$1, Q: Q$1, Z: Z$1, N: N$1, D: D$1, X: X$1, G: G$1, F: F$1, O: O$1, P: P$1, U: U$1 } = PathCommandMap;
2790
+ const { M: M$2, L: L$3, C: C$2, Q: Q$1, Z: Z$2, N: N$1, D: D$1, X: X$1, G: G$1, F: F$1, O: O$1, P: P$1, U: U$2 } = PathCommandMap;
2772
2791
  const debug$a = Debug.get('PathDrawer');
2773
2792
  const PathDrawer = {
2774
2793
  drawPathByData(drawer, data) {
@@ -2779,15 +2798,15 @@ var LeaferUI = (function (exports) {
2779
2798
  while (i < len) {
2780
2799
  command = data[i];
2781
2800
  switch (command) {
2782
- case M$1:
2801
+ case M$2:
2783
2802
  drawer.moveTo(data[i + 1], data[i + 2]);
2784
2803
  i += 3;
2785
2804
  break;
2786
- case L$2:
2805
+ case L$3:
2787
2806
  drawer.lineTo(data[i + 1], data[i + 2]);
2788
2807
  i += 3;
2789
2808
  break;
2790
- case C$1:
2809
+ case C$2:
2791
2810
  drawer.bezierCurveTo(data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6]);
2792
2811
  i += 7;
2793
2812
  break;
@@ -2795,7 +2814,7 @@ var LeaferUI = (function (exports) {
2795
2814
  drawer.quadraticCurveTo(data[i + 1], data[i + 2], data[i + 3], data[i + 4]);
2796
2815
  i += 5;
2797
2816
  break;
2798
- case Z$1:
2817
+ case Z$2:
2799
2818
  drawer.closePath();
2800
2819
  i += 1;
2801
2820
  break;
@@ -2827,7 +2846,7 @@ var LeaferUI = (function (exports) {
2827
2846
  drawer.arc(data[i + 1], data[i + 2], data[i + 3], 0, PI2, false);
2828
2847
  i += 4;
2829
2848
  break;
2830
- case U$1:
2849
+ case U$2:
2831
2850
  drawer.arcTo(data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5]);
2832
2851
  i += 6;
2833
2852
  break;
@@ -2839,7 +2858,7 @@ var LeaferUI = (function (exports) {
2839
2858
  }
2840
2859
  };
2841
2860
 
2842
- const { M, L: L$1, C, Q, Z, N, D, X, G, F, O, P, U } = PathCommandMap;
2861
+ const { M: M$1, L: L$2, C: C$1, Q, Z: Z$1, N, D, X, G, F, O, P, U: U$1 } = PathCommandMap;
2843
2862
  const { toTwoPointBounds, toTwoPointBoundsByQuadraticCurve, arcTo, arc, ellipse: ellipse$1 } = BezierHelper;
2844
2863
  const { add: add$1, copy: copy$6, addPoint, setPoint, addBounds, toBounds: toBounds$3 } = TwoPointBoundsHelper;
2845
2864
  const debug$9 = Debug.get('PathBounds');
@@ -2861,7 +2880,7 @@ var LeaferUI = (function (exports) {
2861
2880
  while (i < len) {
2862
2881
  command = data[i];
2863
2882
  if (i === 0) {
2864
- if (command === Z || command === C || command === Q) {
2883
+ if (command === Z$1 || command === C$1 || command === Q) {
2865
2884
  setPoint(setPointBounds, x, y);
2866
2885
  }
2867
2886
  else {
@@ -2869,14 +2888,14 @@ var LeaferUI = (function (exports) {
2869
2888
  }
2870
2889
  }
2871
2890
  switch (command) {
2872
- case M:
2873
- case L$1:
2891
+ case M$1:
2892
+ case L$2:
2874
2893
  x = data[i + 1];
2875
2894
  y = data[i + 2];
2876
2895
  addPoint(setPointBounds, x, y);
2877
2896
  i += 3;
2878
2897
  break;
2879
- case C:
2898
+ case C$1:
2880
2899
  toX = data[i + 5];
2881
2900
  toY = data[i + 6];
2882
2901
  toTwoPointBounds(x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], toX, toY, tempPointBounds);
@@ -2896,7 +2915,7 @@ var LeaferUI = (function (exports) {
2896
2915
  y = toY;
2897
2916
  i += 5;
2898
2917
  break;
2899
- case Z:
2918
+ case Z$1:
2900
2919
  i += 1;
2901
2920
  break;
2902
2921
  case N:
@@ -2943,7 +2962,7 @@ var LeaferUI = (function (exports) {
2943
2962
  x += radius;
2944
2963
  i += 4;
2945
2964
  break;
2946
- case U:
2965
+ case U$1:
2947
2966
  arcTo(null, x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], tempPointBounds, setEndPoint);
2948
2967
  i === 0 ? copy$6(setPointBounds, tempPointBounds) : add$1(setPointBounds, tempPointBounds);
2949
2968
  x = setEndPoint.x;
@@ -2958,9 +2977,60 @@ var LeaferUI = (function (exports) {
2958
2977
  }
2959
2978
  };
2960
2979
 
2980
+ const { M, L: L$1, C, Z, U } = PathCommandMap;
2961
2981
  const PathCorner = {
2962
- smooth(data, _cornerRadius, _cornerSmoothing) {
2963
- return data;
2982
+ smooth(data, cornerRadius, _cornerSmoothing) {
2983
+ let command;
2984
+ let i = 0, x = 0, y = 0, startX, startY = 0, centerX = 0, centerY = 0;
2985
+ const len = data.length;
2986
+ const smooth = [];
2987
+ while (i < len) {
2988
+ command = data[i];
2989
+ switch (command) {
2990
+ case M:
2991
+ startX = data[i + 1];
2992
+ startY = data[i + 2];
2993
+ i += 3;
2994
+ if (data[i] === L$1) {
2995
+ centerX = startX + (data[i + 1] - startX) / 2;
2996
+ centerY = startY + (data[i + 2] - startY) / 2;
2997
+ smooth.push(M, centerX, centerY);
2998
+ }
2999
+ else {
3000
+ smooth.push(M, startX, startY);
3001
+ }
3002
+ break;
3003
+ case L$1:
3004
+ x = data[i + 1];
3005
+ y = data[i + 2];
3006
+ i += 3;
3007
+ switch (data[i]) {
3008
+ case L$1:
3009
+ smooth.push(U, x, y, data[i + 1], data[i + 2], cornerRadius);
3010
+ break;
3011
+ case Z:
3012
+ smooth.push(U, x, y, startX, startY, cornerRadius);
3013
+ break;
3014
+ default:
3015
+ smooth.push(L$1, x, y);
3016
+ }
3017
+ break;
3018
+ case C:
3019
+ smooth.push(C, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6]);
3020
+ i += 7;
3021
+ break;
3022
+ case Z:
3023
+ smooth.push(U, startX, startY, centerX, centerY, cornerRadius);
3024
+ smooth.push(Z);
3025
+ i += 1;
3026
+ break;
3027
+ }
3028
+ }
3029
+ if (command !== Z) {
3030
+ smooth[1] = startX;
3031
+ smooth[2] = startY;
3032
+ }
3033
+ return smooth;
2964
3034
  }
2965
3035
  };
2966
3036
 
@@ -3012,9 +3082,7 @@ var LeaferUI = (function (exports) {
3012
3082
  }
3013
3083
 
3014
3084
  class TaskProcessor {
3015
- get total() {
3016
- return this.list.length + this.delayNumber;
3017
- }
3085
+ get total() { return this.list.length + this.delayNumber; }
3018
3086
  get finishedIndex() {
3019
3087
  return this.isComplete ? 0 : this.index + this.parallelSuccessNumber;
3020
3088
  }
@@ -3070,8 +3138,10 @@ var LeaferUI = (function (exports) {
3070
3138
  else {
3071
3139
  this.delayNumber++;
3072
3140
  setTimeout(() => {
3073
- this.delayNumber--;
3074
- this.push(task, start);
3141
+ if (this.delayNumber) {
3142
+ this.delayNumber--;
3143
+ this.push(task, start);
3144
+ }
3075
3145
  }, delay);
3076
3146
  }
3077
3147
  this.isComplete = false;
@@ -3088,6 +3158,7 @@ var LeaferUI = (function (exports) {
3088
3158
  this.parallelSuccessNumber = 0;
3089
3159
  this.list = [];
3090
3160
  this.parallelList = [];
3161
+ this.delayNumber = 0;
3091
3162
  }
3092
3163
  start() {
3093
3164
  if (!this.running) {
@@ -3260,6 +3331,23 @@ var LeaferUI = (function (exports) {
3260
3331
  list.length = 0;
3261
3332
  }
3262
3333
  },
3334
+ isPixel(config) {
3335
+ return FileHelper.opacityTypes.some(item => I$1.isFormat(item, config));
3336
+ },
3337
+ isFormat(format, config) {
3338
+ if (config.format === format)
3339
+ return true;
3340
+ const { url } = config;
3341
+ if (url.startsWith('data:')) {
3342
+ if (url.startsWith('data:' + FileHelper.mineType(format)))
3343
+ return true;
3344
+ }
3345
+ else {
3346
+ if (url.includes('.' + format) || url.includes('.' + FileHelper.upperCaseTypeMap[format]))
3347
+ return true;
3348
+ }
3349
+ return false;
3350
+ },
3263
3351
  destroy() {
3264
3352
  I$1.map = {};
3265
3353
  }
@@ -3275,17 +3363,7 @@ var LeaferUI = (function (exports) {
3275
3363
  this.waitComplete = [];
3276
3364
  this.innerId = create$1(IMAGE);
3277
3365
  this.config = config || { url: '' };
3278
- const { url } = config;
3279
- if (url.startsWith('data:')) {
3280
- if (url.startsWith('data:image/svg'))
3281
- this.isSVG = true;
3282
- }
3283
- else {
3284
- if (url.includes('.svg'))
3285
- this.isSVG = true;
3286
- }
3287
- if (this.config.format === 'svg')
3288
- this.isSVG = true;
3366
+ this.isSVG = ImageManager.isFormat('svg', config);
3289
3367
  }
3290
3368
  load(onSuccess, onError) {
3291
3369
  if (!this.loading) {
@@ -3358,13 +3436,19 @@ var LeaferUI = (function (exports) {
3358
3436
  }
3359
3437
  stopDefault() {
3360
3438
  this.isStopDefault = true;
3439
+ if (this.origin)
3440
+ Platform.event.stopDefault(this.origin);
3361
3441
  }
3362
3442
  stopNow() {
3363
3443
  this.isStopNow = true;
3364
3444
  this.isStop = true;
3445
+ if (this.origin)
3446
+ Platform.event.stopNow(this.origin);
3365
3447
  }
3366
3448
  stop() {
3367
3449
  this.isStop = true;
3450
+ if (this.origin)
3451
+ Platform.event.stop(this.origin);
3368
3452
  }
3369
3453
  }
3370
3454
 
@@ -3426,20 +3510,6 @@ var LeaferUI = (function (exports) {
3426
3510
  }
3427
3511
  ResizeEvent.RESIZE = 'resize';
3428
3512
 
3429
- class TransformEvent extends Event {
3430
- constructor(type, params) {
3431
- super(type);
3432
- if (params)
3433
- Object.assign(this, params);
3434
- }
3435
- }
3436
- TransformEvent.START = 'transform.start';
3437
- TransformEvent.CHANGE = 'transform.change';
3438
- TransformEvent.END = 'transform.end';
3439
- TransformEvent.BEFORE_START = 'transform.before_start';
3440
- TransformEvent.BEFORE_CHANGE = 'transform.before_change';
3441
- TransformEvent.BEFORE_END = 'transform.before_end';
3442
-
3443
3513
  class WatchEvent extends Event {
3444
3514
  constructor(type, data) {
3445
3515
  super(type);
@@ -3540,15 +3610,15 @@ var LeaferUI = (function (exports) {
3540
3610
  this.bubbles = true;
3541
3611
  Object.assign(this, params);
3542
3612
  }
3543
- getInner(target) {
3544
- if (!target)
3545
- target = this.current;
3546
- return target.getInnerPoint(this);
3613
+ getInner(relative) {
3614
+ if (!relative)
3615
+ relative = this.current;
3616
+ return relative.getInnerPoint(this);
3547
3617
  }
3548
- getLocal(target) {
3549
- if (!target)
3550
- target = this.current;
3551
- return target.getLocalPoint(this);
3618
+ getLocal(relative) {
3619
+ if (!relative)
3620
+ relative = this.current;
3621
+ return relative.getLocalPoint(this);
3552
3622
  }
3553
3623
  static changeName(oldName, newName) {
3554
3624
  EventCreator.changeName(oldName, newName);
@@ -3595,7 +3665,7 @@ var LeaferUI = (function (exports) {
3595
3665
  defineLeafAttr(target, key, defaultValue, {
3596
3666
  set(value) {
3597
3667
  this.__setAttr(key, value);
3598
- this.__layout.positionChanged || this.__layout.positionChange();
3668
+ this.__layout.matrixChanged || this.__layout.matrixChange();
3599
3669
  }
3600
3670
  });
3601
3671
  };
@@ -3627,7 +3697,7 @@ var LeaferUI = (function (exports) {
3627
3697
  this.__setAttr(key, value);
3628
3698
  this.__layout.boxChanged || this.__layout.boxChange();
3629
3699
  if (this.__.around)
3630
- this.__layout.positionChanged || this.__layout.positionChange();
3700
+ this.__layout.matrixChanged || this.__layout.matrixChange();
3631
3701
  }
3632
3702
  });
3633
3703
  };
@@ -3863,29 +3933,36 @@ var LeaferUI = (function (exports) {
3863
3933
  exports.PointerEvent.DOUBLE_CLICK = 'double_click';
3864
3934
  exports.PointerEvent.LONG_PRESS = 'long_press';
3865
3935
  exports.PointerEvent.LONG_TAP = 'long_tap';
3936
+ exports.PointerEvent.MENU = 'pointer.menu';
3866
3937
  exports.PointerEvent = __decorate([
3867
3938
  registerUIEvent()
3868
3939
  ], exports.PointerEvent);
3869
3940
 
3870
3941
  const move = {};
3871
3942
  exports.DragEvent = class DragEvent extends exports.PointerEvent {
3872
- getInnerMove(target, total) {
3873
- if (!target)
3874
- target = this.current;
3943
+ static setList(data) {
3944
+ this.list = data instanceof LeafList ? data : new LeafList(data);
3945
+ }
3946
+ static setData(data) {
3947
+ this.data = data;
3948
+ }
3949
+ getInnerMove(relative, total) {
3950
+ if (!relative)
3951
+ relative = this.current;
3875
3952
  this.assignMove(total);
3876
- return target.getInnerPoint(move, null, true);
3953
+ return relative.getInnerPoint(move, null, true);
3877
3954
  }
3878
- getLocalMove(target, total) {
3879
- if (!target)
3880
- target = this.current;
3955
+ getLocalMove(relative, total) {
3956
+ if (!relative)
3957
+ relative = this.current;
3881
3958
  this.assignMove(total);
3882
- return target.getLocalPoint(move, null, true);
3959
+ return relative.getLocalPoint(move, null, true);
3883
3960
  }
3884
- getInnerTotal(target) {
3885
- return this.getInnerMove(target, true);
3961
+ getInnerTotal(relative) {
3962
+ return this.getInnerMove(relative, true);
3886
3963
  }
3887
- getLocalTotal(target) {
3888
- return this.getLocalMove(target, true);
3964
+ getLocalTotal(relative) {
3965
+ return this.getLocalMove(relative, true);
3889
3966
  }
3890
3967
  assignMove(total) {
3891
3968
  move.x = total ? this.totalX : this.moveX;
@@ -3904,17 +3981,16 @@ var LeaferUI = (function (exports) {
3904
3981
  registerUIEvent()
3905
3982
  ], exports.DragEvent);
3906
3983
 
3907
- var DropEvent_1;
3908
- exports.DropEvent = DropEvent_1 = class DropEvent extends exports.PointerEvent {
3984
+ exports.DropEvent = class DropEvent extends exports.PointerEvent {
3909
3985
  static setList(data) {
3910
- DropEvent_1.dragList = data instanceof LeafList ? data : new LeafList(data);
3986
+ exports.DragEvent.setList(data);
3911
3987
  }
3912
3988
  static setData(data) {
3913
- this.dragData = data;
3989
+ exports.DragEvent.setData(data);
3914
3990
  }
3915
3991
  };
3916
3992
  exports.DropEvent.DROP = 'drop';
3917
- exports.DropEvent = DropEvent_1 = __decorate([
3993
+ exports.DropEvent = __decorate([
3918
3994
  registerUIEvent()
3919
3995
  ], exports.DropEvent);
3920
3996
 
@@ -4021,7 +4097,6 @@ var LeaferUI = (function (exports) {
4021
4097
  this.moveEnd();
4022
4098
  this.zoomEnd();
4023
4099
  this.rotateEnd();
4024
- this.transformMode = null;
4025
4100
  }
4026
4101
  moveEnd() {
4027
4102
  if (this.moveData) {
@@ -4046,7 +4121,7 @@ var LeaferUI = (function (exports) {
4046
4121
  }
4047
4122
  }
4048
4123
 
4049
- const { copy: copy$5, translate: translate$2, toInnerPoint: toInnerPoint$1, scaleOfOuter: scaleOfOuter$3, rotateOfOuter: rotateOfOuter$3, skewOfOuter } = MatrixHelper;
4124
+ const { copy: copy$5, toInnerPoint: toInnerPoint$1, scaleOfOuter: scaleOfOuter$3, rotateOfOuter: rotateOfOuter$3, skewOfOuter } = MatrixHelper;
4050
4125
  const matrix = {};
4051
4126
  const LeafHelper = {
4052
4127
  updateAllWorldMatrix(leaf) {
@@ -4089,63 +4164,41 @@ var LeaferUI = (function (exports) {
4089
4164
  return true;
4090
4165
  },
4091
4166
  moveWorld(t, x, y) {
4092
- t.__layout.checkUpdate();
4093
4167
  const local = { x, y };
4094
4168
  if (t.parent)
4095
- toInnerPoint$1(t.parent.__world, local, local, true);
4169
+ toInnerPoint$1(t.parent.worldTransform, local, local, true);
4096
4170
  L.moveLocal(t, local.x, local.y);
4097
4171
  },
4098
4172
  moveLocal(t, x, y = 0) {
4099
4173
  t.x += x;
4100
4174
  t.y += y;
4101
4175
  },
4102
- zoomOfWorld(t, origin, scaleX, scaleY, moveLayer) {
4103
- t.__layout.checkUpdate();
4104
- const local = t.parent ? PointHelper.tempToInnerOf(origin, t.parent.__world) : origin;
4105
- this.zoomOfLocal(t, local, scaleX, scaleY, moveLayer);
4176
+ zoomOfWorld(t, origin, scaleX, scaleY) {
4177
+ this.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY);
4106
4178
  },
4107
- zoomOfLocal(t, origin, scaleX, scaleY = scaleX, moveLayer) {
4179
+ zoomOfLocal(t, origin, scaleX, scaleY = scaleX) {
4108
4180
  copy$5(matrix, t.__local);
4109
- if (moveLayer)
4110
- translate$2(matrix, moveLayer.x, moveLayer.y);
4111
4181
  scaleOfOuter$3(matrix, origin, scaleX, scaleY);
4112
- if (!moveLayer)
4113
- moveLayer = t;
4114
- moveLayer.x += matrix.e - t.__local.e;
4115
- moveLayer.y += matrix.f - t.__local.f;
4182
+ moveByMatrix(t, matrix);
4116
4183
  t.scaleX *= scaleX;
4117
4184
  t.scaleY *= scaleY;
4118
4185
  },
4119
- rotateOfWorld(t, origin, angle, moveLayer) {
4120
- t.__layout.checkUpdate();
4121
- const local = t.parent ? PointHelper.tempToInnerOf(origin, t.parent.__world) : origin;
4122
- this.rotateOfLocal(t, local, angle, moveLayer);
4186
+ rotateOfWorld(t, origin, angle) {
4187
+ this.rotateOfLocal(t, getTempLocal(t, origin), angle);
4123
4188
  },
4124
- rotateOfLocal(t, origin, angle, moveLayer) {
4189
+ rotateOfLocal(t, origin, angle) {
4125
4190
  copy$5(matrix, t.__local);
4126
- if (moveLayer)
4127
- translate$2(matrix, moveLayer.x, moveLayer.y);
4128
4191
  rotateOfOuter$3(matrix, origin, angle);
4129
- if (!moveLayer)
4130
- moveLayer = t;
4131
- moveLayer.x += matrix.e - t.__local.e;
4132
- moveLayer.y += matrix.f - t.__local.f;
4192
+ moveByMatrix(t, matrix);
4133
4193
  t.rotation = MathHelper.formatRotation(t.rotation + angle);
4134
4194
  },
4135
- skewOfWorld(t, origin, skewX, skewY, moveLayer) {
4136
- t.__layout.checkUpdate();
4137
- const local = t.parent ? PointHelper.tempToInnerOf(origin, t.parent.__world) : origin;
4138
- this.skewOfLocal(t, local, skewX, skewY, moveLayer);
4195
+ skewOfWorld(t, origin, skewX, skewY) {
4196
+ this.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY);
4139
4197
  },
4140
- skewOfLocal(t, origin, skewX, skewY, moveLayer) {
4198
+ skewOfLocal(t, origin, skewX, skewY) {
4141
4199
  copy$5(matrix, t.__local);
4142
- if (moveLayer)
4143
- translate$2(matrix, moveLayer.x, moveLayer.y);
4144
4200
  skewOfOuter(matrix, origin, skewX, skewY);
4145
- if (!moveLayer)
4146
- moveLayer = t;
4147
- moveLayer.x = matrix.e - t.__local.e;
4148
- moveLayer.y = matrix.f - t.__local.f;
4201
+ moveByMatrix(t, matrix);
4149
4202
  t.skewX = MathHelper.formatSkew(t.skewX + skewX);
4150
4203
  t.skewY = MathHelper.formatSkew(t.skewY + skewY);
4151
4204
  },
@@ -4155,10 +4208,29 @@ var LeaferUI = (function (exports) {
4155
4208
  parent.worldToInner(position);
4156
4209
  t.set(position);
4157
4210
  parent.add(t);
4211
+ },
4212
+ hasParent(t, parent) {
4213
+ if (!parent)
4214
+ return false;
4215
+ let p = t;
4216
+ while (p) {
4217
+ if (parent === p)
4218
+ return true;
4219
+ p = p.parent;
4220
+ }
4221
+ return false;
4158
4222
  }
4159
4223
  };
4160
4224
  const L = LeafHelper;
4161
4225
  const { updateAllWorldMatrix: updateAllWorldMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity$1, updateAllChange: updateAllChange$1 } = L;
4226
+ function moveByMatrix(t, matrix) {
4227
+ t.x += matrix.e - t.__local.e;
4228
+ t.y += matrix.f - t.__local.f;
4229
+ }
4230
+ function getTempLocal(t, world) {
4231
+ t.__layout.checkUpdate();
4232
+ return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
4233
+ }
4162
4234
 
4163
4235
  const LeafBoundsHelper = {
4164
4236
  worldBounds(target) {
@@ -4320,7 +4392,8 @@ var LeaferUI = (function (exports) {
4320
4392
  };
4321
4393
  const I = InteractionHelper;
4322
4394
 
4323
- const { getDragEventData, getDropEventData, getSwipeEventData, filterPathByEventType } = InteractionHelper;
4395
+ const emptyList = new LeafList();
4396
+ const { getDragEventData, getDropEventData, getSwipeEventData } = InteractionHelper;
4324
4397
  class Dragger {
4325
4398
  constructor(interaction) {
4326
4399
  this.interaction = interaction;
@@ -4328,8 +4401,8 @@ var LeaferUI = (function (exports) {
4328
4401
  setDragData(data) {
4329
4402
  this.dragData = getDragEventData(data, data, data);
4330
4403
  }
4331
- getDragList() {
4332
- return this.dragging ? exports.DropEvent.dragList || this.dragList : null;
4404
+ getList() {
4405
+ return this.dragging ? (exports.DragEvent.list || this.interaction.selector.list || this.dragableList || emptyList) : emptyList;
4333
4406
  }
4334
4407
  checkDrag(data, canDrag) {
4335
4408
  const { interaction } = this;
@@ -4358,7 +4431,7 @@ var LeaferUI = (function (exports) {
4358
4431
  interaction.emit(exports.MoveEvent.MOVE, this.dragData);
4359
4432
  }
4360
4433
  else if (this.dragging) {
4361
- this.dragDragableList();
4434
+ this.realDrag();
4362
4435
  interaction.emit(exports.DragEvent.BEFORE_DRAG, this.dragData);
4363
4436
  interaction.emit(exports.DragEvent.DRAG, this.dragData);
4364
4437
  }
@@ -4369,9 +4442,6 @@ var LeaferUI = (function (exports) {
4369
4442
  if (this.dragging) {
4370
4443
  this.interaction.emit(exports.DragEvent.START, this.dragData);
4371
4444
  this.getDragableList(this.dragData.path);
4372
- this.dragList = filterPathByEventType(this.dragData.path, exports.DragEvent.DRAG);
4373
- if (!this.dragList.length && this.dragableList)
4374
- this.dragList.pushList(this.dragableList);
4375
4445
  }
4376
4446
  }
4377
4447
  }
@@ -4380,16 +4450,17 @@ var LeaferUI = (function (exports) {
4380
4450
  for (let i = 0, len = path.length; i < len; i++) {
4381
4451
  leaf = path.list[i];
4382
4452
  if (leaf.__.draggable && leaf.__.hitSelf) {
4383
- this.dragableList = [leaf];
4453
+ this.dragableList = new LeafList(leaf);
4384
4454
  break;
4385
4455
  }
4386
4456
  }
4387
4457
  }
4388
- dragDragableList() {
4458
+ realDrag() {
4389
4459
  const { running } = this.interaction;
4390
- if (this.dragableList && running) {
4460
+ const list = this.getList();
4461
+ if (list.length && running) {
4391
4462
  const { moveX, moveY } = this.dragData;
4392
- this.dragableList.forEach(leaf => {
4463
+ list.forEach(leaf => {
4393
4464
  LeafHelper.moveWorld(leaf, moveX, moveY);
4394
4465
  });
4395
4466
  }
@@ -4446,20 +4517,14 @@ var LeaferUI = (function (exports) {
4446
4517
  }
4447
4518
  }
4448
4519
  drop(data) {
4449
- const dropData = getDropEventData(data, this.getDragList(), exports.DropEvent.dragData);
4520
+ const dropData = getDropEventData(data, this.getList(), exports.DragEvent.data);
4450
4521
  dropData.path = this.dragEnterPath;
4451
4522
  this.interaction.emit(exports.DropEvent.DROP, dropData);
4452
4523
  this.interaction.emit(exports.DragEvent.LEAVE, data, this.dragEnterPath);
4453
4524
  }
4454
4525
  dragReset() {
4455
- exports.DropEvent.dragList = null;
4456
- this.dragList = null;
4457
- this.dragableList = null;
4458
- this.dragData = null;
4459
- this.dragOverPath = null;
4460
- this.dragEnterPath = null;
4461
- this.dragging = null;
4462
- this.moving = null;
4526
+ exports.DragEvent.list = exports.DragEvent.data = this.dragableList = this.dragData = this.dragOverPath = this.dragEnterPath = null;
4527
+ this.dragging = this.moving = false;
4463
4528
  }
4464
4529
  checkDragOut(data) {
4465
4530
  const { interaction } = this;
@@ -4695,6 +4760,10 @@ var LeaferUI = (function (exports) {
4695
4760
  this.zoom(getZoomEventData$1(center, scale, data));
4696
4761
  this.move(getMoveEventData$1(center, move, data));
4697
4762
  }
4763
+ menu(data) {
4764
+ this.findPath(data);
4765
+ this.emit(exports.PointerEvent.MENU, data);
4766
+ }
4698
4767
  move(data) {
4699
4768
  this.transformer.move(data);
4700
4769
  }
@@ -4804,6 +4873,9 @@ var LeaferUI = (function (exports) {
4804
4873
  data.path = find.path;
4805
4874
  return find.path;
4806
4875
  }
4876
+ isDrag(leaf) {
4877
+ return this.dragger.getList().has(leaf);
4878
+ }
4807
4879
  updateDownData(data) {
4808
4880
  if (!data)
4809
4881
  data = this.downData;
@@ -4817,7 +4889,7 @@ var LeaferUI = (function (exports) {
4817
4889
  data = this.hoverData;
4818
4890
  if (!data)
4819
4891
  return;
4820
- this.findPath(data, { exclude: this.dragger.getDragList(), name: exports.PointerEvent.MOVE });
4892
+ this.findPath(data, { exclude: this.dragger.getList(), name: exports.PointerEvent.MOVE });
4821
4893
  this.hoverData = data;
4822
4894
  }
4823
4895
  updateCursor(data) {
@@ -4937,7 +5009,7 @@ var LeaferUI = (function (exports) {
4937
5009
  this.renderBounds = this.strokeBounds = this.boxBounds = { x: 0, y: 0, width: 0, height: 0 };
4938
5010
  this.localRenderBounds = this.localStrokeBounds = leaf.__local;
4939
5011
  this.boxChange();
4940
- this.positionChange();
5012
+ this.matrixChange();
4941
5013
  }
4942
5014
  checkUpdate(force) {
4943
5015
  const { leafer } = this.leaf;
@@ -5064,11 +5136,6 @@ var LeaferUI = (function (exports) {
5064
5136
  this.renderSpread || (this.renderSpread = 1);
5065
5137
  this.boundsChanged = true;
5066
5138
  }
5067
- positionChange() {
5068
- this.positionChanged = true;
5069
- this.matrixChanged = true;
5070
- this.localBoxChanged || this.localBoxChange();
5071
- }
5072
5139
  scaleChange() {
5073
5140
  this.scaleChanged = true;
5074
5141
  this._scaleOrRotationChange();
@@ -5080,6 +5147,9 @@ var LeaferUI = (function (exports) {
5080
5147
  }
5081
5148
  _scaleOrRotationChange() {
5082
5149
  this.affectScaleOrRotation = true;
5150
+ this.matrixChange();
5151
+ }
5152
+ matrixChange() {
5083
5153
  this.matrixChanged = true;
5084
5154
  this.localBoxChanged || this.localBoxChange();
5085
5155
  }
@@ -5222,10 +5292,13 @@ var LeaferUI = (function (exports) {
5222
5292
  const LeafDataProxy = {
5223
5293
  __setAttr(name, newValue) {
5224
5294
  if (this.leafer && this.leafer.created) {
5225
- if (typeof newValue === 'object' || this.__.__getInput(name) !== newValue) {
5295
+ const oldValue = this.__.__getInput(name);
5296
+ if (typeof newValue === 'object' || oldValue !== newValue) {
5226
5297
  this.__[name] = newValue;
5298
+ if (this.proxyData)
5299
+ this.setProxyAttr(name, newValue);
5227
5300
  const { CHANGE } = PropertyEvent;
5228
- const event = new PropertyEvent(CHANGE, this, name, this.__.__get(name), newValue);
5301
+ const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
5229
5302
  if (this.hasEvent(CHANGE) && !this.isLeafer)
5230
5303
  this.emitEvent(event);
5231
5304
  this.leafer.emitEvent(event);
@@ -5233,10 +5306,21 @@ var LeaferUI = (function (exports) {
5233
5306
  }
5234
5307
  else {
5235
5308
  this.__[name] = newValue;
5309
+ if (this.proxyData)
5310
+ this.setProxyAttr(name, newValue);
5236
5311
  }
5237
5312
  },
5238
5313
  __getAttr(name) {
5314
+ if (this.proxyData)
5315
+ return this.getProxyAttr(name);
5239
5316
  return this.__.__get(name);
5317
+ },
5318
+ setProxyAttr(name, newValue) {
5319
+ if (this.proxyData[name] !== newValue)
5320
+ this.proxyData[name] = newValue;
5321
+ },
5322
+ getProxyAttr(name) {
5323
+ return this.proxyData[name];
5240
5324
  }
5241
5325
  };
5242
5326
 
@@ -5316,17 +5400,17 @@ var LeaferUI = (function (exports) {
5316
5400
  }
5317
5401
  }
5318
5402
  }
5319
- if (layout.positionChanged) {
5320
- r.e = this.__.x;
5321
- r.f = this.__.y;
5322
- const { width, height, around } = this.__;
5323
- if (around && width && height) {
5403
+ const { x, y, around } = this.__;
5404
+ r.e = x;
5405
+ r.f = y;
5406
+ if (around) {
5407
+ const { width, height } = this.__;
5408
+ if (width && height) {
5324
5409
  const origin = (around === 'center') ? defaultCenter : around;
5325
5410
  const offsetX = width * origin.x, offsetY = height * origin.y;
5326
5411
  r.e -= offsetX * r.a + offsetY * r.c;
5327
5412
  r.f -= offsetX * r.b + offsetY * r.d;
5328
5413
  }
5329
- layout.positionChanged = false;
5330
5414
  }
5331
5415
  this.__layout.matrixChanged = false;
5332
5416
  }
@@ -5421,7 +5505,7 @@ var LeaferUI = (function (exports) {
5421
5505
  data.__naturalWidth = layout.boxBounds.width;
5422
5506
  data.__naturalHeight = layout.boxBounds.height;
5423
5507
  if (this.around) {
5424
- layout.positionChanged = layout.matrixChanged = true;
5508
+ layout.matrixChanged = true;
5425
5509
  this.__updateWorldMatrix();
5426
5510
  }
5427
5511
  },
@@ -5446,6 +5530,10 @@ var LeaferUI = (function (exports) {
5446
5530
  setRadius(point, this.__.hitRadius);
5447
5531
  }
5448
5532
  toInnerRadiusPointOf(point, this.__world, inner);
5533
+ if (this.__.hitBox) {
5534
+ if (BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner))
5535
+ return true;
5536
+ }
5449
5537
  return this.__hit(inner);
5450
5538
  },
5451
5539
  __drawHitPath(canvas) {
@@ -5489,12 +5577,21 @@ var LeaferUI = (function (exports) {
5489
5577
  __updateMask(value) {
5490
5578
  this.__hasMask = value ? true : this.children.some(item => item.__.isMask);
5491
5579
  },
5492
- __renderMask(canvas, content, mask) {
5580
+ __renderMask(canvas, content, mask, recycle) {
5581
+ content.opacity = 1;
5493
5582
  content.resetTransform();
5494
5583
  content.useMask(mask);
5495
- canvas.resetTransform();
5496
5584
  canvas.opacity = this.__worldOpacity;
5585
+ canvas.resetTransform();
5497
5586
  canvas.copyWorld(content);
5587
+ if (recycle) {
5588
+ content.recycle();
5589
+ mask.recycle();
5590
+ }
5591
+ else {
5592
+ content.clear();
5593
+ mask.clear();
5594
+ }
5498
5595
  },
5499
5596
  __removeMask(child) {
5500
5597
  if (child) {
@@ -5549,15 +5646,13 @@ var LeaferUI = (function (exports) {
5549
5646
  const { children } = this;
5550
5647
  if (this.__hasMask && children.length > 1) {
5551
5648
  let mask;
5552
- let maskCanvas = canvas.getSameCanvas();
5553
- let contentCanvas = canvas.getSameCanvas();
5649
+ const maskCanvas = canvas.getSameCanvas();
5650
+ const contentCanvas = canvas.getSameCanvas();
5554
5651
  for (let i = 0, len = children.length; i < len; i++) {
5555
5652
  child = children[i];
5556
5653
  if (child.isMask) {
5557
5654
  if (mask) {
5558
5655
  this.__renderMask(canvas, contentCanvas, maskCanvas);
5559
- maskCanvas.clear();
5560
- contentCanvas.clear();
5561
5656
  }
5562
5657
  else {
5563
5658
  mask = true;
@@ -5565,11 +5660,9 @@ var LeaferUI = (function (exports) {
5565
5660
  child.__render(maskCanvas, options);
5566
5661
  continue;
5567
5662
  }
5568
- child.__render(contentCanvas, options);
5663
+ child.__render(mask ? contentCanvas : canvas, options);
5569
5664
  }
5570
- this.__renderMask(canvas, contentCanvas, maskCanvas);
5571
- maskCanvas.recycle();
5572
- contentCanvas.recycle();
5665
+ this.__renderMask(canvas, contentCanvas, maskCanvas, true);
5573
5666
  }
5574
5667
  else {
5575
5668
  const { bounds, hideBounds } = options;
@@ -5609,11 +5702,16 @@ var LeaferUI = (function (exports) {
5609
5702
  get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
5610
5703
  constructor(data) {
5611
5704
  this.innerId = create(LEAF);
5705
+ this.reset(data);
5706
+ }
5707
+ reset(data) {
5612
5708
  this.__world = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0, scaleX: 1, scaleY: 1, rotation: 0, skewX: 0, skewY: 0 };
5613
5709
  this.__local = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0 };
5614
5710
  this.__worldOpacity = 1;
5615
5711
  this.__ = new this.__DataProcessor(this);
5616
5712
  this.__layout = new this.__LayoutProcessor(this);
5713
+ if (this.__level)
5714
+ this.resetCustom();
5617
5715
  if (data) {
5618
5716
  if (data.children) {
5619
5717
  this.set(data);
@@ -5623,6 +5721,10 @@ var LeaferUI = (function (exports) {
5623
5721
  }
5624
5722
  }
5625
5723
  }
5724
+ resetCustom() {
5725
+ this.__hasMask = this.__hasEraser = null;
5726
+ this.forceUpdate();
5727
+ }
5626
5728
  waitParent(item) {
5627
5729
  this.parent ? item() : (this.__parentWait ? this.__parentWait.push(item) : this.__parentWait = [item]);
5628
5730
  }
@@ -5637,8 +5739,11 @@ var LeaferUI = (function (exports) {
5637
5739
  if (leafer !== null)
5638
5740
  leafer = this;
5639
5741
  }
5742
+ if (this.leafer && !leafer)
5743
+ this.leafer.leafs--;
5640
5744
  this.leafer = leafer;
5641
5745
  if (leafer) {
5746
+ leafer.leafs++;
5642
5747
  this.__level = this.parent ? this.parent.__level + 1 : 1;
5643
5748
  if (this.__leaferWait)
5644
5749
  WaitHelper.run(this.__leaferWait);
@@ -5651,6 +5756,7 @@ var LeaferUI = (function (exports) {
5651
5756
  }
5652
5757
  }
5653
5758
  set(_data) { }
5759
+ get(_options) { return undefined; }
5654
5760
  toJSON() {
5655
5761
  return this.__.__getInputData();
5656
5762
  }
@@ -5659,9 +5765,13 @@ var LeaferUI = (function (exports) {
5659
5765
  }
5660
5766
  __setAttr(_attrName, _newValue) { }
5661
5767
  __getAttr(_attrName) { return undefined; }
5768
+ setProxyAttr(_attrName, _newValue) { }
5769
+ getProxyAttr(_attrName) { return undefined; }
5770
+ find(_condition) { return undefined; }
5771
+ findOne(_condition) { return undefined; }
5662
5772
  forceUpdate(attrName) {
5663
5773
  if (attrName === undefined)
5664
- attrName = 'scaleX';
5774
+ attrName = 'width';
5665
5775
  else if (attrName === 'surface')
5666
5776
  attrName = 'blendMode';
5667
5777
  const value = this.__.__getInput(attrName);
@@ -5683,7 +5793,7 @@ var LeaferUI = (function (exports) {
5683
5793
  __onUpdateSize() { }
5684
5794
  __updateEraser(_value) { }
5685
5795
  __updateMask(_value) { }
5686
- __renderMask(_canvas, _content, _mask) { }
5796
+ __renderMask(_canvas, _content, _mask, _recycle) { }
5687
5797
  __removeMask(_child) { }
5688
5798
  getWorld(attrName) {
5689
5799
  this.__layout.checkUpdate();
@@ -5868,7 +5978,7 @@ var LeaferUI = (function (exports) {
5868
5978
  index === undefined ? this.children.push(child) : this.children.splice(index, 0, child);
5869
5979
  if (child.isBranch)
5870
5980
  this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
5871
- child.__layout.boundsChanged || child.__layout.positionChange();
5981
+ child.__layout.boundsChanged || child.__layout.matrixChange();
5872
5982
  if (child.__parentWait)
5873
5983
  WaitHelper.run(child.__parentWait);
5874
5984
  if (this.leafer) {
@@ -6087,7 +6197,7 @@ var LeaferUI = (function (exports) {
6087
6197
  let layout;
6088
6198
  updateList.list.forEach(leaf => {
6089
6199
  layout = leaf.__layout;
6090
- if (levelList.without(leaf) && !layout.useZoomProxy) {
6200
+ if (levelList.without(leaf) && !layout.proxyZoom) {
6091
6201
  if (layout.matrixChanged) {
6092
6202
  updateAllWorldMatrix$1(leaf);
6093
6203
  levelList.push(leaf);
@@ -6406,8 +6516,7 @@ var LeaferUI = (function (exports) {
6406
6516
  const { canvas, updateBlocks: list } = this;
6407
6517
  if (!list)
6408
6518
  return debug$4.warn('PartRender: need update attr');
6409
- if (list.some(block => block.includes(this.target.__world)))
6410
- this.mergeBlocks();
6519
+ this.mergeBlocks();
6411
6520
  list.forEach(block => { if (canvas.bounds.hit(block) && !block.isEmpty())
6412
6521
  this.clipRender(block); });
6413
6522
  }
@@ -6426,7 +6535,7 @@ var LeaferUI = (function (exports) {
6426
6535
  canvas.clearWorld(bounds, true);
6427
6536
  canvas.clipWorld(bounds, true);
6428
6537
  }
6429
- this.__render(bounds, realBounds);
6538
+ this.__render(bounds, includes, realBounds);
6430
6539
  canvas.restore();
6431
6540
  Run.end(t);
6432
6541
  }
@@ -6435,12 +6544,12 @@ var LeaferUI = (function (exports) {
6435
6544
  const { canvas } = this;
6436
6545
  canvas.save();
6437
6546
  canvas.clear();
6438
- this.__render(canvas.bounds);
6547
+ this.__render(canvas.bounds, true);
6439
6548
  canvas.restore();
6440
6549
  Run.end(t);
6441
6550
  }
6442
- __render(bounds, realBounds) {
6443
- const options = (bounds === null || bounds === void 0 ? void 0 : bounds.includes(this.target.__world)) ? {} : { bounds };
6551
+ __render(bounds, includes, realBounds) {
6552
+ const options = bounds.includes(this.target.__world) ? { includes } : { bounds, includes };
6444
6553
  if (this.needFill)
6445
6554
  this.canvas.fillWorld(bounds, this.config.fill);
6446
6555
  if (Debug.showRepaint)
@@ -6541,7 +6650,7 @@ var LeaferUI = (function (exports) {
6541
6650
  }
6542
6651
 
6543
6652
  const { hitRadiusPoint } = BoundsHelper;
6544
- class FindPath {
6653
+ class Pather {
6545
6654
  constructor(target, selector) {
6546
6655
  this.target = target;
6547
6656
  this.selector = selector;
@@ -6661,117 +6770,108 @@ var LeaferUI = (function (exports) {
6661
6770
  class Selector {
6662
6771
  constructor(target, userConfig) {
6663
6772
  this.config = {};
6664
- this.innerIdList = {};
6665
- this.idList = {};
6666
- this.classNameList = {};
6667
- this.tagNameList = {};
6773
+ this.innerIdMap = {};
6774
+ this.idMap = {};
6775
+ this.methods = {
6776
+ id: (leaf, name) => leaf.id === name ? this.idMap[name] = leaf : 0,
6777
+ innerId: (leaf, innerId) => leaf.innerId === innerId ? this.innerIdMap[innerId] = leaf : 0,
6778
+ className: (leaf, name) => leaf.className === name ? 1 : 0,
6779
+ tag: (leaf, name) => leaf.__tag === name ? 1 : 0
6780
+ };
6668
6781
  this.target = target;
6669
6782
  if (userConfig)
6670
6783
  this.config = DataHelper.default(userConfig, this.config);
6671
- this.findPath = new FindPath(target, this);
6784
+ this.pather = new Pather(target, this);
6672
6785
  this.__listenEvents();
6673
6786
  }
6674
6787
  getByPoint(hitPoint, hitRadius, options) {
6675
6788
  if (Platform.name === 'node')
6676
6789
  this.target.emit(LayoutEvent.CHECK_UPDATE);
6677
- return this.findPath.getByPoint(hitPoint, hitRadius, options);
6678
- }
6679
- find(name, branch) {
6680
- if (typeof name === 'number') {
6681
- return this.getByInnerId(name, branch);
6682
- }
6683
- else if (name.startsWith('#')) {
6684
- return this.getById(name.substring(1), branch);
6685
- }
6686
- else if (name.startsWith('.')) {
6687
- return this.getByClassName(name.substring(1), branch);
6688
- }
6689
- else {
6690
- return this.getByTagName(name, branch);
6790
+ return this.pather.getByPoint(hitPoint, hitRadius, options);
6791
+ }
6792
+ getBy(condition, branch, one, options) {
6793
+ switch (typeof condition) {
6794
+ case 'number':
6795
+ const leaf = this.getByInnerId(condition, branch);
6796
+ return one ? leaf : (leaf ? [leaf] : []);
6797
+ case 'string':
6798
+ switch (condition[0]) {
6799
+ case '#':
6800
+ const leaf = this.getById(condition.substring(1), branch);
6801
+ return one ? leaf : (leaf ? [leaf] : []);
6802
+ case '.':
6803
+ return this.getByMethod(this.methods.className, branch, one, condition.substring(1));
6804
+ default:
6805
+ return this.getByMethod(this.methods.tag, branch, one, condition);
6806
+ }
6807
+ case 'function':
6808
+ return this.getByMethod(condition, branch, one, options);
6691
6809
  }
6692
6810
  }
6693
- getByInnerId(name, branch) {
6694
- let cache = this.innerIdList[name];
6811
+ getByInnerId(innerId, branch) {
6812
+ const cache = this.innerIdMap[innerId];
6695
6813
  if (cache)
6696
6814
  return cache;
6697
- if (!branch)
6698
- branch = this.target;
6699
- let find;
6700
- this.loopFind(branch, (leaf) => {
6701
- if (leaf.innerId === name) {
6702
- find = leaf;
6703
- this.innerIdList[name] = find;
6704
- return true;
6705
- }
6706
- else {
6707
- return false;
6708
- }
6709
- });
6710
- return find;
6815
+ this.eachFind(this.toChildren(branch), this.methods.innerId, null, innerId);
6816
+ return this.findLeaf;
6711
6817
  }
6712
- getById(name, branch) {
6713
- let cache = this.idList[name];
6714
- if (cache)
6818
+ getById(id, branch) {
6819
+ const cache = this.idMap[id];
6820
+ if (cache && LeafHelper.hasParent(cache, branch || this.target))
6715
6821
  return cache;
6716
- if (!branch)
6717
- branch = this.target;
6718
- let find;
6719
- this.loopFind(branch, (leaf) => {
6720
- if (leaf.id === name) {
6721
- find = leaf;
6722
- this.idList[name] = find;
6723
- return true;
6724
- }
6725
- else {
6726
- return false;
6727
- }
6728
- });
6729
- return find;
6822
+ this.eachFind(this.toChildren(branch), this.methods.id, null, id);
6823
+ return this.findLeaf;
6730
6824
  }
6731
- getByClassName(name, branch) {
6732
- if (!branch)
6733
- branch = this.target;
6734
- let find = [];
6735
- this.loopFind(branch, (leaf) => {
6736
- if (leaf.className === name)
6737
- find.push(leaf);
6738
- return false;
6739
- });
6740
- return find;
6825
+ getByClassName(className, branch) {
6826
+ return this.getByMethod(this.methods.className, branch, false, className);
6741
6827
  }
6742
- getByTagName(name, branch) {
6743
- if (!branch)
6744
- branch = this.target;
6745
- let find = [];
6746
- this.loopFind(branch, (leaf) => {
6747
- if (leaf.__tag === name)
6748
- find.push(leaf);
6749
- return false;
6750
- });
6751
- return find;
6828
+ getByTag(tag, branch) {
6829
+ return this.getByMethod(this.methods.tag, branch, false, tag);
6752
6830
  }
6753
- loopFind(branch, find) {
6754
- if (find(branch))
6755
- return;
6756
- const { children } = branch;
6831
+ getByMethod(method, branch, one, options) {
6832
+ const list = one ? null : [];
6833
+ this.eachFind(this.toChildren(branch), method, list, options);
6834
+ return list || this.findLeaf;
6835
+ }
6836
+ eachFind(children, method, list, options) {
6837
+ let child;
6757
6838
  for (let i = 0, len = children.length; i < len; i++) {
6758
- branch = children[i];
6759
- if (find(branch))
6760
- return;
6761
- if (branch.isBranch)
6762
- this.loopFind(branch, find);
6839
+ child = children[i];
6840
+ if (method(child, options)) {
6841
+ if (list) {
6842
+ list.push(child);
6843
+ }
6844
+ else {
6845
+ this.findLeaf = child;
6846
+ return;
6847
+ }
6848
+ }
6849
+ if (child.isBranch)
6850
+ this.eachFind(child.children, method, list, options);
6763
6851
  }
6764
6852
  }
6853
+ toChildren(branch) {
6854
+ this.findLeaf = null;
6855
+ return [branch || this.target];
6856
+ }
6765
6857
  __onRemoveChild(event) {
6766
- const target = event.target;
6767
- if (this.idList[target.id])
6768
- this.idList[target.id] = null;
6769
- if (this.innerIdList[target.id])
6770
- this.innerIdList[target.innerId] = null;
6858
+ const { id, innerId } = event.child;
6859
+ if (this.idMap[id])
6860
+ delete this.idMap[id];
6861
+ if (this.innerIdMap[innerId])
6862
+ delete this.innerIdMap[innerId];
6863
+ }
6864
+ __checkIdChange(event) {
6865
+ if (event.attrName === 'id') {
6866
+ const id = event.oldValue;
6867
+ if (this.idMap[id])
6868
+ delete this.idMap[id];
6869
+ }
6771
6870
  }
6772
6871
  __listenEvents() {
6773
6872
  this.__eventIds = [
6774
- this.target.on_(ChildEvent.REMOVE, this.__onRemoveChild, this)
6873
+ this.target.on_(ChildEvent.REMOVE, this.__onRemoveChild, this),
6874
+ this.target.on_(PropertyEvent.CHANGE, this.__checkIdChange, this)
6775
6875
  ];
6776
6876
  }
6777
6877
  __removeListenEvents() {
@@ -6781,11 +6881,10 @@ var LeaferUI = (function (exports) {
6781
6881
  destroy() {
6782
6882
  if (this.__eventIds.length) {
6783
6883
  this.__removeListenEvents();
6784
- this.findPath.destroy();
6785
- this.innerIdList = {};
6786
- this.idList = {};
6787
- this.classNameList = {};
6788
- this.tagNameList = {};
6884
+ this.pather.destroy();
6885
+ this.findLeaf = null;
6886
+ this.innerIdMap = {};
6887
+ this.idMap = {};
6789
6888
  }
6790
6889
  }
6791
6890
  }
@@ -7007,7 +7106,7 @@ var LeaferUI = (function (exports) {
7007
7106
  let { zoomMode, zoomSpeed } = config;
7008
7107
  const delta = e.deltaY || e.deltaX;
7009
7108
  if (zoomMode) {
7010
- zoom = !e.deltaX && (Platform.intWheelDeltaY ? Math.abs(delta) > 17 : Math.ceil(delta) !== delta);
7109
+ zoom = (zoomMode === 'mouse') ? true : (!e.deltaX && (Platform.intWheelDeltaY ? Math.abs(delta) > 17 : Math.ceil(delta) !== delta));
7011
7110
  if (e.shiftKey || e.metaKey || e.ctrlKey)
7012
7111
  zoom = true;
7013
7112
  }
@@ -7044,6 +7143,7 @@ var LeaferUI = (function (exports) {
7044
7143
  'pointerdown': this.onPointerDown,
7045
7144
  'mousedown': this.onMouseDown,
7046
7145
  'touchstart': this.onTouchStart,
7146
+ 'contextmenu': this.onContextMenu,
7047
7147
  'wheel': this.onWheel,
7048
7148
  'gesturestart': this.onGesturestart,
7049
7149
  'gesturechange': this.onGesturechange,
@@ -7116,6 +7216,9 @@ var LeaferUI = (function (exports) {
7116
7216
  onKeyUp(e) {
7117
7217
  this.keyUp(KeyEventHelper.convert(e));
7118
7218
  }
7219
+ onContextMenu(e) {
7220
+ this.menu(PointerEventHelper.convert(e, this.getLocal(e)));
7221
+ }
7119
7222
  onScroll() {
7120
7223
  this.canvas.updateClientBounds();
7121
7224
  }
@@ -7320,6 +7423,11 @@ var LeaferUI = (function (exports) {
7320
7423
  });
7321
7424
  }
7322
7425
  };
7426
+ Platform.event = {
7427
+ stopDefault(origin) { origin.preventDefault(); },
7428
+ stopNow(origin) { origin.stopImmediatePropagation(); },
7429
+ stop(origin) { origin.stopPropagation(); }
7430
+ };
7323
7431
  Platform.canvas = Creator.canvas();
7324
7432
  Platform.conicGradientSupport = !!Platform.canvas.context.createConicGradient;
7325
7433
  }
@@ -7356,7 +7464,7 @@ var LeaferUI = (function (exports) {
7356
7464
  function design(leafer) {
7357
7465
  if (leafer.isApp)
7358
7466
  return;
7359
- leafer.__eventIds.push(leafer.on_(exports.MoveEvent.BEFORE_MOVE, (e) => { LeafHelper.moveWorld(leafer.moveLayer, e.moveX, e.moveY); }), leafer.on_(exports.ZoomEvent.BEFORE_ZOOM, (e) => {
7467
+ leafer.__eventIds.push(leafer.on_(exports.MoveEvent.BEFORE_MOVE, (e) => { LeafHelper.moveWorld(leafer.zoomLayer, e.moveX, e.moveY); }), leafer.on_(exports.ZoomEvent.BEFORE_ZOOM, (e) => {
7360
7468
  const { scaleX } = leafer.zoomLayer.__, { min, max } = leafer.config.zoom;
7361
7469
  let { scale } = e;
7362
7470
  if (scale * Math.abs(scaleX) < min)
@@ -7437,6 +7545,8 @@ var LeaferUI = (function (exports) {
7437
7545
  this.__removeInput('fill');
7438
7546
  Paint.recycleImage('fill', this);
7439
7547
  this.__isFills = false;
7548
+ if (this.__pixelFill)
7549
+ this.__pixelFill = false;
7440
7550
  }
7441
7551
  this._fill = value;
7442
7552
  }
@@ -7453,6 +7563,8 @@ var LeaferUI = (function (exports) {
7453
7563
  this.__removeInput('stroke');
7454
7564
  Paint.recycleImage('stroke', this);
7455
7565
  this.__isStrokes = false;
7566
+ if (this.__pixelStroke)
7567
+ this.__pixelStroke = false;
7456
7568
  }
7457
7569
  this._stroke = value;
7458
7570
  }
@@ -7750,9 +7862,9 @@ var LeaferUI = (function (exports) {
7750
7862
  const { fill, stroke } = this.__;
7751
7863
  this.__drawRenderPath(canvas);
7752
7864
  if (fill)
7753
- Paint.fill('#000000', this, canvas);
7865
+ this.__.__pixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
7754
7866
  if (stroke)
7755
- Paint.stroke('#000000', this, canvas, renderOptions);
7867
+ this.__.__pixelStroke ? Paint.strokes(stroke, this, canvas, renderOptions) : Paint.stroke('#000000', this, canvas, renderOptions);
7756
7868
  }
7757
7869
  };
7758
7870
 
@@ -7799,14 +7911,19 @@ var LeaferUI = (function (exports) {
7799
7911
  const { scaleX, scaleY } = this;
7800
7912
  return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
7801
7913
  }
7802
- constructor(data) {
7803
- super(data);
7804
- }
7914
+ reset(_data) { }
7805
7915
  set(data) {
7806
7916
  Object.assign(this, data);
7807
7917
  }
7808
- get() {
7809
- return this.__.__getInputData();
7918
+ get(options) {
7919
+ return this.__.__getInputData(options);
7920
+ }
7921
+ getProxyData() { return undefined; }
7922
+ find(condition) {
7923
+ return this.leafer ? this.leafer.selector.getBy(condition, this) : [];
7924
+ }
7925
+ findOne(condition) {
7926
+ return this.leafer ? this.leafer.selector.getBy(condition, this, true) : null;
7810
7927
  }
7811
7928
  getPath(curve) {
7812
7929
  const path = this.__.path;
@@ -7930,6 +8047,9 @@ var LeaferUI = (function (exports) {
7930
8047
  __decorate([
7931
8048
  strokeType('path')
7932
8049
  ], exports.UI.prototype, "hitStroke", void 0);
8050
+ __decorate([
8051
+ hitType(false)
8052
+ ], exports.UI.prototype, "hitBox", void 0);
7933
8053
  __decorate([
7934
8054
  hitType(true)
7935
8055
  ], exports.UI.prototype, "hitChildren", void 0);
@@ -7990,6 +8110,9 @@ var LeaferUI = (function (exports) {
7990
8110
  __decorate([
7991
8111
  effectType()
7992
8112
  ], exports.UI.prototype, "grayscale", void 0);
8113
+ __decorate([
8114
+ rewrite(exports.Leaf.prototype.reset)
8115
+ ], exports.UI.prototype, "reset", null);
7993
8116
  __decorate([
7994
8117
  rewrite(PathDrawer.drawPathByData)
7995
8118
  ], exports.UI.prototype, "__drawPathByData", null);
@@ -8027,8 +8150,12 @@ var LeaferUI = (function (exports) {
8027
8150
  if (data.children) {
8028
8151
  const { children } = data;
8029
8152
  delete data.children;
8030
- if (!this.children)
8153
+ if (!this.children) {
8031
8154
  this.__setBranch();
8155
+ }
8156
+ else {
8157
+ this.removeAll(true);
8158
+ }
8032
8159
  super.set(data);
8033
8160
  let child;
8034
8161
  children.forEach(childData => {
@@ -8229,8 +8356,10 @@ var LeaferUI = (function (exports) {
8229
8356
  ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
8230
8357
  moveTo$3(path, width, ry);
8231
8358
  }
8232
- ellipse(path, rx, ry, rx, ry, 0, 0, 360, true);
8359
+ ellipse(path, rx, ry, rx, ry, 0, 360, 0, true);
8233
8360
  }
8361
+ if (Platform.ellipseToCurve)
8362
+ this.__.path = PathConvert.toCanvasData(path, true);
8234
8363
  }
8235
8364
  else {
8236
8365
  if (startAngle || endAngle) {
@@ -8540,7 +8669,7 @@ var LeaferUI = (function (exports) {
8540
8669
  registerUI()
8541
8670
  ], exports.Canvas);
8542
8671
 
8543
- const { copyAndSpread, includes, spread } = BoundsHelper;
8672
+ const { copyAndSpread, includes, spread, setByList } = BoundsHelper;
8544
8673
  exports.Text = class Text extends exports.UI {
8545
8674
  get __tag() { return 'Text'; }
8546
8675
  get textDrawData() {
@@ -8574,18 +8703,19 @@ var LeaferUI = (function (exports) {
8574
8703
  __updateBoxBounds() {
8575
8704
  const data = this.__;
8576
8705
  const layout = this.__layout;
8577
- const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase } = data;
8706
+ const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow } = data;
8707
+ const width = data.__getInput('width');
8708
+ const height = data.__getInput('height');
8578
8709
  data.__lineHeight = UnitConvert.number(lineHeight, fontSize);
8579
8710
  data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
8580
8711
  data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
8581
8712
  data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
8713
+ data.__clipText = textOverflow !== 'show' && (width || height);
8582
8714
  this.__updateTextDrawData();
8583
8715
  const { bounds } = data.__textDrawData;
8584
8716
  const b = layout.boxBounds;
8585
8717
  if (data.__lineHeight < fontSize)
8586
8718
  spread(bounds, fontSize / 2);
8587
- const width = data.__getInput('width');
8588
- const height = data.__getInput('height');
8589
8719
  if (width && height) {
8590
8720
  super.__updateBoxBounds();
8591
8721
  }
@@ -8600,6 +8730,10 @@ var LeaferUI = (function (exports) {
8600
8730
  if (contentBounds !== layout.contentBounds) {
8601
8731
  layout.contentBounds = contentBounds;
8602
8732
  layout.renderChanged = true;
8733
+ setByList(data.__textBoxBounds = {}, [b, bounds]);
8734
+ }
8735
+ else {
8736
+ data.__textBoxBounds = contentBounds;
8603
8737
  }
8604
8738
  }
8605
8739
  __updateRenderSpread() {
@@ -8609,7 +8743,7 @@ var LeaferUI = (function (exports) {
8609
8743
  return width;
8610
8744
  }
8611
8745
  __updateRenderBounds() {
8612
- copyAndSpread(this.__layout.renderBounds, this.__layout.contentBounds, this.__layout.renderSpread);
8746
+ copyAndSpread(this.__layout.renderBounds, this.__.__textBoxBounds, this.__layout.renderSpread);
8613
8747
  }
8614
8748
  };
8615
8749
  __decorate([
@@ -8627,6 +8761,9 @@ var LeaferUI = (function (exports) {
8627
8761
  __decorate([
8628
8762
  affectStrokeBoundsType('outside')
8629
8763
  ], exports.Text.prototype, "strokeAlign", void 0);
8764
+ __decorate([
8765
+ hitType('all')
8766
+ ], exports.Text.prototype, "hitFill", void 0);
8630
8767
  __decorate([
8631
8768
  boundsType('')
8632
8769
  ], exports.Text.prototype, "text", void 0);
@@ -8666,6 +8803,9 @@ var LeaferUI = (function (exports) {
8666
8803
  __decorate([
8667
8804
  boundsType('top')
8668
8805
  ], exports.Text.prototype, "verticalAlign", void 0);
8806
+ __decorate([
8807
+ boundsType('normal')
8808
+ ], exports.Text.prototype, "textWrap", void 0);
8669
8809
  __decorate([
8670
8810
  boundsType('show')
8671
8811
  ], exports.Text.prototype, "textOverflow", void 0);
@@ -8751,10 +8891,10 @@ var LeaferUI = (function (exports) {
8751
8891
  get __tag() { return 'Leafer'; }
8752
8892
  get isApp() { return false; }
8753
8893
  get app() { return this.parent || this; }
8894
+ get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
8754
8895
  constructor(userConfig, data) {
8755
8896
  super(data);
8756
8897
  this.zoomLayer = this;
8757
- this.moveLayer = this;
8758
8898
  this.config = {
8759
8899
  type: 'design',
8760
8900
  start: true,
@@ -8770,6 +8910,7 @@ var LeaferUI = (function (exports) {
8770
8910
  autoDistance: 2
8771
8911
  }
8772
8912
  };
8913
+ this.leafs = 0;
8773
8914
  this.__eventIds = [];
8774
8915
  this.__controllers = [];
8775
8916
  this.__readyWait = [];
@@ -8883,9 +9024,8 @@ var LeaferUI = (function (exports) {
8883
9024
  this.isLeafer = !!leafer;
8884
9025
  this.__level = 1;
8885
9026
  }
8886
- setZoomLayer(zoomLayer, moveLayer) {
9027
+ setZoomLayer(zoomLayer) {
8887
9028
  this.zoomLayer = zoomLayer;
8888
- this.moveLayer = moveLayer || zoomLayer;
8889
9029
  }
8890
9030
  __checkAutoLayout(config) {
8891
9031
  if (!config.width || !config.height) {
@@ -9393,10 +9533,14 @@ var LeaferUI = (function (exports) {
9393
9533
  createPattern(ui, paint, canvas.pixelRatio);
9394
9534
  }
9395
9535
  else {
9396
- ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
9397
- if (canvas.bounds.hit(ui.__world) && createPattern(ui, paint, canvas.pixelRatio))
9536
+ if (!paint.patternTask) {
9537
+ paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
9538
+ paint.patternTask = null;
9539
+ if (canvas.bounds.hit(ui.__world))
9540
+ createPattern(ui, paint, canvas.pixelRatio);
9398
9541
  ui.forceUpdate('surface');
9399
- }), 300);
9542
+ }), 300);
9543
+ }
9400
9544
  }
9401
9545
  return false;
9402
9546
  }
@@ -9760,17 +9904,30 @@ var LeaferUI = (function (exports) {
9760
9904
  let recycleMap;
9761
9905
  function compute(attrName, ui) {
9762
9906
  const value = [];
9907
+ const data = ui.__;
9763
9908
  let item;
9764
- let paints = ui.__.__input[attrName];
9909
+ let paints = data.__input[attrName];
9765
9910
  if (!(paints instanceof Array))
9766
9911
  paints = [paints];
9767
- recycleMap = recycleImage(attrName, ui.__);
9912
+ recycleMap = recycleImage(attrName, data);
9768
9913
  for (let i = 0, len = paints.length; i < len; i++) {
9769
9914
  item = getLeafPaint(attrName, paints[i], ui);
9770
9915
  if (item)
9771
9916
  value.push(item);
9772
9917
  }
9773
- ui.__['_' + attrName] = value.length ? value : undefined;
9918
+ data['_' + attrName] = value.length ? value : undefined;
9919
+ let isPixel;
9920
+ if (paints.length === 1) {
9921
+ const paint = paints[0];
9922
+ if (paint.type === 'image')
9923
+ isPixel = ImageManager.isPixel(paint);
9924
+ }
9925
+ if (attrName === 'fill') {
9926
+ data.__pixelFill = isPixel;
9927
+ }
9928
+ else {
9929
+ data.__pixelStroke = isPixel;
9930
+ }
9774
9931
  }
9775
9932
  function getLeafPaint(attrName, paint, ui) {
9776
9933
  if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
@@ -10045,6 +10202,8 @@ var LeaferUI = (function (exports) {
10045
10202
  const { width, height } = bounds;
10046
10203
  const charMode = width || height || __letterSpacing || (textCase !== 'none');
10047
10204
  if (charMode) {
10205
+ const wrap = style.textWrap !== 'none';
10206
+ const breakAll = style.textWrap === 'break';
10048
10207
  paraStart = true;
10049
10208
  lastCharType = null;
10050
10209
  startCharSize = charWidth = charSize = wordWidth = rowWidth = 0;
@@ -10071,16 +10230,23 @@ var LeaferUI = (function (exports) {
10071
10230
  langBreak = (charType === Single && (lastCharType === Single || lastCharType === Letter)) || (lastCharType === Single && charType !== After);
10072
10231
  afterBreak = ((charType === Before || charType === Single) && (lastCharType === Symbol || lastCharType === After));
10073
10232
  realWidth = paraStart && paraIndent ? width - paraIndent : width;
10074
- if (width && rowWidth + wordWidth + charWidth > realWidth) {
10075
- if (!afterBreak)
10076
- afterBreak = charType === Letter && lastCharType == After;
10077
- if (langBreak || afterBreak || charType === Break || charType === Before || charType === Single || (wordWidth + charWidth > realWidth)) {
10233
+ if (wrap && (width && rowWidth + wordWidth + charWidth > realWidth)) {
10234
+ if (breakAll) {
10078
10235
  if (wordWidth)
10079
10236
  addWord();
10080
10237
  addRow();
10081
10238
  }
10082
10239
  else {
10083
- addRow();
10240
+ if (!afterBreak)
10241
+ afterBreak = charType === Letter && lastCharType == After;
10242
+ if (langBreak || afterBreak || charType === Break || charType === Before || charType === Single || (wordWidth + charWidth > realWidth)) {
10243
+ if (wordWidth)
10244
+ addWord();
10245
+ addRow();
10246
+ }
10247
+ else {
10248
+ addRow();
10249
+ }
10084
10250
  }
10085
10251
  }
10086
10252
  if (char === ' ' && paraStart !== true && (rowWidth + wordWidth) === 0) ;
@@ -10150,7 +10316,7 @@ var LeaferUI = (function (exports) {
10150
10316
 
10151
10317
  const CharMode = 0;
10152
10318
  const WordMode = 1;
10153
- const RowMode = 2;
10319
+ const TextMode = 2;
10154
10320
  function layoutChar(drawData, style, width, _height) {
10155
10321
  const { rows } = drawData;
10156
10322
  const { textAlign, paraIndent, letterSpacing } = style;
@@ -10159,15 +10325,12 @@ var LeaferUI = (function (exports) {
10159
10325
  if (row.words) {
10160
10326
  indentWidth = paraIndent && row.paraStart ? paraIndent : 0;
10161
10327
  addWordWidth = (width && textAlign === 'justify' && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
10162
- mode = (letterSpacing || row.isOverflow) ? CharMode : (addWordWidth > 0.01 ? WordMode : RowMode);
10163
- if (mode === RowMode) {
10164
- row.text = '';
10328
+ mode = (letterSpacing || row.isOverflow) ? CharMode : (addWordWidth > 0.01 ? WordMode : TextMode);
10329
+ if (row.isOverflow && !letterSpacing)
10330
+ row.textMode = true;
10331
+ if (mode === TextMode) {
10165
10332
  row.x += indentWidth;
10166
- row.words.forEach(word => {
10167
- word.data.forEach(char => {
10168
- row.text += char.char;
10169
- });
10170
- });
10333
+ toTextChar$1(row);
10171
10334
  }
10172
10335
  else {
10173
10336
  row.x += indentWidth;
@@ -10193,6 +10356,14 @@ var LeaferUI = (function (exports) {
10193
10356
  }
10194
10357
  });
10195
10358
  }
10359
+ function toTextChar$1(row) {
10360
+ row.text = '';
10361
+ row.words.forEach(word => {
10362
+ word.data.forEach(char => {
10363
+ row.text += char.char;
10364
+ });
10365
+ });
10366
+ }
10196
10367
  function toWordChar(data, charX, wordChar) {
10197
10368
  data.forEach(char => {
10198
10369
  wordChar.char += char.char;
@@ -10213,10 +10384,10 @@ var LeaferUI = (function (exports) {
10213
10384
 
10214
10385
  function layoutText(drawData, style) {
10215
10386
  const { rows, bounds } = drawData;
10216
- const { __lineHeight, __baseLine, __letterSpacing, textAlign, verticalAlign, paraSpacing, textOverflow } = style;
10387
+ const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing } = style;
10217
10388
  let { x, y, width, height } = bounds, realHeight = __lineHeight * rows.length + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
10218
10389
  let starY = __baseLine;
10219
- if (textOverflow !== 'show' && realHeight > height) {
10390
+ if (__clipText && realHeight > height) {
10220
10391
  realHeight = Math.max(height, __lineHeight);
10221
10392
  drawData.overflow = rows.length;
10222
10393
  }
@@ -10265,39 +10436,58 @@ var LeaferUI = (function (exports) {
10265
10436
  bounds.x = rowX;
10266
10437
  if (rowWidth > bounds.width)
10267
10438
  bounds.width = rowWidth;
10439
+ if (__clipText && width && width < rowWidth) {
10440
+ row.isOverflow = true;
10441
+ if (!drawData.overflow)
10442
+ drawData.overflow = rows.length;
10443
+ }
10268
10444
  }
10269
10445
  bounds.y = y;
10270
10446
  bounds.height = realHeight;
10271
10447
  }
10272
10448
 
10273
- function clipText(drawData, textOverflow) {
10449
+ function clipText(drawData, style) {
10274
10450
  const { rows, overflow } = drawData;
10451
+ let { textOverflow } = style;
10275
10452
  rows.splice(overflow);
10276
10453
  if (textOverflow !== 'hide') {
10277
10454
  if (textOverflow === 'ellipsis')
10278
10455
  textOverflow = '...';
10456
+ let char, charRight;
10279
10457
  const ellipsisWidth = Platform.canvas.measureText(textOverflow).width;
10280
- const row = rows[overflow - 1];
10281
- let char, end = row.data.length - 1, charRight;
10282
- const { x, width } = drawData.bounds;
10283
- const right = x + width - ellipsisWidth;
10284
- for (let i = end; i > -1; i--) {
10285
- char = row.data[i];
10286
- charRight = char.x + char.width;
10287
- if (i === end && charRight < right) {
10288
- break;
10289
- }
10290
- else if (charRight < right && char.char !== ' ') {
10291
- row.data.splice(i + 1);
10292
- row.width -= char.width;
10293
- break;
10458
+ const right = style.x + style.width - ellipsisWidth;
10459
+ const list = style.textWrap === 'none' ? rows : [rows[overflow - 1]];
10460
+ list.forEach(row => {
10461
+ if (row.isOverflow && row.data) {
10462
+ let end = row.data.length - 1;
10463
+ for (let i = end; i > -1; i--) {
10464
+ char = row.data[i];
10465
+ charRight = char.x + char.width;
10466
+ if (i === end && charRight < right) {
10467
+ break;
10468
+ }
10469
+ else if (charRight < right && char.char !== ' ') {
10470
+ row.data.splice(i + 1);
10471
+ row.width -= char.width;
10472
+ break;
10473
+ }
10474
+ row.width -= char.width;
10475
+ }
10476
+ row.width += ellipsisWidth;
10477
+ row.data.push({ char: textOverflow, x: charRight });
10478
+ if (row.textMode)
10479
+ toTextChar(row);
10294
10480
  }
10295
- row.width -= char.width;
10296
- }
10297
- row.width += ellipsisWidth;
10298
- row.data.push({ char: textOverflow, x: charRight });
10481
+ });
10299
10482
  }
10300
10483
  }
10484
+ function toTextChar(row) {
10485
+ row.text = '';
10486
+ row.data.forEach(char => {
10487
+ row.text += char.char;
10488
+ });
10489
+ row.data = null;
10490
+ }
10301
10491
 
10302
10492
  function decorationText(drawData, style) {
10303
10493
  const { fontSize } = style;
@@ -10318,7 +10508,7 @@ var LeaferUI = (function (exports) {
10318
10508
  let x = 0, y = 0;
10319
10509
  let width = style.__getInput('width') || 0;
10320
10510
  let height = style.__getInput('height') || 0;
10321
- const { textDecoration, textOverflow, __font, padding } = style;
10511
+ const { textDecoration, __font, padding } = style;
10322
10512
  if (padding) {
10323
10513
  const [top, right, bottom, left] = MathHelper.fourNumber(padding);
10324
10514
  if (width) {
@@ -10340,7 +10530,7 @@ var LeaferUI = (function (exports) {
10340
10530
  layoutText(drawData, style);
10341
10531
  layoutChar(drawData, style, width);
10342
10532
  if (drawData.overflow)
10343
- clipText(drawData, textOverflow);
10533
+ clipText(drawData, style);
10344
10534
  if (textDecoration !== 'none')
10345
10535
  decorationText(drawData, style);
10346
10536
  return drawData;
@@ -10511,7 +10701,6 @@ var LeaferUI = (function (exports) {
10511
10701
  exports.TaskItem = TaskItem;
10512
10702
  exports.TaskProcessor = TaskProcessor;
10513
10703
  exports.TextConvert = TextConvert$1;
10514
- exports.TransformEvent = TransformEvent;
10515
10704
  exports.TwoPointBounds = TwoPointBounds;
10516
10705
  exports.TwoPointBoundsHelper = TwoPointBoundsHelper;
10517
10706
  exports.UIBounds = UIBounds;