leafer-draw 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.
@@ -490,19 +490,19 @@ const PointHelper = {
490
490
  },
491
491
  tempToInnerOf(t, matrix) {
492
492
  const { tempPoint: temp } = P$5;
493
- copy$b(temp, t);
493
+ copy$a(temp, t);
494
494
  toInnerPoint$2(matrix, temp, temp);
495
495
  return temp;
496
496
  },
497
497
  tempToOuterOf(t, matrix) {
498
498
  const { tempPoint: temp } = P$5;
499
- copy$b(temp, t);
499
+ copy$a(temp, t);
500
500
  toOuterPoint$3(matrix, temp, temp);
501
501
  return temp;
502
502
  },
503
503
  tempToInnerRadiusPointOf(t, matrix) {
504
504
  const { tempRadiusPoint: temp } = P$5;
505
- copy$b(temp, t);
505
+ copy$a(temp, t);
506
506
  P$5.toInnerRadiusPointOf(t, matrix, temp);
507
507
  return temp;
508
508
  },
@@ -575,7 +575,7 @@ const PointHelper = {
575
575
  }
576
576
  };
577
577
  const P$5 = PointHelper;
578
- const { getDistanceFrom, copy: copy$b, getAtan2 } = P$5;
578
+ const { getDistanceFrom, copy: copy$a, getAtan2 } = P$5;
579
579
 
