@leafer-draw/worker 1.6.3 → 1.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/worker.js CHANGED
@@ -493,19 +493,19 @@ var LeaferUI = (function (exports) {
493
493
  },
494
494
  tempToInnerOf(t, matrix) {
495
495
  const { tempPoint: temp } = P$5;
496
- copy$b(temp, t);
496
+ copy$a(temp, t);
497
497
  toInnerPoint$2(matrix, temp, temp);
498
498
  return temp;
499
499
  },
500
500
  tempToOuterOf(t, matrix) {
501
501
  const { tempPoint: temp } = P$5;
502
- copy$b(temp, t);
502
+ copy$a(temp, t);
503
503
  toOuterPoint$3(matrix, temp, temp);
504
504
  return temp;
505
505
  },
506
506
  tempToInnerRadiusPointOf(t, matrix) {
507
507
  const { tempRadiusPoint: temp } = P$5;
508
- copy$b(temp, t);
508
+ copy$a(temp, t);
509
509
  P$5.toInnerRadiusPointOf(t, matrix, temp);
510
510
  return temp;
511
511
  },
@@ -578,7 +578,7 @@ var LeaferUI = (function (exports) {
578
578
  }
579
579
  };
580
580
  const P$5 = PointHelper;
581
- const { getDistanceFrom, copy: copy$b, getAtan2 } = P$5;
581
+ const { getDistanceFrom, copy: copy$a, getAtan2 } = P$5;
582
582
 
583
583
  class Point {
584
584
  constructor(x, y) {
@@ -935,7 +935,7 @@ var LeaferUI = (function (exports) {
935
935
  to = t;
936
936
  }
937
937
  else {
938
- copy$a(to, t);
938
+ copy$9(to, t);
939
939
  }
940
940
  if (parent) {
941
941
  to.offsetX = -(B.maxX(parent) - t.x);
@@ -1093,7 +1093,7 @@ var LeaferUI = (function (exports) {
1093
1093
  if (first) {
1094
1094
  first = false;
1095
1095
  if (!addMode)
1096
- copy$a(t, bounds);
1096
+ copy$9(t, bounds);
1097
1097
  }
1098
1098
  else {
1099
1099
  add$1(t, bounds);
@@ -1174,7 +1174,7 @@ var LeaferUI = (function (exports) {
1174
1174
  }
1175
1175
  };
1176
1176
  const B = BoundsHelper;
1177
- const { add: add$1, copy: copy$a } = B;
1177
+ const { add: add$1, copy: copy$9 } = B;
1178
1178
 
1179
1179
  class Bounds {
1180
1180
  get minX() { return BoundsHelper.minX(this); }
@@ -2069,7 +2069,7 @@ var LeaferUI = (function (exports) {
2069
2069
  contextMethod()
2070
2070
  ], Canvas.prototype, "strokeText", null);
2071
2071
 
2072
- const { copy: copy$9, multiplyParent: multiplyParent$3 } = MatrixHelper, { round: round$1 } = Math;
2072
+ const { copy: copy$8, multiplyParent: multiplyParent$3 } = MatrixHelper, { round: round$1 } = Math;
2073
2073
  const minSize = { width: 1, height: 1, pixelRatio: 1 };
2074
2074
  const canvasSizeAttrs = ['width', 'height', 'pixelRatio'];
2075
2075
  class LeaferCanvasBase extends Canvas {
@@ -2272,16 +2272,19 @@ var LeaferUI = (function (exports) {
2272
2272
  if (blendMode)
2273
2273
  this.blendMode = 'source-over';
2274
2274
  }
2275
- clearWorld(bounds, ceilPixel) {
2276
- this.setTempBounds(bounds, ceilPixel);
2277
- this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2278
- }
2279
2275
  clipWorld(bounds, ceilPixel) {
2280
2276
  this.beginPath();
2281
2277
  this.setTempBounds(bounds, ceilPixel);
2282
2278
  this.rect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2283
2279
  this.clip();
2284
2280
  }
2281
+ clipUI(ruleData) {
2282
+ ruleData.windingRule ? this.clip(ruleData.windingRule) : this.clip();
2283
+ }
2284
+ clearWorld(bounds, ceilPixel) {
2285
+ this.setTempBounds(bounds, ceilPixel);
2286
+ this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2287
+ }
2285
2288
  clear() {
2286
2289
  const { pixelRatio } = this;
2287
2290
  this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
@@ -2301,7 +2304,7 @@ var LeaferUI = (function (exports) {
2301
2304
  const { size, pixelSnap } = this, canvas = this.manager ? this.manager.get(size) : Creator.canvas(Object.assign({}, size));
2302
2305
  canvas.save();
2303
2306
  if (useSameWorldTransform)
2304
- copy$9(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2307
+ copy$8(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2305
2308
  if (useSameSmooth)
2306
2309
  canvas.smooth = this.smooth;
2307
2310
  canvas.pixelSnap !== pixelSnap && (canvas.pixelSnap = pixelSnap);
@@ -2680,7 +2683,7 @@ var LeaferUI = (function (exports) {
2680
2683
  };
2681
2684
 
2682
2685
  const { M: M$4, m, L: L$5, l, H, h, V, v, C: C$3, 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$4, O: O$3, P: P$3, U: U$3 } = PathCommandMap;
2683
- const { rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
2686
+ const { rect: rect$2, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
2684
2687
  const { ellipticalArc } = EllipseHelper;
2685
2688
  const debug$b = Debug.get('PathConvert');
2686
2689
  const setEndPoint$1 = {};
@@ -2877,7 +2880,7 @@ var LeaferUI = (function (exports) {
2877
2880
  case N$3:
2878
2881
  x = old[i + 1];
2879
2882
  y = old[i + 2];
2880
- curveMode ? rect$3(data, x, y, old[i + 3], old[i + 4]) : copyData(data, old, i, 5);
2883
+ curveMode ? rect$2(data, x, y, old[i + 3], old[i + 4]) : copyData(data, old, i, 5);
2881
2884
  i += 5;
2882
2885
  break;
2883
2886
  case D$3:
@@ -3053,7 +3056,7 @@ var LeaferUI = (function (exports) {
3053
3056
  };
3054
3057
  const { ellipse: ellipse$3, arc: arc$2 } = PathCommandDataHelper;
3055
3058
 
3056
- const { moveTo: moveTo$4, lineTo: lineTo$3, quadraticCurveTo, bezierCurveTo, closePath: closePath$3, beginPath, rect: rect$2, roundRect: roundRect$1, ellipse: ellipse$2, arc: arc$1, arcTo: arcTo$2, drawEllipse, drawArc, drawPoints: drawPoints$2 } = PathCommandDataHelper;
3059
+ const { moveTo: moveTo$4, lineTo: lineTo$3, quadraticCurveTo, bezierCurveTo, closePath: closePath$3, beginPath, rect: rect$1, roundRect: roundRect$1, ellipse: ellipse$2, arc: arc$1, arcTo: arcTo$2, drawEllipse, drawArc, drawPoints: drawPoints$2 } = PathCommandDataHelper;
3057
3060
  class PathCreator {
3058
3061
  set path(value) { this.__path = value; }
3059
3062
  get path() { return this.__path; }
@@ -3100,7 +3103,7 @@ var LeaferUI = (function (exports) {
3100
3103
  return this;
3101
3104
  }
3102
3105
  rect(x, y, width, height) {
3103
- rect$2(this.__path, x, y, width, height);
3106
+ rect$1(this.__path, x, y, width, height);
3104
3107
  this.paint();
3105
3108
  return this;
3106
3109
  }
@@ -3218,7 +3221,7 @@ var LeaferUI = (function (exports) {
3218
3221
 
3219
3222
  const { M: M$1, L: L$2, C, Q, Z: Z$1, N, D, X, G, F: F$1, O, P, U } = PathCommandMap;
3220
3223
  const { toTwoPointBounds, toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc, ellipse: ellipse$1 } = BezierHelper;
3221
- const { addPointBounds, copy: copy$8, addPoint, setPoint, addBounds, toBounds: toBounds$2 } = TwoPointBoundsHelper;
3224
+ const { addPointBounds, copy: copy$7, addPoint, setPoint, addBounds, toBounds: toBounds$2 } = TwoPointBoundsHelper;
3222
3225
  const debug$9 = Debug.get('PathBounds');
3223
3226
  let radius, radiusX, radiusY;
3224
3227
  const tempPointBounds = {};
@@ -3290,7 +3293,7 @@ var LeaferUI = (function (exports) {
3290
3293
  break;
3291
3294
  case G:
3292
3295
  ellipse$1(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], data[i + 7], data[i + 8], tempPointBounds, setEndPoint);
3293
- i === 0 ? copy$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3296
+ i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3294
3297
  x = setEndPoint.x;
3295
3298
  y = setEndPoint.y;
3296
3299
  i += 9;
@@ -3306,7 +3309,7 @@ var LeaferUI = (function (exports) {
3306
3309
  break;
3307
3310
  case O:
3308
3311
  arc(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], tempPointBounds, setEndPoint);
3309
- i === 0 ? copy$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3312
+ i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3310
3313
  x = setEndPoint.x;
3311
3314
  y = setEndPoint.y;
3312
3315
  i += 7;
@@ -3321,7 +3324,7 @@ var LeaferUI = (function (exports) {
3321
3324
  break;
3322
3325
  case U:
3323
3326
  arcTo$1(null, x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], tempPointBounds, setEndPoint);
3324
- i === 0 ? copy$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3327
+ i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3325
3328
  x = setEndPoint.x;
3326
3329
  y = setEndPoint.y;
3327
3330
  i += 6;
@@ -4257,8 +4260,8 @@ var LeaferUI = (function (exports) {
4257
4260
  };
4258
4261
  }
4259
4262
 
4260
- const { copy: copy$7, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
4261
- const matrix$1 = {}, { round } = Math;
4263
+ const { copy: copy$6, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
4264
+ const matrix = {}, { round } = Math;
4262
4265
  const LeafHelper = {
4263
4266
  updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
4264
4267
  if (checkAutoLayout && leaf.__hasAutoLayout && leaf.__layout.matrixChanged)
@@ -4353,13 +4356,13 @@ var LeaferUI = (function (exports) {
4353
4356
  transition = scaleY;
4354
4357
  scaleY = scaleX;
4355
4358
  }
4356
- copy$7(matrix$1, o);
4357
- scaleOfOuter$2(matrix$1, origin, scaleX, scaleY);
4359
+ copy$6(matrix, o);
4360
+ scaleOfOuter$2(matrix, origin, scaleX, scaleY);
4358
4361
  if (t.origin || t.around) {
4359
- L.setTransform(t, matrix$1, resize, transition);
4362
+ L.setTransform(t, matrix, resize, transition);
4360
4363
  }
4361
4364
  else {
4362
- const x = t.x + matrix$1.e - o.e, y = t.y + matrix$1.f - o.f;
4365
+ const x = t.x + matrix.e - o.e, y = t.y + matrix.f - o.f;
4363
4366
  if (transition && !resize)
4364
4367
  t.animate({ x, y, scaleX: t.scaleX * scaleX, scaleY: t.scaleY * scaleY }, transition);
4365
4368
  else
@@ -4371,32 +4374,32 @@ var LeaferUI = (function (exports) {
4371
4374
  },
4372
4375
  rotateOfLocal(t, origin, angle, transition) {
4373
4376
  const o = t.__localMatrix;
4374
- copy$7(matrix$1, o);
4375
- rotateOfOuter$2(matrix$1, origin, angle);
4377
+ copy$6(matrix, o);
4378
+ rotateOfOuter$2(matrix, origin, angle);
4376
4379
  if (t.origin || t.around)
4377
- L.setTransform(t, matrix$1, false, transition);
4380
+ L.setTransform(t, matrix, false, transition);
4378
4381
  else
4379
- t.set({ x: t.x + matrix$1.e - o.e, y: t.y + matrix$1.f - o.f, rotation: MathHelper.formatRotation(t.rotation + angle) }, transition);
4382
+ t.set({ x: t.x + matrix.e - o.e, y: t.y + matrix.f - o.f, rotation: MathHelper.formatRotation(t.rotation + angle) }, transition);
4380
4383
  },
4381
4384
  skewOfWorld(t, origin, skewX, skewY, resize, transition) {
4382
4385
  L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
4383
4386
  },
4384
4387
  skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
4385
- copy$7(matrix$1, t.__localMatrix);
4386
- skewOfOuter(matrix$1, origin, skewX, skewY);
4387
- L.setTransform(t, matrix$1, resize, transition);
4388
+ copy$6(matrix, t.__localMatrix);
4389
+ skewOfOuter(matrix, origin, skewX, skewY);
4390
+ L.setTransform(t, matrix, resize, transition);
4388
4391
  },
4389
4392
  transformWorld(t, transform, resize, transition) {
4390
- copy$7(matrix$1, t.worldTransform);
4391
- multiplyParent$2(matrix$1, transform);
4393
+ copy$6(matrix, t.worldTransform);
4394
+ multiplyParent$2(matrix, transform);
4392
4395
  if (t.parent)
4393
- divideParent(matrix$1, t.parent.worldTransform);
4394
- L.setTransform(t, matrix$1, resize, transition);
4396
+ divideParent(matrix, t.parent.worldTransform);
4397
+ L.setTransform(t, matrix, resize, transition);
4395
4398
  },
4396
4399
  transform(t, transform, resize, transition) {
4397
- copy$7(matrix$1, t.localTransform);
4398
- multiplyParent$2(matrix$1, transform);
4399
- L.setTransform(t, matrix$1, resize, transition);
4400
+ copy$6(matrix, t.localTransform);
4401
+ multiplyParent$2(matrix, transform);
4402
+ L.setTransform(t, matrix, resize, transition);
4400
4403
  },
4401
4404
  setTransform(t, transform, resize, transition) {
4402
4405
  const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
@@ -4430,9 +4433,9 @@ var LeaferUI = (function (exports) {
4430
4433
  return innerOrigin;
4431
4434
  },
4432
4435
  getRelativeWorld(t, relative, temp) {
4433
- copy$7(matrix$1, t.worldTransform);
4434
- divideParent(matrix$1, relative.worldTransform);
4435
- return temp ? matrix$1 : Object.assign({}, matrix$1);
4436
+ copy$6(matrix, t.worldTransform);
4437
+ divideParent(matrix, relative.worldTransform);
4438
+ return temp ? matrix : Object.assign({}, matrix);
4436
4439
  },
4437
4440
  drop(t, parent, index, resize) {
4438
4441
  t.setTransform(L.getRelativeWorld(t, parent, true), resize);
@@ -4571,7 +4574,7 @@ var LeaferUI = (function (exports) {
4571
4574
  };
4572
4575
 
4573
4576
  const { getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2 } = LeafHelper;
4574
- const { toOuterOf: toOuterOf$2, getPoints, copy: copy$6 } = BoundsHelper;
4577
+ const { toOuterOf: toOuterOf$2, getPoints, copy: copy$5 } = BoundsHelper;
4575
4578
  const localContent = '_localContentBounds';
4576
4579
  const worldContent = '_worldContentBounds', worldBox = '_worldBoxBounds', worldStroke = '_worldStrokeBounds';
4577
4580
  class LeafLayout {
@@ -4731,7 +4734,7 @@ var LeaferUI = (function (exports) {
4731
4734
  }
4732
4735
  if (!layoutBounds)
4733
4736
  layoutBounds = MatrixHelper.getLayout(matrix);
4734
- copy$6(layoutBounds, bounds);
4737
+ copy$5(layoutBounds, bounds);
4735
4738
  PointHelper.copy(layoutBounds, point);
4736
4739
  if (unscale) {
4737
4740
  const { scaleX, scaleY } = layoutBounds;
@@ -5285,7 +5288,7 @@ var LeaferUI = (function (exports) {
5285
5288
 
5286
5289
  const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2 } = LeafHelper;
5287
5290
  const { updateBounds: updateBounds$1 } = BranchHelper;
5288
- const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$5 } = BoundsHelper;
5291
+ const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$4 } = BoundsHelper;
5289
5292
  const { toBounds: toBounds$1 } = PathBounds;
5290
5293
  const LeafBounds = {
5291
5294
  __updateWorldBounds() {
@@ -5416,7 +5419,7 @@ var LeaferUI = (function (exports) {
5416
5419
  },
5417
5420
  __updateRenderBounds() {
5418
5421
  const layout = this.__layout;
5419
- layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$5(layout.renderBounds, layout.strokeBounds);
5422
+ layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$4(layout.renderBounds, layout.strokeBounds);
5420
5423
  }
5421
5424
  };
5422
5425
 
@@ -5450,7 +5453,7 @@ var LeaferUI = (function (exports) {
5450
5453
  if (this.__worldOpacity) {
5451
5454
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
5452
5455
  this.__drawRenderPath(canvas);
5453
- this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
5456
+ canvas.clipUI(this);
5454
5457
  }
5455
5458
  },
5456
5459
  __updateWorldOpacity() {
@@ -5521,7 +5524,7 @@ var LeaferUI = (function (exports) {
5521
5524
  const { LEAF, create } = IncrementId;
5522
5525
  const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
5523
5526
  const { toOuterOf } = BoundsHelper;
5524
- const { copy: copy$4, move } = PointHelper;
5527
+ const { copy: copy$3, move } = PointHelper;
5525
5528
  const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
5526
5529
  exports.Leaf = class Leaf {
5527
5530
  get tag() { return this.__tag; }
@@ -5734,7 +5737,7 @@ var LeaferUI = (function (exports) {
5734
5737
  }
5735
5738
  else {
5736
5739
  if (to)
5737
- copy$4(to, world);
5740
+ copy$3(to, world);
5738
5741
  }
5739
5742
  }
5740
5743
  localToWorld(local, to, distance, relative) {
@@ -5743,7 +5746,7 @@ var LeaferUI = (function (exports) {
5743
5746
  }
5744
5747
  else {
5745
5748
  if (to)
5746
- copy$4(to, local);
5749
+ copy$3(to, local);
5747
5750
  }
5748
5751
  }
5749
5752
  worldToInner(world, to, distance, relative) {
@@ -6233,7 +6236,7 @@ var LeaferUI = (function (exports) {
6233
6236
  }
6234
6237
  }
6235
6238
 
6236
- const version = "1.6.3";
6239
+ const version = "1.6.4";
6237
6240
 
6238
6241
  class LeaferCanvas extends LeaferCanvasBase {
6239
6242
  get allowBackgroundColor() { return true; }
@@ -7372,7 +7375,7 @@ var LeaferUI = (function (exports) {
7372
7375
  __drawAfterFill(canvas, options) {
7373
7376
  if (this.__.__clipAfterFill) {
7374
7377
  canvas.save();
7375
- this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
7378
+ canvas.clipUI();
7376
7379
  this.__drawContent(canvas, options);
7377
7380
  canvas.restore();
7378
7381
  }
@@ -8238,8 +8241,8 @@ var LeaferUI = (function (exports) {
8238
8241
  registerUI()
8239
8242
  ], exports.Rect);
8240
8243
 
8241
- const { copy: copy$3, add, includes: includes$1 } = BoundsHelper;
8242
- const rect$1 = exports.Rect.prototype, group = exports.Group.prototype;
8244
+ const { copy: copy$2, add, includes: includes$1 } = BoundsHelper;
8245
+ const rect = exports.Rect.prototype, group = exports.Group.prototype;
8243
8246
  const childrenRenderBounds = {};
8244
8247
  exports.Box = class Box extends exports.Group {
8245
8248
  get __tag() { return 'Box'; }
@@ -8284,7 +8287,7 @@ var LeaferUI = (function (exports) {
8284
8287
  const { renderBounds } = this.__layout;
8285
8288
  if (this.children.length) {
8286
8289
  super.__updateRenderBounds();
8287
- copy$3(childrenRenderBounds, renderBounds);
8290
+ copy$2(childrenRenderBounds, renderBounds);
8288
8291
  this.__updateRectRenderBounds();
8289
8292
  isOverflow = !includes$1(renderBounds, childrenRenderBounds);
8290
8293
  if (isOverflow && this.__.overflow !== 'hide')
@@ -8336,25 +8339,25 @@ var LeaferUI = (function (exports) {
8336
8339
  affectRenderBoundsType('show')
8337
8340
  ], exports.Box.prototype, "overflow", void 0);
8338
8341
  __decorate([
8339
- rewrite(rect$1.__updateStrokeSpread)
8342
+ rewrite(rect.__updateStrokeSpread)
8340
8343
  ], exports.Box.prototype, "__updateStrokeSpread", null);
8341
8344
  __decorate([
8342
- rewrite(rect$1.__updateRenderSpread)
8345
+ rewrite(rect.__updateRenderSpread)
8343
8346
  ], exports.Box.prototype, "__updateRectRenderSpread", null);
8344
8347
  __decorate([
8345
- rewrite(rect$1.__updateBoxBounds)
8348
+ rewrite(rect.__updateBoxBounds)
8346
8349
  ], exports.Box.prototype, "__updateRectBoxBounds", null);
8347
8350
  __decorate([
8348
- rewrite(rect$1.__updateStrokeBounds)
8351
+ rewrite(rect.__updateStrokeBounds)
8349
8352
  ], exports.Box.prototype, "__updateStrokeBounds", null);
8350
8353
  __decorate([
8351
- rewrite(rect$1.__updateRenderBounds)
8354
+ rewrite(rect.__updateRenderBounds)
8352
8355
  ], exports.Box.prototype, "__updateRectRenderBounds", null);
8353
8356
  __decorate([
8354
- rewrite(rect$1.__updateChange)
8357
+ rewrite(rect.__updateChange)
8355
8358
  ], exports.Box.prototype, "__updateRectChange", null);
8356
8359
  __decorate([
8357
- rewrite(rect$1.__render)
8360
+ rewrite(rect.__render)
8358
8361
  ], exports.Box.prototype, "__renderRect", null);
8359
8362
  __decorate([
8360
8363
  rewrite(group.__render)
@@ -8857,6 +8860,9 @@ var LeaferUI = (function (exports) {
8857
8860
  __decorate([
8858
8861
  boundsType('show')
8859
8862
  ], exports.Text.prototype, "textOverflow", void 0);
8863
+ __decorate([
8864
+ surfaceType(false)
8865
+ ], exports.Text.prototype, "textEditing", void 0);
8860
8866
  exports.Text = __decorate([
8861
8867
  registerUI()
8862
8868
  ], exports.Text);
@@ -8988,531 +8994,6 @@ var LeaferUI = (function (exports) {
8988
8994
  ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
8989
8995
  }
8990
8996
 
8991
- let App = class App extends exports.Leafer {
8992
- get __tag() { return 'App'; }
8993
- get isApp() { return true; }
8994
- constructor(userConfig, data) {
8995
- super(userConfig, data);
8996
- }
8997
- init(userConfig, parentApp) {
8998
- super.init(userConfig, parentApp);
8999
- if (userConfig) {
9000
- const { ground, tree, sky, editor } = userConfig;
9001
- if (ground)
9002
- this.ground = this.addLeafer(ground);
9003
- if (tree || editor)
9004
- this.tree = this.addLeafer(tree || { type: userConfig.type || 'design' });
9005
- if (sky || editor)
9006
- this.sky = this.addLeafer(sky);
9007
- if (editor)
9008
- Creator.editor(editor, this);
9009
- }
9010
- }
9011
- __setApp() {
9012
- const { canvas } = this;
9013
- const { realCanvas, view } = this.config;
9014
- if (realCanvas || view === this.canvas.view || !canvas.parentView)
9015
- this.realCanvas = true;
9016
- else
9017
- canvas.unrealCanvas();
9018
- this.leafer = this;
9019
- this.watcher.disable();
9020
- this.layouter.disable();
9021
- }
9022
- __updateLocalBounds() {
9023
- this.forEach(leafer => leafer.updateLayout());
9024
- super.__updateLocalBounds();
9025
- }
9026
- start() {
9027
- super.start();
9028
- this.forEach(leafer => leafer.start());
9029
- }
9030
- stop() {
9031
- this.forEach(leafer => leafer.stop());
9032
- super.stop();
9033
- }
9034
- unlockLayout() {
9035
- super.unlockLayout();
9036
- this.forEach(leafer => leafer.unlockLayout());
9037
- }
9038
- lockLayout() {
9039
- super.lockLayout();
9040
- this.forEach(leafer => leafer.lockLayout());
9041
- }
9042
- forceRender(bounds, sync) {
9043
- this.forEach(leafer => leafer.forceRender(bounds, sync));
9044
- }
9045
- addLeafer(merge) {
9046
- const leafer = new exports.Leafer(merge);
9047
- this.add(leafer);
9048
- return leafer;
9049
- }
9050
- add(leafer, index) {
9051
- if (!leafer.view) {
9052
- if (this.realCanvas && !this.canvas.bounds) {
9053
- setTimeout(() => this.add(leafer, index), 10);
9054
- return;
9055
- }
9056
- leafer.init(this.__getChildConfig(leafer.userConfig), this);
9057
- }
9058
- super.add(leafer, index);
9059
- if (index !== undefined)
9060
- leafer.canvas.childIndex = index;
9061
- this.__listenChildEvents(leafer);
9062
- }
9063
- forEach(fn) {
9064
- this.children.forEach(fn);
9065
- }
9066
- __onCreated() {
9067
- this.created = this.children.every(child => child.created);
9068
- }
9069
- __onReady() {
9070
- if (this.children.every(child => child.ready))
9071
- super.__onReady();
9072
- }
9073
- __onViewReady() {
9074
- if (this.children.every(child => child.viewReady))
9075
- super.__onViewReady();
9076
- }
9077
- __onChildRenderEnd(e) {
9078
- this.renderer.addBlock(e.renderBounds);
9079
- if (this.viewReady)
9080
- this.renderer.update();
9081
- }
9082
- __render(canvas, options) {
9083
- if (canvas.context)
9084
- this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
9085
- }
9086
- __onResize(event) {
9087
- this.forEach(leafer => leafer.resize(event));
9088
- super.__onResize(event);
9089
- }
9090
- updateLayout() {
9091
- this.forEach(leafer => leafer.updateLayout());
9092
- }
9093
- __getChildConfig(userConfig) {
9094
- const config = Object.assign({}, this.config);
9095
- config.hittable = config.realCanvas = undefined;
9096
- if (userConfig)
9097
- DataHelper.assign(config, userConfig);
9098
- if (this.autoLayout)
9099
- DataHelper.copyAttrs(config, this, canvasSizeAttrs);
9100
- config.view = this.realCanvas ? undefined : this.view;
9101
- config.fill = undefined;
9102
- return config;
9103
- }
9104
- __listenChildEvents(leafer) {
9105
- leafer.once([
9106
- [LayoutEvent.END, this.__onReady, this],
9107
- [RenderEvent.START, this.__onCreated, this],
9108
- [RenderEvent.END, this.__onViewReady, this]
9109
- ]);
9110
- if (this.realCanvas)
9111
- this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
9112
- }
9113
- };
9114
- App = __decorate([
9115
- registerUI()
9116
- ], App);
9117
-
9118
- const downKeyMap = {};
9119
- const Keyboard = {
9120
- isHoldSpaceKey() {
9121
- return Keyboard.isHold('Space');
9122
- },
9123
- isHold(code) {
9124
- return downKeyMap[code];
9125
- },
9126
- setDownCode(code) {
9127
- if (!downKeyMap[code])
9128
- downKeyMap[code] = true;
9129
- },
9130
- setUpCode(code) {
9131
- downKeyMap[code] = false;
9132
- }
9133
- };
9134
-
9135
- const PointerButton = {
9136
- LEFT: 1,
9137
- RIGHT: 2,
9138
- MIDDLE: 4,
9139
- defaultLeft(event) { if (!event.buttons)
9140
- event.buttons = 1; },
9141
- left(event) { return event.buttons === 1; },
9142
- right(event) { return event.buttons === 2; },
9143
- middle(event) { return event.buttons === 4; }
9144
- };
9145
-
9146
- class UIEvent extends Event {
9147
- get spaceKey() { return Keyboard.isHoldSpaceKey(); }
9148
- get left() { return PointerButton.left(this); }
9149
- get right() { return PointerButton.right(this); }
9150
- get middle() { return PointerButton.middle(this); }
9151
- constructor(params) {
9152
- super(params.type);
9153
- this.bubbles = true;
9154
- Object.assign(this, params);
9155
- }
9156
- getBoxPoint(relative) {
9157
- return (relative || this.current).getBoxPoint(this);
9158
- }
9159
- getInnerPoint(relative) {
9160
- return (relative || this.current).getInnerPoint(this);
9161
- }
9162
- getLocalPoint(relative) {
9163
- return (relative || this.current).getLocalPoint(this);
9164
- }
9165
- getPagePoint() {
9166
- return this.current.getPagePoint(this);
9167
- }
9168
- getInner(relative) { return this.getInnerPoint(relative); }
9169
- getLocal(relative) { return this.getLocalPoint(relative); }
9170
- getPage() { return this.getPagePoint(); }
9171
- static changeName(oldName, newName) {
9172
- EventCreator.changeName(oldName, newName);
9173
- }
9174
- }
9175
-
9176
- let PointerEvent = class PointerEvent extends UIEvent {
9177
- };
9178
- PointerEvent.POINTER = 'pointer';
9179
- PointerEvent.BEFORE_DOWN = 'pointer.before_down';
9180
- PointerEvent.BEFORE_MOVE = 'pointer.before_move';
9181
- PointerEvent.BEFORE_UP = 'pointer.before_up';
9182
- PointerEvent.DOWN = 'pointer.down';
9183
- PointerEvent.MOVE = 'pointer.move';
9184
- PointerEvent.UP = 'pointer.up';
9185
- PointerEvent.OVER = 'pointer.over';
9186
- PointerEvent.OUT = 'pointer.out';
9187
- PointerEvent.ENTER = 'pointer.enter';
9188
- PointerEvent.LEAVE = 'pointer.leave';
9189
- PointerEvent.TAP = 'tap';
9190
- PointerEvent.DOUBLE_TAP = 'double_tap';
9191
- PointerEvent.CLICK = 'click';
9192
- PointerEvent.DOUBLE_CLICK = 'double_click';
9193
- PointerEvent.LONG_PRESS = 'long_press';
9194
- PointerEvent.LONG_TAP = 'long_tap';
9195
- PointerEvent.MENU = 'pointer.menu';
9196
- PointerEvent.MENU_TAP = 'pointer.menu_tap';
9197
- PointerEvent = __decorate([
9198
- registerUIEvent()
9199
- ], PointerEvent);
9200
-
9201
- const tempMove = {};
9202
- let DragEvent = class DragEvent extends PointerEvent {
9203
- static setList(data) {
9204
- this.list = data instanceof LeafList ? data : new LeafList(data);
9205
- }
9206
- static setData(data) {
9207
- this.data = data;
9208
- }
9209
- static getValidMove(leaf, start, total) {
9210
- const { draggable, dragBounds } = leaf, move = leaf.getLocalPoint(total, null, true);
9211
- PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
9212
- if (dragBounds)
9213
- this.getMoveInDragBounds(leaf.__localBoxBounds, dragBounds === 'parent' ? leaf.parent.boxBounds : dragBounds, move, true);
9214
- if (draggable === 'x')
9215
- move.y = 0;
9216
- if (draggable === 'y')
9217
- move.x = 0;
9218
- return move;
9219
- }
9220
- static getMoveInDragBounds(childBox, dragBounds, move, change) {
9221
- const x = childBox.x + move.x, y = childBox.y + move.y, right = x + childBox.width, bottom = y + childBox.height;
9222
- const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
9223
- if (!change)
9224
- move = Object.assign({}, move);
9225
- if (BoundsHelper.includes(childBox, dragBounds)) {
9226
- if (x > dragBounds.x)
9227
- move.x += dragBounds.x - x;
9228
- else if (right < boundsRight)
9229
- move.x += boundsRight - right;
9230
- if (y > dragBounds.y)
9231
- move.y += dragBounds.y - y;
9232
- else if (bottom < boundsBottom)
9233
- move.y += boundsBottom - bottom;
9234
- }
9235
- else {
9236
- if (x < dragBounds.x)
9237
- move.x += dragBounds.x - x;
9238
- else if (right > boundsRight)
9239
- move.x += boundsRight - right;
9240
- if (y < dragBounds.y)
9241
- move.y += dragBounds.y - y;
9242
- else if (bottom > boundsBottom)
9243
- move.y += boundsBottom - bottom;
9244
- }
9245
- return move;
9246
- }
9247
- getPageMove(total) {
9248
- this.assignMove(total);
9249
- return this.current.getPagePoint(tempMove, null, true);
9250
- }
9251
- getInnerMove(relative, total) {
9252
- if (!relative)
9253
- relative = this.current;
9254
- this.assignMove(total);
9255
- return relative.getInnerPoint(tempMove, null, true);
9256
- }
9257
- getLocalMove(relative, total) {
9258
- if (!relative)
9259
- relative = this.current;
9260
- this.assignMove(total);
9261
- return relative.getLocalPoint(tempMove, null, true);
9262
- }
9263
- getPageTotal() {
9264
- return this.getPageMove(true);
9265
- }
9266
- getInnerTotal(relative) {
9267
- return this.getInnerMove(relative, true);
9268
- }
9269
- getLocalTotal(relative) {
9270
- return this.getLocalMove(relative, true);
9271
- }
9272
- getPageBounds() {
9273
- const total = this.getPageTotal(), start = this.getPagePoint(), bounds = {};
9274
- BoundsHelper.set(bounds, start.x - total.x, start.y - total.y, total.x, total.y);
9275
- BoundsHelper.unsign(bounds);
9276
- return bounds;
9277
- }
9278
- assignMove(total) {
9279
- tempMove.x = total ? this.totalX : this.moveX;
9280
- tempMove.y = total ? this.totalY : this.moveY;
9281
- }
9282
- };
9283
- DragEvent.BEFORE_DRAG = 'drag.before_drag';
9284
- DragEvent.START = 'drag.start';
9285
- DragEvent.DRAG = 'drag';
9286
- DragEvent.END = 'drag.end';
9287
- DragEvent.OVER = 'drag.over';
9288
- DragEvent.OUT = 'drag.out';
9289
- DragEvent.ENTER = 'drag.enter';
9290
- DragEvent.LEAVE = 'drag.leave';
9291
- DragEvent = __decorate([
9292
- registerUIEvent()
9293
- ], DragEvent);
9294
-
9295
- let DropEvent = class DropEvent extends PointerEvent {
9296
- static setList(data) {
9297
- DragEvent.setList(data);
9298
- }
9299
- static setData(data) {
9300
- DragEvent.setData(data);
9301
- }
9302
- };
9303
- DropEvent.DROP = 'drop';
9304
- DropEvent = __decorate([
9305
- registerUIEvent()
9306
- ], DropEvent);
9307
-
9308
- let MoveEvent = class MoveEvent extends DragEvent {
9309
- };
9310
- MoveEvent.BEFORE_MOVE = 'move.before_move';
9311
- MoveEvent.START = 'move.start';
9312
- MoveEvent.MOVE = 'move';
9313
- MoveEvent.END = 'move.end';
9314
- MoveEvent = __decorate([
9315
- registerUIEvent()
9316
- ], MoveEvent);
9317
-
9318
- let RotateEvent = class RotateEvent extends PointerEvent {
9319
- };
9320
- RotateEvent.BEFORE_ROTATE = 'rotate.before_rotate';
9321
- RotateEvent.START = 'rotate.start';
9322
- RotateEvent.ROTATE = 'rotate';
9323
- RotateEvent.END = 'rotate.end';
9324
- RotateEvent = __decorate([
9325
- registerUIEvent()
9326
- ], RotateEvent);
9327
-
9328
- let SwipeEvent = class SwipeEvent extends DragEvent {
9329
- };
9330
- SwipeEvent.SWIPE = 'swipe';
9331
- SwipeEvent.LEFT = 'swipe.left';
9332
- SwipeEvent.RIGHT = 'swipe.right';
9333
- SwipeEvent.UP = 'swipe.up';
9334
- SwipeEvent.DOWN = 'swipe.down';
9335
- SwipeEvent = __decorate([
9336
- registerUIEvent()
9337
- ], SwipeEvent);
9338
-
9339
- let ZoomEvent = class ZoomEvent extends PointerEvent {
9340
- };
9341
- ZoomEvent.BEFORE_ZOOM = 'zoom.before_zoom';
9342
- ZoomEvent.START = 'zoom.start';
9343
- ZoomEvent.ZOOM = 'zoom';
9344
- ZoomEvent.END = 'zoom.end';
9345
- ZoomEvent = __decorate([
9346
- registerUIEvent()
9347
- ], ZoomEvent);
9348
-
9349
- let KeyEvent = class KeyEvent extends UIEvent {
9350
- };
9351
- KeyEvent.DOWN = 'key.down';
9352
- KeyEvent.HOLD = 'key.hold';
9353
- KeyEvent.UP = 'key.up';
9354
- KeyEvent = __decorate([
9355
- registerUIEvent()
9356
- ], KeyEvent);
9357
-
9358
- new LeafList();
9359
-
9360
- Debug.get('emit');
9361
-
9362
- const { toInnerRadiusPointOf, copy: copy$2, setRadius } = PointHelper;
9363
- const inner = {};
9364
- const leaf = exports.Leaf.prototype;
9365
- leaf.__hitWorld = function (point) {
9366
- const data = this.__;
9367
- if (!data.hitSelf)
9368
- return false;
9369
- const world = this.__world, layout = this.__layout;
9370
- const isSmall = world.width < 10 && world.height < 10;
9371
- if (data.hitRadius) {
9372
- copy$2(inner, point), point = inner;
9373
- setRadius(point, data.hitRadius);
9374
- }
9375
- toInnerRadiusPointOf(point, world, inner);
9376
- if (data.hitBox || isSmall) {
9377
- if (BoundsHelper.hitRadiusPoint(layout.boxBounds, inner))
9378
- return true;
9379
- if (isSmall)
9380
- return false;
9381
- }
9382
- if (layout.hitCanvasChanged || !this.__hitCanvas) {
9383
- this.__updateHitCanvas();
9384
- if (!layout.boundsChanged)
9385
- layout.hitCanvasChanged = false;
9386
- }
9387
- return this.__hit(inner);
9388
- };
9389
- leaf.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitFill(inner, this.__.windingRule); };
9390
- leaf.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitStroke(inner, strokeWidth); };
9391
- leaf.__hitPixel = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitPixel(inner, this.__layout.renderBounds, this.__hitCanvas.hitScale); };
9392
- leaf.__drawHitPath = function (canvas) { if (canvas)
9393
- this.__drawRenderPath(canvas); };
9394
-
9395
- const matrix = new Matrix();
9396
- const ui$1 = exports.UI.prototype;
9397
- ui$1.__updateHitCanvas = function () {
9398
- if (this.__box)
9399
- this.__box.__updateHitCanvas();
9400
- const data = this.__, { hitCanvasManager } = this.leafer || this.parent.leafer;
9401
- const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
9402
- const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
9403
- const isHitPixel = isHitPixelFill || isHitPixelStroke;
9404
- if (!this.__hitCanvas)
9405
- this.__hitCanvas = isHitPixel ? hitCanvasManager.getPixelType(this, { contextSettings: { willReadFrequently: true } }) : hitCanvasManager.getPathType(this);
9406
- const h = this.__hitCanvas;
9407
- if (isHitPixel) {
9408
- const { renderBounds } = this.__layout;
9409
- const size = Platform.image.hitCanvasSize;
9410
- const scale = h.hitScale = tempBounds$1.set(0, 0, size, size).getFitMatrix(renderBounds).a;
9411
- const { x, y, width, height } = tempBounds$1.set(renderBounds).scale(scale);
9412
- h.resize({ width, height, pixelRatio: 1 });
9413
- h.clear();
9414
- ImageManager.patternLocked = true;
9415
- this.__renderShape(h, { matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y) }, !isHitPixelFill, !isHitPixelStroke);
9416
- ImageManager.patternLocked = false;
9417
- h.resetTransform();
9418
- data.__isHitPixel = true;
9419
- }
9420
- else {
9421
- data.__isHitPixel && (data.__isHitPixel = false);
9422
- }
9423
- this.__drawHitPath(h);
9424
- h.setStrokeOptions(data);
9425
- };
9426
- ui$1.__hit = function (inner) {
9427
- if (this.__box && this.__box.__hit(inner))
9428
- return true;
9429
- const data = this.__;
9430
- if (data.__isHitPixel && this.__hitPixel(inner))
9431
- return true;
9432
- const { hitFill } = data;
9433
- const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
9434
- if (needHitFillPath && this.__hitFill(inner))
9435
- return true;
9436
- const { hitStroke, __strokeWidth } = data;
9437
- const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
9438
- if (!needHitFillPath && !needHitStrokePath)
9439
- return false;
9440
- const radiusWidth = inner.radiusX * 2;
9441
- let hitWidth = radiusWidth;
9442
- if (needHitStrokePath) {
9443
- switch (data.strokeAlign) {
9444
- case 'inside':
9445
- hitWidth += __strokeWidth * 2;
9446
- if (!needHitFillPath && this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
9447
- return true;
9448
- hitWidth = radiusWidth;
9449
- break;
9450
- case 'center':
9451
- hitWidth += __strokeWidth;
9452
- break;
9453
- case 'outside':
9454
- hitWidth += __strokeWidth * 2;
9455
- if (!needHitFillPath) {
9456
- if (!this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
9457
- return true;
9458
- hitWidth = radiusWidth;
9459
- }
9460
- break;
9461
- }
9462
- }
9463
- return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
9464
- };
9465
-
9466
- const ui = exports.UI.prototype, rect = exports.Rect.prototype, box$1 = exports.Box.prototype;
9467
- rect.__updateHitCanvas = box$1.__updateHitCanvas = function () {
9468
- if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all')
9469
- ui.__updateHitCanvas.call(this);
9470
- else if (this.__hitCanvas)
9471
- this.__hitCanvas = null;
9472
- };
9473
- rect.__hitFill = box$1.__hitFill = function (inner) {
9474
- return this.__hitCanvas ? ui.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
9475
- };
9476
-
9477
- exports.Text.prototype.__drawHitPath = function (canvas) {
9478
- const { __lineHeight, fontSize, __baseLine, __letterSpacing, __textDrawData: data } = this.__;
9479
- canvas.beginPath();
9480
- if (__letterSpacing < 0)
9481
- this.__drawPathByBox(canvas);
9482
- else
9483
- data.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight < fontSize ? fontSize : __lineHeight));
9484
- };
9485
-
9486
- function getSelector(ui) {
9487
- return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
9488
- }
9489
- exports.Group.prototype.pick = function (hitPoint, options) {
9490
- options || (options = emptyData);
9491
- this.updateLayout();
9492
- return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
9493
- };
9494
-
9495
- const canvas = LeaferCanvasBase.prototype;
9496
- canvas.hitFill = function (point, fillRule) {
9497
- return fillRule ? this.context.isPointInPath(point.x, point.y, fillRule) : this.context.isPointInPath(point.x, point.y);
9498
- };
9499
- canvas.hitStroke = function (point, strokeWidth) {
9500
- this.strokeWidth = strokeWidth;
9501
- return this.context.isPointInStroke(point.x, point.y);
9502
- };
9503
- canvas.hitPixel = function (radiusPoint, offset, scale = 1) {
9504
- let { x, y, radiusX, radiusY } = radiusPoint;
9505
- if (offset)
9506
- x -= offset.x, y -= offset.y;
9507
- tempBounds$1.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
9508
- const { data } = this.context.getImageData(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width || 1, tempBounds$1.height || 1);
9509
- for (let i = 0, len = data.length; i < len; i += 4) {
9510
- if (data[i + 3] > 0)
9511
- return true;
9512
- }
9513
- return data[3] > 0;
9514
- };
9515
-
9516
8997
  function strokeText(stroke, ui, canvas) {
9517
8998
  switch (ui.__.strokeAlign) {
9518
8999
  case 'center':
@@ -9538,11 +9019,14 @@ var LeaferUI = (function (exports) {
9538
9019
  out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
9539
9020
  fillText(ui, out);
9540
9021
  out.blendMode = 'normal';
9022
+ copyWorld(canvas, out, ui);
9023
+ out.recycle(ui.__nowWorld);
9024
+ }
9025
+ function copyWorld(canvas, out, ui) {
9541
9026
  if (ui.__worldFlipped || Platform.fullImageShadow)
9542
9027
  canvas.copyWorldByReset(out, ui.__nowWorld);
9543
9028
  else
9544
9029
  canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
9545
- out.recycle(ui.__nowWorld);
9546
9030
  }
9547
9031
  function drawTextStroke(ui, canvas) {
9548
9032
  let row, data = ui.__.__textDrawData;
@@ -9611,9 +9095,8 @@ var LeaferUI = (function (exports) {
9611
9095
  Paint.strokeArrow(stroke, ui, canvas);
9612
9096
  }
9613
9097
  function drawInside(stroke, ui, canvas) {
9614
- const data = ui.__;
9615
9098
  canvas.save();
9616
- data.windingRule ? canvas.clip(data.windingRule) : canvas.clip();
9099
+ canvas.clipUI(ui);
9617
9100
  drawCenter(stroke, 2, ui, canvas);
9618
9101
  canvas.restore();
9619
9102
  }
@@ -9627,12 +9110,9 @@ var LeaferUI = (function (exports) {
9627
9110
  const out = canvas.getSameCanvas(true, true);
9628
9111
  ui.__drawRenderPath(out);
9629
9112
  drawCenter(stroke, 2, ui, out);
9630
- data.windingRule ? out.clip(data.windingRule) : out.clip();
9113
+ out.clipUI(data);
9631
9114
  out.clearWorld(renderBounds);
9632
- if (ui.__worldFlipped || Platform.fullImageShadow)
9633
- canvas.copyWorldByReset(out, ui.__nowWorld);
9634
- else
9635
- canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
9115
+ copyWorld(canvas, out, ui);
9636
9116
  out.recycle(ui.__nowWorld);
9637
9117
  }
9638
9118
  }
@@ -9688,9 +9168,7 @@ var LeaferUI = (function (exports) {
9688
9168
  paints = [paints];
9689
9169
  recycleMap = PaintImage.recycleImage(attrName, data);
9690
9170
  for (let i = 0, len = paints.length, item; i < len; i++) {
9691
- item = getLeafPaint(attrName, paints[i], ui);
9692
- if (item)
9693
- leafPaints.push(item);
9171
+ (item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
9694
9172
  }
9695
9173
  data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
9696
9174
  if (leafPaints.length) {
@@ -9728,8 +9206,8 @@ var LeaferUI = (function (exports) {
9728
9206
  data = PaintGradient.conicGradient(paint, boxBounds);
9729
9207
  break;
9730
9208
  case 'solid':
9731
- const { type, blendMode, color, opacity } = paint;
9732
- data = { type, blendMode, style: ColorConvert.string(color, opacity) };
9209
+ const { type, color, opacity } = paint;
9210
+ data = { type, style: ColorConvert.string(color, opacity) };
9733
9211
  break;
9734
9212
  default:
9735
9213
  if (paint.r !== undefined)
@@ -10106,7 +9584,7 @@ var LeaferUI = (function (exports) {
10106
9584
  }
10107
9585
  function drawImage(ui, canvas, paint, data) {
10108
9586
  canvas.save();
10109
- ui.windingRule ? canvas.clip(ui.windingRule) : canvas.clip();
9587
+ canvas.clipUI(ui);
10110
9588
  if (paint.blendMode)
10111
9589
  canvas.blendMode = paint.blendMode;
10112
9590
  if (data.opacity)
@@ -10271,12 +9749,10 @@ var LeaferUI = (function (exports) {
10271
9749
  }
10272
9750
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
10273
9751
  }
10274
- if (ui.__worldFlipped) {
9752
+ if (ui.__worldFlipped)
10275
9753
  current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
10276
- }
10277
- else {
9754
+ else
10278
9755
  current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
10279
- }
10280
9756
  if (end && index < end)
10281
9757
  other.clearWorld(copyBounds, true);
10282
9758
  });
@@ -10335,12 +9811,10 @@ var LeaferUI = (function (exports) {
10335
9811
  copyBounds = bounds;
10336
9812
  }
10337
9813
  other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
10338
- if (ui.__worldFlipped) {
9814
+ if (ui.__worldFlipped)
10339
9815
  current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
10340
- }
10341
- else {
9816
+ else
10342
9817
  current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
10343
- }
10344
9818
  if (end && index < end)
10345
9819
  other.clearWorld(copyBounds, true);
10346
9820
  });