580
580
  class Point {
581
581
  constructor(x, y) {
@@ -932,7 +932,7 @@ const BoundsHelper = {
932
932
  to = t;
933
933
  }
934
934
  else {
935
- copy$a(to, t);
935
+ copy$9(to, t);
936
936
  }
937
937
  if (parent) {
938
938
  to.offsetX = -(B.maxX(parent) - t.x);
@@ -1090,7 +1090,7 @@ const BoundsHelper = {
1090
1090
  if (first) {
1091
1091
  first = false;
1092
1092
  if (!addMode)
1093
- copy$a(t, bounds);
1093
+ copy$9(t, bounds);
1094
1094
  }
1095
1095
  else {
1096
1096
  add$1(t, bounds);
@@ -1171,7 +1171,7 @@ const BoundsHelper = {
1171
1171
  }
1172
1172
  };
1173
1173
  const B = BoundsHelper;
1174
- const { add: add$1, copy: copy$a } = B;
1174
+ const { add: add$1, copy: copy$9 } = B;
1175
1175
 
1176
1176
  class Bounds {
1177
1177
  get minX() { return BoundsHelper.minX(this); }
@@ -2066,7 +2066,7 @@ __decorate([
2066
2066
  contextMethod()
2067
2067
  ], Canvas$1.prototype, "strokeText", null);
2068
2068
 
2069
- const { copy: copy$9, multiplyParent: multiplyParent$3 } = MatrixHelper, { round: round$1 } = Math;
2069
+ const { copy: copy$8, multiplyParent: multiplyParent$3 } = MatrixHelper, { round: round$1 } = Math;
2070
2070
  const minSize = { width: 1, height: 1, pixelRatio: 1 };
2071
2071
  const canvasSizeAttrs = ['width', 'height', 'pixelRatio'];
2072
2072
  class LeaferCanvasBase extends Canvas$1 {
@@ -2269,16 +2269,19 @@ class LeaferCanvasBase extends Canvas$1 {
2269
2269
  if (blendMode)
2270
2270
  this.blendMode = 'source-over';
2271
2271
  }
2272
- clearWorld(bounds, ceilPixel) {
2273
- this.setTempBounds(bounds, ceilPixel);
2274
- this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2275
- }
2276
2272
  clipWorld(bounds, ceilPixel) {
2277
2273
  this.beginPath();
2278
2274
  this.setTempBounds(bounds, ceilPixel);
2279
2275
  this.rect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2280
2276
  this.clip();
2281
2277
  }
2278
+ clipUI(ruleData) {
2279
+ ruleData.windingRule ? this.clip(ruleData.windingRule) : this.clip();
2280
+ }
2281
+ clearWorld(bounds, ceilPixel) {
2282
+ this.setTempBounds(bounds, ceilPixel);
2283
+ this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2284
+ }
2282
2285
  clear() {
2283
2286
  const { pixelRatio } = this;
2284
2287
  this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
@@ -2298,7 +2301,7 @@ class LeaferCanvasBase extends Canvas$1 {
2298
2301
  const { size, pixelSnap } = this, canvas = this.manager ? this.manager.get(size) : Creator.canvas(Object.assign({}, size));
2299
2302
  canvas.save();
2300
2303
  if (useSameWorldTransform)
2301
- copy$9(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2304
+ copy$8(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2302
2305
  if (useSameSmooth)
2303
2306
  canvas.smooth = this.smooth;
2304
2307
  canvas.pixelSnap !== pixelSnap && (canvas.pixelSnap = pixelSnap);
@@ -2677,7 +2680,7 @@ const EllipseHelper = {
2677
2680
  };
2678
2681
 
2679
2682
  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;
2680
- const { rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
2683
+ const { rect: rect$2, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
2681
2684
  const { ellipticalArc } = EllipseHelper;
2682
2685
  const debug$c = Debug.get('PathConvert');
2683
2686
  const setEndPoint$1 = {};
@@ -2874,7 +2877,7 @@ const PathConvert = {
2874
2877
  case N$3:
2875
2878
  x = old[i + 1];
2876
2879
  y = old[i + 2];
2877
- curveMode ? rect$3(data, x, y, old[i + 3], old[i + 4]) : copyData(data, old, i, 5);
2880
+ curveMode ? rect$2(data, x, y, old[i + 3], old[i + 4]) : copyData(data, old, i, 5);
2878
2881
  i += 5;
2879
2882
  break;
2880
2883
  case D$3:
@@ -3050,7 +3053,7 @@ const PathCommandDataHelper = {
3050
3053
  };
3051
3054
  const { ellipse: ellipse$3, arc: arc$2 } = PathCommandDataHelper;
3052
3055
 
3053
- 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;
3056
+ 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;
3054
3057
  class PathCreator {
3055
3058
  set path(value) { this.__path = value; }
3056
3059
  get path() { return this.__path; }
@@ -3097,7 +3100,7 @@ class PathCreator {
3097
3100
  return this;
3098
3101
  }
3099
3102
  rect(x, y, width, height) {
3100
- rect$2(this.__path, x, y, width, height);
3103
+ rect$1(this.__path, x, y, width, height);
3101
3104
  this.paint();
3102
3105
  return this;
3103
3106
  }
@@ -3215,7 +3218,7 @@ const PathDrawer = {
3215
3218
 
3216
3219
  const { M: M$1, L: L$2, C, Q, Z: Z$1, N, D, X, G, F: F$1, O, P, U } = PathCommandMap;
3217
3220
  const { toTwoPointBounds, toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc, ellipse: ellipse$1 } = BezierHelper;
3218
- const { addPointBounds, copy: copy$8, addPoint, setPoint, addBounds, toBounds: toBounds$2 } = TwoPointBoundsHelper;
3221
+ const { addPointBounds, copy: copy$7, addPoint, setPoint, addBounds, toBounds: toBounds$2 } = TwoPointBoundsHelper;
3219
3222
  const debug$a = Debug.get('PathBounds');
3220
3223
  let radius, radiusX, radiusY;
3221
3224
  const tempPointBounds = {};
@@ -3287,7 +3290,7 @@ const PathBounds = {
3287
3290
  break;
3288
3291
  case G:
3289
3292
  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);
3290
- i === 0 ? copy$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3293
+ i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3291
3294
  x = setEndPoint.x;
3292
3295
  y = setEndPoint.y;
3293
3296
  i += 9;
@@ -3303,7 +3306,7 @@ const PathBounds = {
3303
3306
  break;
3304
3307
  case O:
3305
3308
  arc(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], tempPointBounds, setEndPoint);
3306
- i === 0 ? copy$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3309
+ i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3307
3310
  x = setEndPoint.x;
3308
3311
  y = setEndPoint.y;
3309
3312
  i += 7;
@@ -3318,7 +3321,7 @@ const PathBounds = {
3318
3321
  break;
3319
3322
  case U:
3320
3323
  arcTo$1(null, x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], tempPointBounds, setEndPoint);
3321
- i === 0 ? copy$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3324
+ i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3322
3325
  x = setEndPoint.x;
3323
3326
  y = setEndPoint.y;
3324
3327
  i += 6;
@@ -4254,8 +4257,8 @@ function registerUIEvent() {
4254
4257
  };
4255
4258
  }
4256
4259
 
4257
- const { copy: copy$7, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
4258
- const matrix$1 = {}, { round } = Math;
4260
+ const { copy: copy$6, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
4261
+ const matrix = {}, { round } = Math;
4259
4262
  const LeafHelper = {
4260
4263
  updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
4261
4264
  if (checkAutoLayout && leaf.__hasAutoLayout && leaf.__layout.matrixChanged)
@@ -4350,13 +4353,13 @@ const LeafHelper = {
4350
4353
  transition = scaleY;
4351
4354
  scaleY = scaleX;
4352
4355
  }
4353
- copy$7(matrix$1, o);
4354
- scaleOfOuter$2(matrix$1, origin, scaleX, scaleY);
4356
+ copy$6(matrix, o);
4357
+ scaleOfOuter$2(matrix, origin, scaleX, scaleY);
4355
4358
  if (t.origin || t.around) {
4356
- L.setTransform(t, matrix$1, resize, transition);
4359
+ L.setTransform(t, matrix, resize, transition);
4357
4360
  }
4358
4361
  else {
4359
- const x = t.x + matrix$1.e - o.e, y = t.y + matrix$1.f - o.f;
4362
+ const x = t.x + matrix.e - o.e, y = t.y + matrix.f - o.f;
4360
4363
  if (transition && !resize)
4361
4364
  t.animate({ x, y, scaleX: t.scaleX * scaleX, scaleY: t.scaleY * scaleY }, transition);
4362
4365
  else
@@ -4368,32 +4371,32 @@ const LeafHelper = {
4368
4371
  },
4369
4372
  rotateOfLocal(t, origin, angle, transition) {
4370
4373
  const o = t.__localMatrix;
4371
- copy$7(matrix$1, o);
4372
- rotateOfOuter$2(matrix$1, origin, angle);
4374
+ copy$6(matrix, o);
4375
+ rotateOfOuter$2(matrix, origin, angle);
4373
4376
  if (t.origin || t.around)
4374
- L.setTransform(t, matrix$1, false, transition);
4377
+ L.setTransform(t, matrix, false, transition);
4375
4378
  else
4376
- 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);
4379
+ t.set({ x: t.x + matrix.e - o.e, y: t.y + matrix.f - o.f, rotation: MathHelper.formatRotation(t.rotation + angle) }, transition);
4377
4380
  },
4378
4381
  skewOfWorld(t, origin, skewX, skewY, resize, transition) {
4379
4382
  L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
4380
4383
  },
4381
4384
  skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
4382
- copy$7(matrix$1, t.__localMatrix);
4383
- skewOfOuter(matrix$1, origin, skewX, skewY);
4384
- L.setTransform(t, matrix$1, resize, transition);
4385
+ copy$6(matrix, t.__localMatrix);
4386
+ skewOfOuter(matrix, origin, skewX, skewY);
4387
+ L.setTransform(t, matrix, resize, transition);
4385
4388
  },
4386
4389
  transformWorld(t, transform, resize, transition) {
4387
- copy$7(matrix$1, t.worldTransform);
4388
- multiplyParent$2(matrix$1, transform);
4390
+ copy$6(matrix, t.worldTransform);
4391
+ multiplyParent$2(matrix, transform);
4389
4392
  if (t.parent)
4390
- divideParent(matrix$1, t.parent.worldTransform);
4391
- L.setTransform(t, matrix$1, resize, transition);
4393
+ divideParent(matrix, t.parent.worldTransform);
4394
+ L.setTransform(t, matrix, resize, transition);
4392
4395
  },
4393
4396
  transform(t, transform, resize, transition) {
4394
- copy$7(matrix$1, t.localTransform);
4395
- multiplyParent$2(matrix$1, transform);
4396
- L.setTransform(t, matrix$1, resize, transition);
4397
+ copy$6(matrix, t.localTransform);
4398
+ multiplyParent$2(matrix, transform);
4399
+ L.setTransform(t, matrix, resize, transition);
4397
4400
  },
4398
4401
  setTransform(t, transform, resize, transition) {
4399
4402
  const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
@@ -4427,9 +4430,9 @@ const LeafHelper = {
4427
4430
  return innerOrigin;
4428
4431
  },
4429
4432
  getRelativeWorld(t, relative, temp) {
4430
- copy$7(matrix$1, t.worldTransform);
4431
- divideParent(matrix$1, relative.worldTransform);
4432
- return temp ? matrix$1 : Object.assign({}, matrix$1);
4433
+ copy$6(matrix, t.worldTransform);
4434
+ divideParent(matrix, relative.worldTransform);
4435
+ return temp ? matrix : Object.assign({}, matrix);
4433
4436
  },
4434
4437
  drop(t, parent, index, resize) {
4435
4438
  t.setTransform(L.getRelativeWorld(t, parent, true), resize);
@@ -4568,7 +4571,7 @@ const WaitHelper = {
4568
4571
  };
4569
4572
 
4570
4573
  const { getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2 } = LeafHelper;
4571
- const { toOuterOf: toOuterOf$2, getPoints, copy: copy$6 } = BoundsHelper;
4574
+ const { toOuterOf: toOuterOf$2, getPoints, copy: copy$5 } = BoundsHelper;
4572
4575
  const localContent = '_localContentBounds';
4573
4576
  const worldContent = '_worldContentBounds', worldBox = '_worldBoxBounds', worldStroke = '_worldStrokeBounds';
4574
4577
  class LeafLayout {
@@ -4728,7 +4731,7 @@ class LeafLayout {
4728
4731
  }
4729
4732
  if (!layoutBounds)
4730
4733
  layoutBounds = MatrixHelper.getLayout(matrix);
4731
- copy$6(layoutBounds, bounds);
4734
+ copy$5(layoutBounds, bounds);
4732
4735
  PointHelper.copy(layoutBounds, point);
4733
4736
  if (unscale) {
4734
4737
  const { scaleX, scaleY } = layoutBounds;
@@ -5282,7 +5285,7 @@ const LeafMatrix = {
5282
5285
 
5283
5286
  const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2 } = LeafHelper;
5284
5287
  const { updateBounds: updateBounds$1 } = BranchHelper;
5285
- const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$5 } = BoundsHelper;
5288
+ const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$4 } = BoundsHelper;
5286
5289
  const { toBounds: toBounds$1 } = PathBounds;
5287
5290
  const LeafBounds = {
5288
5291
  __updateWorldBounds() {
@@ -5413,7 +5416,7 @@ const LeafBounds = {
5413
5416
  },
5414
5417
  __updateRenderBounds() {
5415
5418
  const layout = this.__layout;
5416
- layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$5(layout.renderBounds, layout.strokeBounds);
5419
+ layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$4(layout.renderBounds, layout.strokeBounds);
5417
5420
  }
5418
5421
  };
5419
5422
 
@@ -5447,7 +5450,7 @@ const LeafRender = {
5447
5450
  if (this.__worldOpacity) {
5448
5451
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
5449
5452
  this.__drawRenderPath(canvas);
5450
- this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
5453
+ canvas.clipUI(this);
5451
5454
  }
5452
5455
  },
5453
5456
  __updateWorldOpacity() {
@@ -5518,7 +5521,7 @@ const BranchRender = {
5518
5521
  const { LEAF, create } = IncrementId;
5519
5522
  const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
5520
5523
  const { toOuterOf } = BoundsHelper;
5521
- const { copy: copy$4, move } = PointHelper;
5524
+ const { copy: copy$3, move } = PointHelper;
5522
5525
  const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
5523
5526
  let Leaf = class Leaf {
5524
5527
  get tag() { return this.__tag; }
@@ -5731,7 +5734,7 @@ let Leaf = class Leaf {
5731
5734
  }
5732
5735
  else {
5733
5736
  if (to)
5734
- copy$4(to, world);
5737
+ copy$3(to, world);
5735
5738
  }
5736
5739
  }
5737
5740
  localToWorld(local, to, distance, relative) {
@@ -5740,7 +5743,7 @@ let Leaf = class Leaf {
5740
5743
  }
5741
5744
  else {
5742
5745
  if (to)
5743
- copy$4(to, local);
5746
+ copy$3(to, local);
5744
5747
  }
5745
5748
  }
5746
5749
  worldToInner(world, to, distance, relative) {
@@ -6230,7 +6233,7 @@ class LeafLevelList {
6230
6233
  }
6231
6234
  }
6232
6235
 
6233
- const version = "1.6.3";
6236
+ const version = "1.6.4";
6234
6237
 
6235
6238
  const debug$4 = Debug.get('LeaferCanvas');
6236
6239
  class LeaferCanvas extends LeaferCanvasBase {
@@ -7550,7 +7553,7 @@ const UIRender = {
7550
7553
  __drawAfterFill(canvas, options) {
7551
7554
  if (this.__.__clipAfterFill) {
7552
7555
  canvas.save();
7553
- this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
7556
+ canvas.clipUI();
7554
7557
  this.__drawContent(canvas, options);
7555
7558
  canvas.restore();
7556
7559
  }
@@ -8416,8 +8419,8 @@ Rect = __decorate([
8416
8419
  registerUI()
8417
8420
  ], Rect);
8418
8421
 
8419
- const { copy: copy$3, add, includes: includes$1 } = BoundsHelper;
8420
- const rect$1 = Rect.prototype, group = Group.prototype;
8422
+ const { copy: copy$2, add, includes: includes$1 } = BoundsHelper;
8423
+ const rect = Rect.prototype, group = Group.prototype;
8421
8424
  const childrenRenderBounds = {};
8422
8425
  let Box = class Box extends Group {
8423
8426
  get __tag() { return 'Box'; }
@@ -8462,7 +8465,7 @@ let Box = class Box extends Group {
8462
8465
  const { renderBounds } = this.__layout;
8463
8466
  if (this.children.length) {
8464
8467
  super.__updateRenderBounds();
8465
- copy$3(childrenRenderBounds, renderBounds);
8468
+ copy$2(childrenRenderBounds, renderBounds);
8466
8469
  this.__updateRectRenderBounds();
8467
8470
  isOverflow = !includes$1(renderBounds, childrenRenderBounds);
8468
8471
  if (isOverflow && this.__.overflow !== 'hide')
@@ -8514,25 +8517,25 @@ __decorate([
8514
8517
  affectRenderBoundsType('show')
8515
8518
  ], Box.prototype, "overflow", void 0);
8516
8519
  __decorate([
8517
- rewrite(rect$1.__updateStrokeSpread)
8520
+ rewrite(rect.__updateStrokeSpread)
8518
8521
  ], Box.prototype, "__updateStrokeSpread", null);
8519
8522
  __decorate([
8520
- rewrite(rect$1.__updateRenderSpread)
8523
+ rewrite(rect.__updateRenderSpread)
8521
8524
  ], Box.prototype, "__updateRectRenderSpread", null);
8522
8525
  __decorate([
8523
- rewrite(rect$1.__updateBoxBounds)
8526
+ rewrite(rect.__updateBoxBounds)
8524
8527
  ], Box.prototype, "__updateRectBoxBounds", null);
8525
8528
  __decorate([
8526
- rewrite(rect$1.__updateStrokeBounds)
8529
+ rewrite(rect.__updateStrokeBounds)
8527
8530
  ], Box.prototype, "__updateStrokeBounds", null);
8528
8531
  __decorate([
8529
- rewrite(rect$1.__updateRenderBounds)
8532
+ rewrite(rect.__updateRenderBounds)
8530
8533
  ], Box.prototype, "__updateRectRenderBounds", null);
8531
8534
  __decorate([
8532
- rewrite(rect$1.__updateChange)
8535
+ rewrite(rect.__updateChange)
8533
8536
  ], Box.prototype, "__updateRectChange", null);
8534
8537
  __decorate([
8535
- rewrite(rect$1.__render)
8538
+ rewrite(rect.__render)
8536
8539
  ], Box.prototype, "__renderRect", null);
8537
8540
  __decorate([
8538
8541
  rewrite(group.__render)
@@ -9035,6 +9038,9 @@ __decorate([
9035
9038
  __decorate([
9036
9039
  boundsType('show')
9037
9040
  ], Text.prototype, "textOverflow", void 0);
9041
+ __decorate([
9042
+ surfaceType(false)
9043
+ ], Text.prototype, "textEditing", void 0);
9038
9044
  Text = __decorate([
9039
9045
  registerUI()
9040
9046
  ], Text);
@@ -9166,531 +9172,6 @@ function fillPathOrText(ui, canvas) {
9166
9172
  ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
9167
9173
  }
9168
9174
 
9169
- let App = class App extends Leafer {
9170
- get __tag() { return 'App'; }
9171
- get isApp() { return true; }
9172
- constructor(userConfig, data) {
9173
- super(userConfig, data);
9174
- }
9175
- init(userConfig, parentApp) {
9176
- super.init(userConfig, parentApp);
9177
- if (userConfig) {
9178
- const { ground, tree, sky, editor } = userConfig;
9179
- if (ground)
9180
- this.ground = this.addLeafer(ground);
9181
- if (tree || editor)
9182
- this.tree = this.addLeafer(tree || { type: userConfig.type || 'design' });
9183
- if (sky || editor)
9184
- this.sky = this.addLeafer(sky);
9185
- if (editor)
9186
- Creator.editor(editor, this);
9187
- }
9188
- }
9189
- __setApp() {
9190
- const { canvas } = this;
9191
- const { realCanvas, view } = this.config;
9192
- if (realCanvas || view === this.canvas.view || !canvas.parentView)
9193
- this.realCanvas = true;
9194
- else
9195
- canvas.unrealCanvas();
9196
- this.leafer = this;
9197
- this.watcher.disable();
9198
- this.layouter.disable();
9199
- }
9200
- __updateLocalBounds() {
9201
- this.forEach(leafer => leafer.updateLayout());
9202
- super.__updateLocalBounds();
9203
- }
9204
- start() {
9205
- super.start();
9206
- this.forEach(leafer => leafer.start());
9207
- }
9208
- stop() {
9209
- this.forEach(leafer => leafer.stop());
9210
- super.stop();
9211
- }
9212
- unlockLayout() {
9213
- super.unlockLayout();
9214
- this.forEach(leafer => leafer.unlockLayout());
9215
- }
9216
- lockLayout() {
9217
- super.lockLayout();
9218
- this.forEach(leafer => leafer.lockLayout());
9219
- }
9220
- forceRender(bounds, sync) {
9221
- this.forEach(leafer => leafer.forceRender(bounds, sync));
9222
- }
9223
- addLeafer(merge) {
9224
- const leafer = new Leafer(merge);
9225
- this.add(leafer);
9226
- return leafer;
9227
- }
9228
- add(leafer, index) {
9229
- if (!leafer.view) {
9230
- if (this.realCanvas && !this.canvas.bounds) {
9231
- setTimeout(() => this.add(leafer, index), 10);
9232
- return;
9233
- }
9234
- leafer.init(this.__getChildConfig(leafer.userConfig), this);
9235
- }
9236
- super.add(leafer, index);
9237
- if (index !== undefined)
9238
- leafer.canvas.childIndex = index;
9239
- this.__listenChildEvents(leafer);
9240
- }
9241
- forEach(fn) {
9242
- this.children.forEach(fn);
9243
- }
9244
- __onCreated() {
9245
- this.created = this.children.every(child => child.created);
9246
- }
9247
- __onReady() {
9248
- if (this.children.every(child => child.ready))
9249
- super.__onReady();
9250
- }
9251
- __onViewReady() {
9252
- if (this.children.every(child => child.viewReady))
9253
- super.__onViewReady();
9254
- }
9255
- __onChildRenderEnd(e) {
9256
- this.renderer.addBlock(e.renderBounds);
9257
- if (this.viewReady)
9258
- this.renderer.update();
9259
- }
9260
- __render(canvas, options) {
9261
- if (canvas.context)
9262
- this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
9263
- }
9264
- __onResize(event) {
9265
- this.forEach(leafer => leafer.resize(event));
9266
- super.__onResize(event);
9267
- }
9268
- updateLayout() {
9269
- this.forEach(leafer => leafer.updateLayout());
9270
- }
9271
- __getChildConfig(userConfig) {
9272
- const config = Object.assign({}, this.config);
9273
- config.hittable = config.realCanvas = undefined;
9274
- if (userConfig)
9275
- DataHelper.assign(config, userConfig);
9276
- if (this.autoLayout)
9277
- DataHelper.copyAttrs(config, this, canvasSizeAttrs);
9278
- config.view = this.realCanvas ? undefined : this.view;
9279
- config.fill = undefined;
9280
- return config;
9281
- }
9282
- __listenChildEvents(leafer) {
9283
- leafer.once([
9284
- [LayoutEvent.END, this.__onReady, this],
9285
- [RenderEvent.START, this.__onCreated, this],
9286
- [RenderEvent.END, this.__onViewReady, this]
9287
- ]);
9288
- if (this.realCanvas)
9289
- this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
9290
- }
9291
- };
9292
- App = __decorate([
9293
- registerUI()
9294
- ], App);
9295
-
9296
- const downKeyMap = {};
9297
- const Keyboard = {
9298
- isHoldSpaceKey() {
9299
- return Keyboard.isHold('Space');
9300
- },
9301
- isHold(code) {
9302
- return downKeyMap[code];
9303
- },
9304
- setDownCode(code) {
9305
- if (!downKeyMap[code])
9306
- downKeyMap[code] = true;
9307
- },
9308
- setUpCode(code) {
9309
- downKeyMap[code] = false;
9310
- }
9311
- };
9312
-
9313
- const PointerButton = {
9314
- LEFT: 1,
9315
- RIGHT: 2,
9316
- MIDDLE: 4,
9317
- defaultLeft(event) { if (!event.buttons)
9318
- event.buttons = 1; },
9319
- left(event) { return event.buttons === 1; },
9320
- right(event) { return event.buttons === 2; },
9321
- middle(event) { return event.buttons === 4; }
9322
- };
9323
-
9324
- class UIEvent extends Event {
9325
- get spaceKey() { return Keyboard.isHoldSpaceKey(); }
9326
- get left() { return PointerButton.left(this); }
9327
- get right() { return PointerButton.right(this); }
9328
- get middle() { return PointerButton.middle(this); }
9329
- constructor(params) {
9330
- super(params.type);
9331
- this.bubbles = true;
9332
- Object.assign(this, params);
9333
- }
9334
- getBoxPoint(relative) {
9335
- return (relative || this.current).getBoxPoint(this);
9336
- }
9337
- getInnerPoint(relative) {
9338
- return (relative || this.current).getInnerPoint(this);
9339
- }
9340
- getLocalPoint(relative) {
9341
- return (relative || this.current).getLocalPoint(this);
9342
- }
9343
- getPagePoint() {
9344
- return this.current.getPagePoint(this);
9345
- }
9346
- getInner(relative) { return this.getInnerPoint(relative); }
9347
- getLocal(relative) { return this.getLocalPoint(relative); }
9348
- getPage() { return this.getPagePoint(); }
9349
- static changeName(oldName, newName) {
9350
- EventCreator.changeName(oldName, newName);
9351
- }
9352
- }
9353
-
9354
- let PointerEvent$1 = class PointerEvent extends UIEvent {
9355
- };
9356
- PointerEvent$1.POINTER = 'pointer';
9357
- PointerEvent$1.BEFORE_DOWN = 'pointer.before_down';
9358
- PointerEvent$1.BEFORE_MOVE = 'pointer.before_move';
9359
- PointerEvent$1.BEFORE_UP = 'pointer.before_up';
9360
- PointerEvent$1.DOWN = 'pointer.down';
9361
- PointerEvent$1.MOVE = 'pointer.move';
9362
- PointerEvent$1.UP = 'pointer.up';
9363
- PointerEvent$1.OVER = 'pointer.over';
9364
- PointerEvent$1.OUT = 'pointer.out';
9365
- PointerEvent$1.ENTER = 'pointer.enter';
9366
- PointerEvent$1.LEAVE = 'pointer.leave';
9367
- PointerEvent$1.TAP = 'tap';
9368
- PointerEvent$1.DOUBLE_TAP = 'double_tap';
9369
- PointerEvent$1.CLICK = 'click';
9370
- PointerEvent$1.DOUBLE_CLICK = 'double_click';
9371
- PointerEvent$1.LONG_PRESS = 'long_press';
9372
- PointerEvent$1.LONG_TAP = 'long_tap';
9373
- PointerEvent$1.MENU = 'pointer.menu';
9374
- PointerEvent$1.MENU_TAP = 'pointer.menu_tap';
9375
- PointerEvent$1 = __decorate([
9376
- registerUIEvent()
9377
- ], PointerEvent$1);
9378
-
9379
- const tempMove = {};
9380
- let DragEvent$1 = class DragEvent extends PointerEvent$1 {
9381
- static setList(data) {
9382
- this.list = data instanceof LeafList ? data : new LeafList(data);
9383
- }
9384
- static setData(data) {
9385
- this.data = data;
9386
- }
9387
- static getValidMove(leaf, start, total) {
9388
- const { draggable, dragBounds } = leaf, move = leaf.getLocalPoint(total, null, true);
9389
- PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
9390
- if (dragBounds)
9391
- this.getMoveInDragBounds(leaf.__localBoxBounds, dragBounds === 'parent' ? leaf.parent.boxBounds : dragBounds, move, true);
9392
- if (draggable === 'x')
9393
- move.y = 0;
9394
- if (draggable === 'y')
9395
- move.x = 0;
9396
- return move;
9397
- }
9398
- static getMoveInDragBounds(childBox, dragBounds, move, change) {
9399
- const x = childBox.x + move.x, y = childBox.y + move.y, right = x + childBox.width, bottom = y + childBox.height;
9400
- const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
9401
- if (!change)
9402
- move = Object.assign({}, move);
9403
- if (BoundsHelper.includes(childBox, dragBounds)) {
9404
- if (x > dragBounds.x)
9405
- move.x += dragBounds.x - x;
9406
- else if (right < boundsRight)
9407
- move.x += boundsRight - right;
9408
- if (y > dragBounds.y)
9409
- move.y += dragBounds.y - y;
9410
- else if (bottom < boundsBottom)
9411
- move.y += boundsBottom - bottom;
9412
- }
9413
- else {
9414
- if (x < dragBounds.x)
9415
- move.x += dragBounds.x - x;
9416
- else if (right > boundsRight)
9417
- move.x += boundsRight - right;
9418
- if (y < dragBounds.y)
9419
- move.y += dragBounds.y - y;
9420
- else if (bottom > boundsBottom)
9421
- move.y += boundsBottom - bottom;
9422
- }
9423
- return move;
9424
- }
9425
- getPageMove(total) {
9426
- this.assignMove(total);
9427
- return this.current.getPagePoint(tempMove, null, true);
9428
- }
9429
- getInnerMove(relative, total) {
9430
- if (!relative)
9431
- relative = this.current;
9432
- this.assignMove(total);
9433
- return relative.getInnerPoint(tempMove, null, true);
9434
- }
9435
- getLocalMove(relative, total) {
9436
- if (!relative)
9437
- relative = this.current;
9438
- this.assignMove(total);
9439
- return relative.getLocalPoint(tempMove, null, true);
9440
- }
9441
- getPageTotal() {
9442
- return this.getPageMove(true);
9443
- }
9444
- getInnerTotal(relative) {
9445
- return this.getInnerMove(relative, true);
9446
- }
9447
- getLocalTotal(relative) {
9448
- return this.getLocalMove(relative, true);
9449
- }
9450
- getPageBounds() {
9451
- const total = this.getPageTotal(), start = this.getPagePoint(), bounds = {};
9452
- BoundsHelper.set(bounds, start.x - total.x, start.y - total.y, total.x, total.y);
9453
- BoundsHelper.unsign(bounds);
9454
- return bounds;
9455
- }
9456
- assignMove(total) {
9457
- tempMove.x = total ? this.totalX : this.moveX;
9458
- tempMove.y = total ? this.totalY : this.moveY;
9459
- }
9460
- };
9461
- DragEvent$1.BEFORE_DRAG = 'drag.before_drag';
9462
- DragEvent$1.START = 'drag.start';
9463
- DragEvent$1.DRAG = 'drag';
9464
- DragEvent$1.END = 'drag.end';
9465
- DragEvent$1.OVER = 'drag.over';
9466
- DragEvent$1.OUT = 'drag.out';
9467
- DragEvent$1.ENTER = 'drag.enter';
9468
- DragEvent$1.LEAVE = 'drag.leave';
9469
- DragEvent$1 = __decorate([
9470
- registerUIEvent()
9471
- ], DragEvent$1);
9472
-
9473
- let DropEvent = class DropEvent extends PointerEvent$1 {
9474
- static setList(data) {
9475
- DragEvent$1.setList(data);
9476
- }
9477
- static setData(data) {
9478
- DragEvent$1.setData(data);
9479
- }
9480
- };
9481
- DropEvent.DROP = 'drop';
9482
- DropEvent = __decorate([
9483
- registerUIEvent()
9484
- ], DropEvent);
9485
-
9486
- let MoveEvent = class MoveEvent extends DragEvent$1 {
9487
- };
9488
- MoveEvent.BEFORE_MOVE = 'move.before_move';
9489
- MoveEvent.START = 'move.start';
9490
- MoveEvent.MOVE = 'move';
9491
- MoveEvent.END = 'move.end';
9492
- MoveEvent = __decorate([
9493
- registerUIEvent()
9494
- ], MoveEvent);
9495
-
9496
- let RotateEvent = class RotateEvent extends PointerEvent$1 {
9497
- };
9498
- RotateEvent.BEFORE_ROTATE = 'rotate.before_rotate';
9499
- RotateEvent.START = 'rotate.start';
9500
- RotateEvent.ROTATE = 'rotate';
9501
- RotateEvent.END = 'rotate.end';
9502
- RotateEvent = __decorate([
9503
- registerUIEvent()
9504
- ], RotateEvent);
9505
-
9506
- let SwipeEvent = class SwipeEvent extends DragEvent$1 {
9507
- };
9508
- SwipeEvent.SWIPE = 'swipe';
9509
- SwipeEvent.LEFT = 'swipe.left';
9510
- SwipeEvent.RIGHT = 'swipe.right';
9511
- SwipeEvent.UP = 'swipe.up';
9512
- SwipeEvent.DOWN = 'swipe.down';
9513
- SwipeEvent = __decorate([
9514
- registerUIEvent()
9515
- ], SwipeEvent);
9516
-
9517
- let ZoomEvent = class ZoomEvent extends PointerEvent$1 {
9518
- };
9519
- ZoomEvent.BEFORE_ZOOM = 'zoom.before_zoom';
9520
- ZoomEvent.START = 'zoom.start';
9521
- ZoomEvent.ZOOM = 'zoom';
9522
- ZoomEvent.END = 'zoom.end';
9523
- ZoomEvent = __decorate([
9524
- registerUIEvent()
9525
- ], ZoomEvent);
9526
-
9527
- let KeyEvent = class KeyEvent extends UIEvent {
9528
- };
9529
- KeyEvent.DOWN = 'key.down';
9530
- KeyEvent.HOLD = 'key.hold';
9531
- KeyEvent.UP = 'key.up';
9532
- KeyEvent = __decorate([
9533
- registerUIEvent()
9534
- ], KeyEvent);
9535
-
9536
- new LeafList();
9537
-
9538
- Debug.get('emit');
9539
-
9540
- const { toInnerRadiusPointOf, copy: copy$2, setRadius } = PointHelper;
9541
- const inner = {};
9542
- const leaf = Leaf.prototype;
9543
- leaf.__hitWorld = function (point) {
9544
- const data = this.__;
9545
- if (!data.hitSelf)
9546
- return false;
9547
- const world = this.__world, layout = this.__layout;
9548
- const isSmall = world.width < 10 && world.height < 10;
9549
- if (data.hitRadius) {
9550
- copy$2(inner, point), point = inner;
9551
- setRadius(point, data.hitRadius);
9552
- }
9553
- toInnerRadiusPointOf(point, world, inner);
9554
- if (data.hitBox || isSmall) {
9555
- if (BoundsHelper.hitRadiusPoint(layout.boxBounds, inner))
9556
- return true;
9557
- if (isSmall)
9558
- return false;
9559
- }
9560
- if (layout.hitCanvasChanged || !this.__hitCanvas) {
9561
- this.__updateHitCanvas();
9562
- if (!layout.boundsChanged)
9563
- layout.hitCanvasChanged = false;
9564
- }
9565
- return this.__hit(inner);
9566
- };
9567
- leaf.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitFill(inner, this.__.windingRule); };
9568
- leaf.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitStroke(inner, strokeWidth); };
9569
- 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); };
9570
- leaf.__drawHitPath = function (canvas) { if (canvas)
9571
- this.__drawRenderPath(canvas); };
9572
-
9573
- const matrix = new Matrix();
9574
- const ui$1 = UI.prototype;
9575
- ui$1.__updateHitCanvas = function () {
9576
- if (this.__box)
9577
- this.__box.__updateHitCanvas();
9578
- const data = this.__, { hitCanvasManager } = this.leafer || this.parent.leafer;
9579
- const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
9580
- const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
9581
- const isHitPixel = isHitPixelFill || isHitPixelStroke;
9582
- if (!this.__hitCanvas)
9583
- this.__hitCanvas = isHitPixel ? hitCanvasManager.getPixelType(this, { contextSettings: { willReadFrequently: true } }) : hitCanvasManager.getPathType(this);
9584
- const h = this.__hitCanvas;
9585
- if (isHitPixel) {
9586
- const { renderBounds } = this.__layout;
9587
- const size = Platform.image.hitCanvasSize;
9588
- const scale = h.hitScale = tempBounds$1.set(0, 0, size, size).getFitMatrix(renderBounds).a;
9589
- const { x, y, width, height } = tempBounds$1.set(renderBounds).scale(scale);
9590
- h.resize({ width, height, pixelRatio: 1 });
9591
- h.clear();
9592
- ImageManager.patternLocked = true;
9593
- this.__renderShape(h, { matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y) }, !isHitPixelFill, !isHitPixelStroke);
9594
- ImageManager.patternLocked = false;
9595
- h.resetTransform();
9596
- data.__isHitPixel = true;
9597
- }
9598
- else {
9599
- data.__isHitPixel && (data.__isHitPixel = false);
9600
- }
9601
- this.__drawHitPath(h);
9602
- h.setStrokeOptions(data);
9603
- };
9604
- ui$1.__hit = function (inner) {
9605
- if (this.__box && this.__box.__hit(inner))
9606
- return true;
9607
- const data = this.__;
9608
- if (data.__isHitPixel && this.__hitPixel(inner))
9609
- return true;
9610
- const { hitFill } = data;
9611
- const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
9612
- if (needHitFillPath && this.__hitFill(inner))
9613
- return true;
9614
- const { hitStroke, __strokeWidth } = data;
9615
- const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
9616
- if (!needHitFillPath && !needHitStrokePath)
9617
- return false;
9618
- const radiusWidth = inner.radiusX * 2;
9619
- let hitWidth = radiusWidth;
9620
- if (needHitStrokePath) {
9621
- switch (data.strokeAlign) {
9622
- case 'inside':
9623
- hitWidth += __strokeWidth * 2;
9624
- if (!needHitFillPath && this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
9625
- return true;
9626
- hitWidth = radiusWidth;
9627
- break;
9628
- case 'center':
9629
- hitWidth += __strokeWidth;
9630
- break;
9631
- case 'outside':
9632
- hitWidth += __strokeWidth * 2;
9633
- if (!needHitFillPath) {
9634
- if (!this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
9635
- return true;
9636
- hitWidth = radiusWidth;
9637
- }
9638
- break;
9639
- }
9640
- }
9641
- return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
9642
- };
9643
-
9644
- const ui = UI.prototype, rect = Rect.prototype, box$1 = Box.prototype;
9645
- rect.__updateHitCanvas = box$1.__updateHitCanvas = function () {
9646
- if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all')
9647
- ui.__updateHitCanvas.call(this);
9648
- else if (this.__hitCanvas)
9649
- this.__hitCanvas = null;
9650
- };
9651
- rect.__hitFill = box$1.__hitFill = function (inner) {
9652
- return this.__hitCanvas ? ui.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
9653
- };
9654
-
9655
- Text.prototype.__drawHitPath = function (canvas) {
9656
- const { __lineHeight, fontSize, __baseLine, __letterSpacing, __textDrawData: data } = this.__;
9657
- canvas.beginPath();
9658
- if (__letterSpacing < 0)
9659
- this.__drawPathByBox(canvas);
9660
- else
9661
- data.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight < fontSize ? fontSize : __lineHeight));
9662
- };
9663
-
9664
- function getSelector(ui) {
9665
- return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
9666
- }
9667
- Group.prototype.pick = function (hitPoint, options) {
9668
- options || (options = emptyData);
9669
- this.updateLayout();
9670
- return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
9671
- };
9672
-
9673
- const canvas = LeaferCanvasBase.prototype;
9674
- canvas.hitFill = function (point, fillRule) {
9675
- return fillRule ? this.context.isPointInPath(point.x, point.y, fillRule) : this.context.isPointInPath(point.x, point.y);
9676
- };
9677
- canvas.hitStroke = function (point, strokeWidth) {
9678
- this.strokeWidth = strokeWidth;
9679
- return this.context.isPointInStroke(point.x, point.y);
9680
- };
9681
- canvas.hitPixel = function (radiusPoint, offset, scale = 1) {
9682
- let { x, y, radiusX, radiusY } = radiusPoint;
9683
- if (offset)
9684
- x -= offset.x, y -= offset.y;
9685
- tempBounds$1.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
9686
- const { data } = this.context.getImageData(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width || 1, tempBounds$1.height || 1);
9687
- for (let i = 0, len = data.length; i < len; i += 4) {
9688
- if (data[i + 3] > 0)
9689
- return true;
9690
- }
9691
- return data[3] > 0;
9692
- };
9693
-
9694
9175
  function strokeText(stroke, ui, canvas) {
9695
9176
  switch (ui.__.strokeAlign) {
9696
9177
  case 'center':
@@ -9716,11 +9197,14 @@ function drawAlign(stroke, align, ui, canvas) {
9716
9197
  out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
9717
9198
  fillText(ui, out);
9718
9199
  out.blendMode = 'normal';
9200
+ copyWorld(canvas, out, ui);
9201
+ out.recycle(ui.__nowWorld);
9202
+ }
9203
+ function copyWorld(canvas, out, ui) {
9719
9204
  if (ui.__worldFlipped || Platform.fullImageShadow)
9720
9205
  canvas.copyWorldByReset(out, ui.__nowWorld);
9721
9206
  else
9722
9207
  canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
9723
- out.recycle(ui.__nowWorld);
9724
9208
  }
9725
9209
  function drawTextStroke(ui, canvas) {
9726
9210
  let row, data = ui.__.__textDrawData;
@@ -9789,9 +9273,8 @@ function drawCenter(stroke, strokeWidthScale, ui, canvas) {
9789
9273
  Paint.strokeArrow(stroke, ui, canvas);
9790
9274
  }
9791
9275
  function drawInside(stroke, ui, canvas) {
9792
- const data = ui.__;
9793
9276
  canvas.save();
9794
- data.windingRule ? canvas.clip(data.windingRule) : canvas.clip();
9277
+ canvas.clipUI(ui);
9795
9278
  drawCenter(stroke, 2, ui, canvas);
9796
9279
  canvas.restore();
9797
9280
  }
@@ -9805,12 +9288,9 @@ function drawOutside(stroke, ui, canvas) {
9805
9288
  const out = canvas.getSameCanvas(true, true);
9806
9289
  ui.__drawRenderPath(out);
9807
9290
  drawCenter(stroke, 2, ui, out);
9808
- data.windingRule ? out.clip(data.windingRule) : out.clip();
9291
+ out.clipUI(data);
9809
9292
  out.clearWorld(renderBounds);
9810
- if (ui.__worldFlipped || Platform.fullImageShadow)
9811
- canvas.copyWorldByReset(out, ui.__nowWorld);
9812
- else
9813
- canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
9293
+ copyWorld(canvas, out, ui);
9814
9294
  out.recycle(ui.__nowWorld);
9815
9295
  }
9816
9296
  }
@@ -9866,9 +9346,7 @@ function compute(attrName, ui) {
9866
9346
  paints = [paints];
9867
9347
  recycleMap = PaintImage.recycleImage(attrName, data);
9868
9348
  for (let i = 0, len = paints.length, item; i < len; i++) {
9869
- item = getLeafPaint(attrName, paints[i], ui);
9870
- if (item)
9871
- leafPaints.push(item);
9349
+ (item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
9872
9350
  }
9873
9351
  data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
9874
9352
  if (leafPaints.length) {
@@ -9906,8 +9384,8 @@ function getLeafPaint(attrName, paint, ui) {
9906
9384
  data = PaintGradient.conicGradient(paint, boxBounds);
9907
9385
  break;
9908
9386
  case 'solid':
9909
- const { type, blendMode, color, opacity } = paint;
9910
- data = { type, blendMode, style: ColorConvert.string(color, opacity) };
9387
+ const { type, color, opacity } = paint;
9388
+ data = { type, style: ColorConvert.string(color, opacity) };
9911
9389
  break;
9912
9390
  default:
9913
9391
  if (paint.r !== undefined)
@@ -10284,7 +9762,7 @@ function checkImage(ui, canvas, paint, allowDraw) {
10284
9762
  }
10285
9763
  function drawImage(ui, canvas, paint, data) {
10286
9764
  canvas.save();
10287
- ui.windingRule ? canvas.clip(ui.windingRule) : canvas.clip();
9765
+ canvas.clipUI(ui);
10288
9766
  if (paint.blendMode)
10289
9767
  canvas.blendMode = paint.blendMode;
10290
9768
  if (data.opacity)
@@ -10449,12 +9927,10 @@ function shadow(ui, current, shape) {
10449
9927
  }
10450
9928
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
10451
9929
  }
10452
- if (ui.__worldFlipped) {
9930
+ if (ui.__worldFlipped)
10453
9931
  current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
10454
- }
10455
- else {
9932
+ else
10456
9933
  current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
10457
- }
10458
9934
  if (end && index < end)
10459
9935
  other.clearWorld(copyBounds, true);
10460
9936
  });
@@ -10513,12 +9989,10 @@ function innerShadow(ui, current, shape) {
10513
9989
  copyBounds = bounds;
10514
9990
  }
10515
9991
  other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
10516
- if (ui.__worldFlipped) {
9992
+ if (ui.__worldFlipped)
10517
9993
  current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
10518
- }
10519
- else {
9994
+ else
10520
9995
  current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
10521
- }
10522
9996
  if (end && index < end)
10523
9997
  other.clearWorld(copyBounds, true);
10524
9998
  });