leafer-draw 1.9.7 → 1.9.9

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
@@ -229,17 +229,32 @@ var LeaferUI = function(exports) {
229
229
  this.__input = this.__middle = null;
230
230
  }
231
231
  }
232
- const {round: round$3, pow: pow$1, PI: PI$3} = Math;
233
- const MathHelper = {
234
- within(value, min, max) {
235
- if (isObject(min)) max = min.max, min = min.min;
236
- if (!isUndefined(min) && value < min) value = min;
237
- if (!isUndefined(max) && value > max) value = max;
238
- return value;
232
+ let tempA, tempB, tempTo;
233
+ const {max: max$4} = Math, tempFour = [ 0, 0, 0, 0 ];
234
+ const FourNumberHelper = {
235
+ zero: [ ...tempFour ],
236
+ tempFour: tempFour,
237
+ set(to, top, right, bottom, left) {
238
+ if (right === undefined) right = bottom = left = top;
239
+ to[0] = top;
240
+ to[1] = right;
241
+ to[2] = bottom;
242
+ to[3] = left;
243
+ return to;
244
+ },
245
+ setTemp(top, right, bottom, left) {
246
+ return set$1(tempFour, top, right, bottom, left);
247
+ },
248
+ toTempAB(a, b, change) {
249
+ tempTo = change ? isNumber(a) ? b : a : [];
250
+ if (isNumber(a)) tempA = setTemp(a), tempB = b; else if (isNumber(b)) tempA = a,
251
+ tempB = setTemp(b); else tempA = a, tempB = b;
252
+ if (tempA.length !== 4) tempA = get$5(tempA);
253
+ if (tempB.length !== 4) tempB = get$5(tempB);
239
254
  },
240
- fourNumber(num, maxValue) {
255
+ get(num, maxValue) {
241
256
  let data;
242
- if (isArray(num)) {
257
+ if (!isNumber(num)) {
243
258
  switch (num.length) {
244
259
  case 4:
245
260
  data = isUndefined(maxValue) ? num : [ ...num ];
@@ -262,9 +277,36 @@ var LeaferUI = function(exports) {
262
277
  }
263
278
  }
264
279
  if (!data) data = [ num, num, num, num ];
265
- if (maxValue) for (let i = 0; i < 4; i++) if (data[i] > maxValue) data[i] = maxValue;
280
+ if (!isUndefined(maxValue)) for (let i = 0; i < 4; i++) if (data[i] > maxValue) data[i] = maxValue;
266
281
  return data;
267
282
  },
283
+ max(t, other, change) {
284
+ if (isNumber(t) && isNumber(other)) return max$4(t, other);
285
+ toTempAB(t, other, change);
286
+ return set$1(tempTo, max$4(tempA[0], tempB[0]), max$4(tempA[1], tempB[1]), max$4(tempA[2], tempB[2]), max$4(tempA[3], tempB[3]));
287
+ },
288
+ add(t, other, change) {
289
+ if (isNumber(t) && isNumber(other)) return t + other;
290
+ toTempAB(t, other, change);
291
+ return set$1(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
292
+ },
293
+ swapAndScale(t, scaleX, scaleY, change) {
294
+ if (isNumber(t)) return scaleX === scaleY ? t * scaleX : [ t * scaleY, t * scaleX ];
295
+ const to = change ? t : [];
296
+ const [top, right, bottom, left] = t.length === 4 ? t : get$5(t);
297
+ return set$1(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
298
+ }
299
+ };
300
+ const {set: set$1, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
301
+ const {round: round$3, pow: pow$1, PI: PI$3} = Math;
302
+ const MathHelper = {
303
+ within(value, min, max) {
304
+ if (isObject(min)) max = min.max, min = min.min;
305
+ if (!isUndefined(min) && value < min) value = min;
306
+ if (!isUndefined(max) && value > max) value = max;
307
+ return value;
308
+ },
309
+ fourNumber: FourNumberHelper.get,
268
310
  formatRotation(rotation, unsign) {
269
311
  rotation %= 360;
270
312
  if (unsign) {
@@ -973,7 +1015,7 @@ var LeaferUI = function(exports) {
973
1015
  MatrixHelper.reset(this);
974
1016
  }
975
1017
  }
976
- const tempMatrix$1 = new Matrix;
1018
+ const tempMatrix$2 = new Matrix;
977
1019
  const TwoPointBoundsHelper = {
978
1020
  tempPointBounds: {},
979
1021
  setPoint(t, minX, minY) {
@@ -1103,9 +1145,9 @@ var LeaferUI = function(exports) {
1103
1145
  let right$1, bottom$1, boundsRight, boundsBottom;
1104
1146
  const point = {};
1105
1147
  const toPoint$4 = {};
1106
- const tempBounds$2 = {};
1148
+ const tempBounds$3 = {};
1107
1149
  const BoundsHelper = {
1108
- tempBounds: tempBounds$2,
1150
+ tempBounds: tempBounds$3,
1109
1151
  set(t, x = 0, y = 0, width = 0, height = 0) {
1110
1152
  t.x = x;
1111
1153
  t.y = y;
@@ -1156,19 +1198,11 @@ var LeaferUI = function(exports) {
1156
1198
  B.move(t, x, y);
1157
1199
  return t;
1158
1200
  },
1159
- toOffsetOutBounds(t, to, parent) {
1160
- if (!to) {
1161
- to = t;
1162
- } else {
1163
- copy$8(to, t);
1164
- }
1165
- if (parent) {
1166
- to.offsetX = -(B.maxX(parent) - t.x);
1167
- to.offsetY = -(B.maxY(parent) - t.y);
1168
- } else {
1169
- to.offsetX = t.x + t.width;
1170
- to.offsetY = t.y + t.height;
1171
- }
1201
+ toOffsetOutBounds(t, to, offsetBounds) {
1202
+ if (!to) to = t; else copy$8(to, t);
1203
+ if (!offsetBounds) offsetBounds = t;
1204
+ to.offsetX = B.maxX(offsetBounds);
1205
+ to.offsetY = B.maxY(offsetBounds);
1172
1206
  B.move(to, -to.offsetX, -to.offsetY);
1173
1207
  },
1174
1208
  scale(t, scaleX, scaleY = scaleX, onlySize) {
@@ -1182,9 +1216,9 @@ var LeaferUI = function(exports) {
1182
1216
  t.height *= scaleY;
1183
1217
  },
1184
1218
  tempToOuterOf(t, matrix) {
1185
- B.copy(tempBounds$2, t);
1186
- B.toOuterOf(tempBounds$2, matrix);
1187
- return tempBounds$2;
1219
+ B.copy(tempBounds$3, t);
1220
+ B.toOuterOf(tempBounds$3, matrix);
1221
+ return tempBounds$3;
1188
1222
  },
1189
1223
  getOuterOf(t, matrix) {
1190
1224
  t = Object.assign({}, t);
@@ -1242,9 +1276,9 @@ var LeaferUI = function(exports) {
1242
1276
  put(t, put, align = "center", putScale = 1, changeSize = true, to) {
1243
1277
  to || (to = put);
1244
1278
  if (isString(putScale)) putScale = B.getFitScale(t, put, putScale === "cover");
1245
- tempBounds$2.width = changeSize ? put.width *= putScale : put.width * putScale;
1246
- tempBounds$2.height = changeSize ? put.height *= putScale : put.height * putScale;
1247
- AlignHelper.toPoint(align, tempBounds$2, t, to, true, true);
1279
+ tempBounds$3.width = changeSize ? put.width *= putScale : put.width * putScale;
1280
+ tempBounds$3.height = changeSize ? put.height *= putScale : put.height * putScale;
1281
+ AlignHelper.toPoint(align, tempBounds$3, t, to, true, true);
1248
1282
  },
1249
1283
  getSpread(t, spread, side) {
1250
1284
  const n = {};
@@ -1314,7 +1348,7 @@ var LeaferUI = function(exports) {
1314
1348
  first = false;
1315
1349
  if (!addMode) copy$8(t, bounds);
1316
1350
  } else {
1317
- add$1(t, bounds);
1351
+ add$2(t, bounds);
1318
1352
  }
1319
1353
  }
1320
1354
  }
@@ -1328,7 +1362,7 @@ var LeaferUI = function(exports) {
1328
1362
  B.set(t, point.x, point.y);
1329
1363
  },
1330
1364
  addPoint(t, point) {
1331
- add$1(t, point, true);
1365
+ add$2(t, point, true);
1332
1366
  },
1333
1367
  getPoints(t) {
1334
1368
  const {x: x, y: y, width: width, height: height} = t;
@@ -1397,7 +1431,7 @@ var LeaferUI = function(exports) {
1397
1431
  }
1398
1432
  };
1399
1433
  const B = BoundsHelper;
1400
- const {add: add$1, copy: copy$8} = B;
1434
+ const {add: add$2, copy: copy$8} = B;
1401
1435
  class Bounds {
1402
1436
  get minX() {
1403
1437
  return BoundsHelper.minX(this);
@@ -1540,7 +1574,7 @@ var LeaferUI = function(exports) {
1540
1574
  BoundsHelper.reset(this);
1541
1575
  }
1542
1576
  }
1543
- const tempBounds$1 = new Bounds;
1577
+ const tempBounds$2 = new Bounds;
1544
1578
  class AutoBounds {
1545
1579
  constructor(top, right, bottom, left, width, height) {
1546
1580
  isObject(top) ? this.copy(top) : this.set(top, right, bottom, left, width, height);
@@ -2103,7 +2137,7 @@ var LeaferUI = function(exports) {
2103
2137
  const {pixelRatio: pixelRatio, pixelSnap: pixelSnap} = this, w = this.worldTransform;
2104
2138
  if (parentMatrix) multiplyParent$4(matrix, parentMatrix, w);
2105
2139
  pixelScale(matrix, pixelRatio, w);
2106
- if (pixelSnap) {
2140
+ if (pixelSnap && !matrix.ignorePixelSnap) {
2107
2141
  if (matrix.half && matrix.half * pixelRatio % 2) w.e = round$1(w.e - .5) + .5, w.f = round$1(w.f - .5) + .5; else w.e = round$1(w.e),
2108
2142
  w.f = round$1(w.f);
2109
2143
  }
@@ -3753,7 +3787,7 @@ var LeaferUI = function(exports) {
3753
3787
  };
3754
3788
  const I = ImageManager;
3755
3789
  const {IMAGE: IMAGE, create: create$1} = IncrementId;
3756
- const {floor: floor$1, max: max$1} = Math;
3790
+ const {floor: floor$1, max: max$3} = Math;
3757
3791
  class LeaferImage {
3758
3792
  get url() {
3759
3793
  return this.config.url;
@@ -3841,7 +3875,7 @@ var LeaferUI = function(exports) {
3841
3875
  }
3842
3876
  if (data) return data;
3843
3877
  }
3844
- const canvas = Platform.origin.createCanvas(max$1(floor$1(width + (xGap || 0)), 1), max$1(floor$1(height + (yGap || 0)), 1));
3878
+ const canvas = Platform.origin.createCanvas(max$3(floor$1(width + (xGap || 0)), 1), max$3(floor$1(height + (yGap || 0)), 1));
3845
3879
  const ctx = canvas.getContext("2d");
3846
3880
  if (opacity) ctx.globalAlpha = opacity;
3847
3881
  ctx.imageSmoothingEnabled = smooth === false ? false : true;
@@ -4573,7 +4607,7 @@ var LeaferUI = function(exports) {
4573
4607
  }
4574
4608
  };
4575
4609
  const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2} = LeafHelper;
4576
- const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$4} = BoundsHelper;
4610
+ const {toOuterOf: toOuterOf$3, getPoints: getPoints, copy: copy$4} = BoundsHelper;
4577
4611
  const localContent = "_localContentBounds";
4578
4612
  const worldContent = "_worldContentBounds", worldBox = "_worldBoxBounds", worldStroke = "_worldStrokeBounds";
4579
4613
  class LeafLayout {
@@ -4593,7 +4627,7 @@ var LeaferUI = function(exports) {
4593
4627
  this._renderBounds = bounds;
4594
4628
  }
4595
4629
  get localContentBounds() {
4596
- toOuterOf$2(this.contentBounds, this.leaf.__localMatrix, this[localContent] || (this[localContent] = {}));
4630
+ toOuterOf$3(this.contentBounds, this.leaf.__localMatrix, this[localContent] || (this[localContent] = {}));
4597
4631
  return this[localContent];
4598
4632
  }
4599
4633
  get localStrokeBounds() {
@@ -4603,15 +4637,15 @@ var LeaferUI = function(exports) {
4603
4637
  return this._localRenderBounds || this;
4604
4638
  }
4605
4639
  get worldContentBounds() {
4606
- toOuterOf$2(this.contentBounds, this.leaf.__world, this[worldContent] || (this[worldContent] = {}));
4640
+ toOuterOf$3(this.contentBounds, this.leaf.__world, this[worldContent] || (this[worldContent] = {}));
4607
4641
  return this[worldContent];
4608
4642
  }
4609
4643
  get worldBoxBounds() {
4610
- toOuterOf$2(this.boxBounds, this.leaf.__world, this[worldBox] || (this[worldBox] = {}));
4644
+ toOuterOf$3(this.boxBounds, this.leaf.__world, this[worldBox] || (this[worldBox] = {}));
4611
4645
  return this[worldBox];
4612
4646
  }
4613
4647
  get worldStrokeBounds() {
4614
- toOuterOf$2(this.strokeBounds, this.leaf.__world, this[worldStroke] || (this[worldStroke] = {}));
4648
+ toOuterOf$3(this.strokeBounds, this.leaf.__world, this[worldStroke] || (this[worldStroke] = {}));
4615
4649
  return this[worldStroke];
4616
4650
  }
4617
4651
  get a() {
@@ -5382,12 +5416,12 @@ var LeaferUI = function(exports) {
5382
5416
  };
5383
5417
  const {updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2} = LeafHelper;
5384
5418
  const {updateBounds: updateBounds$1} = BranchHelper;
5385
- const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$3} = BoundsHelper;
5419
+ const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$2, copy: copy$3} = BoundsHelper;
5386
5420
  const {toBounds: toBounds} = PathBounds;
5387
5421
  const LeafBounds = {
5388
5422
  __updateWorldBounds() {
5389
5423
  const layout = this.__layout;
5390
- toOuterOf$1(layout.renderBounds, this.__world, this.__world);
5424
+ toOuterOf$2(layout.renderBounds, this.__world, this.__world);
5391
5425
  if (layout.resized) {
5392
5426
  if (layout.resized === "inner") this.__onUpdateSize();
5393
5427
  if (this.__hasLocalEvent) BoundsEvent.emitLocal(this);
@@ -5443,13 +5477,13 @@ var LeaferUI = function(exports) {
5443
5477
  __updateLocalBoxBounds() {
5444
5478
  if (this.__hasMotionPath) this.__updateMotionPath();
5445
5479
  if (this.__hasAutoLayout) this.__updateAutoLayout();
5446
- toOuterOf$1(this.__layout.boxBounds, this.__local, this.__local);
5480
+ toOuterOf$2(this.__layout.boxBounds, this.__local, this.__local);
5447
5481
  },
5448
5482
  __updateLocalStrokeBounds() {
5449
- toOuterOf$1(this.__layout.strokeBounds, this.__localMatrix, this.__layout.localStrokeBounds);
5483
+ toOuterOf$2(this.__layout.strokeBounds, this.__localMatrix, this.__layout.localStrokeBounds);
5450
5484
  },
5451
5485
  __updateLocalRenderBounds() {
5452
- toOuterOf$1(this.__layout.renderBounds, this.__localMatrix, this.__layout.localRenderBounds);
5486
+ toOuterOf$2(this.__layout.renderBounds, this.__localMatrix, this.__layout.localRenderBounds);
5453
5487
  },
5454
5488
  __updateBoxBounds(_secondLayout, _bounds) {
5455
5489
  const b = this.__layout.boxBounds;
@@ -5487,11 +5521,11 @@ var LeaferUI = function(exports) {
5487
5521
  },
5488
5522
  __updateStrokeBounds(_bounds) {
5489
5523
  const layout = this.__layout;
5490
- copyAndSpread$1(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
5524
+ copyAndSpread$2(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
5491
5525
  },
5492
5526
  __updateRenderBounds(_bounds) {
5493
- const layout = this.__layout;
5494
- layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$3(layout.renderBounds, layout.strokeBounds);
5527
+ const layout = this.__layout, {renderSpread: renderSpread} = layout;
5528
+ isNumber(renderSpread) && renderSpread <= 0 ? copy$3(layout.renderBounds, layout.strokeBounds) : copyAndSpread$2(layout.renderBounds, layout.boxBounds, renderSpread);
5495
5529
  }
5496
5530
  };
5497
5531
  const LeafRender = {
@@ -5583,9 +5617,10 @@ var LeaferUI = function(exports) {
5583
5617
  };
5584
5618
  const tempScaleData$1 = {};
5585
5619
  const {LEAF: LEAF, create: create} = IncrementId;
5620
+ const {stintSet: stintSet$3} = DataHelper;
5586
5621
  const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
5587
- const {toOuterOf: toOuterOf} = BoundsHelper;
5588
- const {copy: copy$2, move: move} = PointHelper;
5622
+ const {toOuterOf: toOuterOf$1} = BoundsHelper;
5623
+ const {copy: copy$2, move: move$2} = PointHelper;
5589
5624
  const {moveLocal: moveLocal, zoomOfLocal: zoomOfLocal, rotateOfLocal: rotateOfLocal, skewOfLocal: skewOfLocal, moveWorld: moveWorld, zoomOfWorld: zoomOfWorld, rotateOfWorld: rotateOfWorld, skewOfWorld: skewOfWorld, transform: transform, transformWorld: transformWorld, setTransform: setTransform, getFlipTransform: getFlipTransform, getLocalOrigin: getLocalOrigin, getRelativeWorld: getRelativeWorld, drop: drop} = LeafHelper;
5590
5625
  exports.Leaf = class Leaf {
5591
5626
  get tag() {
@@ -5859,8 +5894,9 @@ var LeaferUI = function(exports) {
5859
5894
  if (!this.__cameraWorld) this.__cameraWorld = {};
5860
5895
  const cameraWorld = this.__cameraWorld, world = this.__world;
5861
5896
  multiplyParent$1(world, options.matrix, cameraWorld, undefined, world);
5862
- toOuterOf(this.__layout.renderBounds, cameraWorld, cameraWorld);
5863
- cameraWorld.half !== world.half && (cameraWorld.half = world.half);
5897
+ toOuterOf$1(this.__layout.renderBounds, cameraWorld, cameraWorld);
5898
+ stintSet$3(cameraWorld, "half", world.half);
5899
+ stintSet$3(cameraWorld, "ignorePixelSnap", world.ignorePixelSnap);
5864
5900
  return cameraWorld;
5865
5901
  } else {
5866
5902
  return this.__world;
@@ -5894,7 +5930,7 @@ var LeaferUI = function(exports) {
5894
5930
  getWorldBounds(inner, relative, change) {
5895
5931
  const matrix = relative ? getRelativeWorld(this, relative) : this.worldTransform;
5896
5932
  const to = change ? inner : {};
5897
- toOuterOf(inner, matrix, to);
5933
+ toOuterOf$1(inner, matrix, to);
5898
5934
  return to;
5899
5935
  }
5900
5936
  worldToLocal(world, to, distance, relative) {
@@ -5927,7 +5963,7 @@ var LeaferUI = function(exports) {
5927
5963
  }
5928
5964
  getBoxPointByInner(inner, _relative, _distance, change) {
5929
5965
  const point = change ? inner : Object.assign({}, inner), {x: x, y: y} = this.boxBounds;
5930
- move(point, -x, -y);
5966
+ move$2(point, -x, -y);
5931
5967
  return point;
5932
5968
  }
5933
5969
  getInnerPoint(world, relative, distance, change) {
@@ -5937,7 +5973,7 @@ var LeaferUI = function(exports) {
5937
5973
  }
5938
5974
  getInnerPointByBox(box, _relative, _distance, change) {
5939
5975
  const point = change ? box : Object.assign({}, box), {x: x, y: y} = this.boxBounds;
5940
- move(point, x, y);
5976
+ move$2(point, x, y);
5941
5977
  return point;
5942
5978
  }
5943
5979
  getInnerPointByLocal(local, _relative, distance, change) {
@@ -6373,7 +6409,7 @@ var LeaferUI = function(exports) {
6373
6409
  this.levelMap = null;
6374
6410
  }
6375
6411
  }
6376
- const version = "1.9.7";
6412
+ const version = "1.9.9";
6377
6413
  const debug$4 = Debug.get("LeaferCanvas");
6378
6414
  class LeaferCanvas extends LeaferCanvasBase {
6379
6415
  set zIndex(zIndex) {
@@ -6406,7 +6442,7 @@ var LeaferUI = function(exports) {
6406
6442
  }
6407
6443
  if (Platform.syncDomFont && !this.parentView) {
6408
6444
  style.display = "none";
6409
- document.body.appendChild(this.view);
6445
+ if (document.body) document.body.appendChild(this.view);
6410
6446
  }
6411
6447
  this.__createContext();
6412
6448
  if (!this.autoLayout) this.resize(config);
@@ -6977,6 +7013,7 @@ var LeaferUI = function(exports) {
6977
7013
  usePartRender: true,
6978
7014
  maxFPS: 120
6979
7015
  };
7016
+ this.frames = [];
6980
7017
  this.target = target;
6981
7018
  this.canvas = canvas;
6982
7019
  if (userConfig) this.config = DataHelper.default(userConfig, this.config);
@@ -7129,12 +7166,15 @@ var LeaferUI = function(exports) {
7129
7166
  const target = this.target;
7130
7167
  if (this.requestTime || !target) return;
7131
7168
  if (target.parentApp) return target.parentApp.requestRender(false);
7132
- const requestTime = this.requestTime = Date.now();
7169
+ this.requestTime = this.frameTime || Date.now();
7133
7170
  const render = () => {
7134
- const nowFPS = 1e3 / (Date.now() - requestTime);
7171
+ const nowFPS = 1e3 / ((this.frameTime = Date.now()) - this.requestTime);
7135
7172
  const {maxFPS: maxFPS} = this.config;
7136
- if (maxFPS && nowFPS > maxFPS - .5) return Platform.requestRender(render);
7137
- this.FPS = Math.min(120, Math.ceil(nowFPS));
7173
+ if (maxFPS && nowFPS > maxFPS) return Platform.requestRender(render);
7174
+ const {frames: frames} = this;
7175
+ if (frames.length > 30) frames.shift();
7176
+ frames.push(nowFPS);
7177
+ this.FPS = Math.round(frames.reduce((a, b) => a + b, 0) / frames.length);
7138
7178
  this.requestTime = 0;
7139
7179
  this.checkRender();
7140
7180
  };
@@ -7564,39 +7604,40 @@ var LeaferUI = function(exports) {
7564
7604
  return data;
7565
7605
  }
7566
7606
  }
7607
+ const {max: max$2, add: add$1} = FourNumberHelper;
7567
7608
  const UIBounds = {
7568
7609
  __updateStrokeSpread() {
7569
- let width = 0, boxWidth = 0;
7610
+ let spread = 0, boxSpread = 0;
7570
7611
  const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
7571
7612
  if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
7572
- boxWidth = width = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
7613
+ boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
7573
7614
  if (!data.__boxStroke) {
7574
- const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * width;
7615
+ const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
7575
7616
  const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
7576
- width += Math.max(miterLimitAddWidth, storkeCapAddWidth);
7617
+ spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
7577
7618
  }
7578
7619
  }
7579
- if (data.__useArrow) width += strokeWidth * 5;
7620
+ if (data.__useArrow) spread += strokeWidth * 5;
7580
7621
  if (box) {
7581
- width = Math.max(box.__layout.strokeSpread = box.__updateStrokeSpread(), width);
7582
- boxWidth = box.__layout.strokeBoxSpread;
7622
+ spread = max$2(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
7623
+ boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
7583
7624
  }
7584
- this.__layout.strokeBoxSpread = boxWidth;
7585
- return width;
7625
+ this.__layout.strokeBoxSpread = boxSpread;
7626
+ return spread;
7586
7627
  },
7587
7628
  __updateRenderSpread() {
7588
- let width = 0;
7589
- const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
7590
- if (shadow) width = Effect.getShadowSpread(this, shadow);
7591
- if (blur) width = Math.max(width, blur);
7592
- if (filter) width += Filter.getSpread(filter);
7593
- if (renderSpread) width += renderSpread;
7594
- let shapeWidth = width = Math.ceil(width);
7595
- if (innerShadow) innerShadow.forEach(item => shapeWidth = Math.max(shapeWidth, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5));
7596
- if (backgroundBlur) shapeWidth = Math.max(shapeWidth, backgroundBlur);
7597
- this.__layout.renderShapeSpread = shapeWidth;
7598
- width += this.__layout.strokeSpread || 0;
7599
- return this.__box ? Math.max(this.__box.__updateRenderSpread(), width) : width;
7629
+ let spread = 0;
7630
+ const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__, {strokeSpread: strokeSpread} = this.__layout, box = this.__box;
7631
+ if (shadow) spread = Effect.getShadowRenderSpread(this, shadow);
7632
+ if (blur) spread = max$2(spread, blur);
7633
+ if (filter) spread = add$1(spread, Filter.getSpread(filter));
7634
+ if (renderSpread) spread = add$1(spread, renderSpread);
7635
+ if (strokeSpread) spread = add$1(spread, strokeSpread);
7636
+ let shapeSpread = spread;
7637
+ if (innerShadow) shapeSpread = max$2(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
7638
+ if (backgroundBlur) shapeSpread = max$2(shapeSpread, backgroundBlur);
7639
+ this.__layout.renderShapeSpread = shapeSpread;
7640
+ return box ? max$2(box.__updateRenderSpread(), spread) : spread;
7600
7641
  }
7601
7642
  };
7602
7643
  const {float: float} = MathHelper;
@@ -8738,7 +8779,7 @@ var LeaferUI = function(exports) {
8738
8779
  __decorate([ dataType(false) ], exports.Canvas.prototype, "safeResize", void 0);
8739
8780
  __decorate([ resizeType() ], exports.Canvas.prototype, "contextSettings", void 0);
8740
8781
  exports.Canvas = __decorate([ registerUI() ], exports.Canvas);
8741
- const {copyAndSpread: copyAndSpread, includes: includes, spread: spread, setList: setList} = BoundsHelper;
8782
+ const {copyAndSpread: copyAndSpread$1, includes: includes, spread: spread, setList: setList} = BoundsHelper;
8742
8783
  exports.Text = class Text extends exports.UI {
8743
8784
  get __tag() {
8744
8785
  return "Text";
@@ -8784,13 +8825,13 @@ var LeaferUI = function(exports) {
8784
8825
  if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
8785
8826
  }
8786
8827
  __updateRenderSpread() {
8787
- let width = super.__updateRenderSpread();
8788
- if (!width) width = this.isOverflow ? 1 : 0;
8789
- return width;
8828
+ let spread = super.__updateRenderSpread();
8829
+ if (!spread) spread = this.isOverflow ? 1 : 0;
8830
+ return spread;
8790
8831
  }
8791
8832
  __updateRenderBounds() {
8792
8833
  const {renderBounds: renderBounds, renderSpread: renderSpread} = this.__layout;
8793
- copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
8834
+ copyAndSpread$1(renderBounds, this.__.__textBoxBounds, renderSpread);
8794
8835
  if (this.__box) this.__box.__layout.renderBounds = renderBounds;
8795
8836
  }
8796
8837
  __updateChange() {
@@ -9106,23 +9147,27 @@ var LeaferUI = function(exports) {
9106
9147
  out.recycle(ui.__nowWorld);
9107
9148
  }
9108
9149
  }
9109
- const {getSpread: getSpread, getOuterOf: getOuterOf, getByMove: getByMove, getIntersectData: getIntersectData} = BoundsHelper;
9150
+ const {getSpread: getSpread, copyAndSpread: copyAndSpread, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$1, getIntersectData: getIntersectData} = BoundsHelper;
9151
+ const tempBounds$1 = {};
9110
9152
  function shape(ui, current, options) {
9111
9153
  const canvas = current.getSameCanvas();
9112
- const nowWorld = ui.__nowWorld, currentBounds = current.bounds;
9113
- let bounds, matrix, fitMatrix, shapeBounds, worldCanvas;
9154
+ const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
9155
+ const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
9156
+ toOuterOf(layout.strokeSpread ? (copyAndSpread(tempBounds$1, layout.boxBounds, layout.strokeSpread),
9157
+ tempBounds$1) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
9158
+ let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
9114
9159
  let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
9115
- if (currentBounds.includes(nowWorld)) {
9160
+ if (currentBounds.includes(nowWorldShapeBounds)) {
9116
9161
  worldCanvas = canvas;
9117
- bounds = shapeBounds = nowWorld;
9162
+ bounds = shapeBounds = nowWorldShapeBounds;
9163
+ renderBounds = nowWorld;
9118
9164
  } else {
9119
- const {renderShapeSpread: spread} = ui.__layout;
9120
9165
  let worldClipBounds;
9121
9166
  if (Platform.fullImageShadow) {
9122
- worldClipBounds = nowWorld;
9167
+ worldClipBounds = nowWorldShapeBounds;
9123
9168
  } else {
9124
- const spreadBounds = spread ? getSpread(currentBounds, scaleX === scaleY ? spread * scaleX : [ spread * scaleY, spread * scaleX ]) : currentBounds;
9125
- worldClipBounds = getIntersectData(spreadBounds, nowWorld);
9169
+ const spreadBounds = layout.renderShapeSpread ? getSpread(currentBounds, FourNumberHelper.swapAndScale(layout.renderShapeSpread, scaleX, scaleY)) : currentBounds;
9170
+ worldClipBounds = getIntersectData(spreadBounds, nowWorldShapeBounds);
9126
9171
  }
9127
9172
  fitMatrix = currentBounds.getFitMatrix(worldClipBounds);
9128
9173
  let {a: fitScaleX, d: fitScaleY} = fitMatrix;
@@ -9132,8 +9177,10 @@ var LeaferUI = function(exports) {
9132
9177
  scaleX *= fitScaleX;
9133
9178
  scaleY *= fitScaleY;
9134
9179
  }
9135
- shapeBounds = getOuterOf(nowWorld, fitMatrix);
9180
+ shapeBounds = getOuterOf(nowWorldShapeBounds, fitMatrix);
9136
9181
  bounds = getByMove(shapeBounds, -fitMatrix.e, -fitMatrix.f);
9182
+ renderBounds = getOuterOf(nowWorld, fitMatrix);
9183
+ move$1(renderBounds, -fitMatrix.e, -fitMatrix.f);
9137
9184
  const userMatrix = options.matrix;
9138
9185
  if (userMatrix) {
9139
9186
  matrix = new Matrix(fitMatrix);
@@ -9152,6 +9199,7 @@ var LeaferUI = function(exports) {
9152
9199
  matrix: matrix,
9153
9200
  fitMatrix: fitMatrix,
9154
9201
  bounds: bounds,
9202
+ renderBounds: renderBounds,
9155
9203
  worldCanvas: worldCanvas,
9156
9204
  shapeBounds: shapeBounds,
9157
9205
  scaleX: scaleX,
@@ -9249,7 +9297,7 @@ var LeaferUI = function(exports) {
9249
9297
  drawTextStroke: drawTextStroke,
9250
9298
  shape: shape
9251
9299
  };
9252
- let origin = {}, tempMatrix = getMatrixData();
9300
+ let origin = {}, tempMatrix$1 = getMatrixData();
9253
9301
  const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
9254
9302
  function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
9255
9303
  const transform = get$3();
@@ -9261,12 +9309,12 @@ var LeaferUI = function(exports) {
9261
9309
  }, rotation);
9262
9310
  data.transform = transform;
9263
9311
  }
9264
- function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipSize) {
9312
+ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
9265
9313
  const transform = get$3();
9266
9314
  layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
9267
- if (clipSize) {
9268
- tempMatrix.a = box.width / clipSize.width, tempMatrix.d = box.height / clipSize.height;
9269
- multiplyParent(transform, tempMatrix);
9315
+ if (clipScaleX) {
9316
+ tempMatrix$1.a = clipScaleX, tempMatrix$1.d = clipScaleY;
9317
+ multiplyParent(transform, tempMatrix$1);
9270
9318
  }
9271
9319
  data.transform = transform;
9272
9320
  }
@@ -9359,7 +9407,12 @@ var LeaferUI = function(exports) {
9359
9407
 
9360
9408
  case "normal":
9361
9409
  case "clip":
9362
- if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew) clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, paint.clipSize);
9410
+ if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew) {
9411
+ let clipScaleX, clipScaleY;
9412
+ if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
9413
+ clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
9414
+ if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : scaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
9415
+ }
9363
9416
  break;
9364
9417
 
9365
9418
  case "repeat":
@@ -9504,7 +9557,7 @@ var LeaferUI = function(exports) {
9504
9557
  if (leafer && leafer.viewReady) leafer.renderer.ignore = value;
9505
9558
  }
9506
9559
  const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
9507
- const {floor: floor, ceil: ceil, max: max, abs: abs} = Math;
9560
+ const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
9508
9561
  function createPattern(ui, paint, pixelRatio) {
9509
9562
  let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
9510
9563
  const id = scaleX + "-" + scaleY + "-" + pixelRatio;
@@ -9552,8 +9605,8 @@ var LeaferUI = function(exports) {
9552
9605
  if (transform || scaleX !== 1 || scaleY !== 1) {
9553
9606
  const canvasWidth = width + (xGap || 0);
9554
9607
  const canvasHeight = height + (yGap || 0);
9555
- scaleX /= canvasWidth / max(floor(canvasWidth), 1);
9556
- scaleY /= canvasHeight / max(floor(canvasHeight), 1);
9608
+ scaleX /= canvasWidth / max$1(floor(canvasWidth), 1);
9609
+ scaleY /= canvasHeight / max$1(floor(canvasHeight), 1);
9557
9610
  if (!imageMatrix) {
9558
9611
  imageMatrix = get$1();
9559
9612
  if (transform) copy$1(imageMatrix, transform);
@@ -9578,17 +9631,15 @@ var LeaferUI = function(exports) {
9578
9631
  if (allowDraw) {
9579
9632
  if (data.repeat) {
9580
9633
  allowDraw = false;
9581
- } else {
9582
- if (!(paint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || Export.running)) {
9583
- let {width: width, height: height} = data;
9584
- width *= scaleX * pixelRatio;
9585
- height *= scaleY * pixelRatio;
9586
- if (data.scaleX) {
9587
- width *= data.scaleX;
9588
- height *= data.scaleY;
9589
- }
9590
- allowDraw = width * height > Platform.image.maxCacheSize;
9634
+ } else if (!(paint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || Export.running)) {
9635
+ let {width: width, height: height} = data;
9636
+ width *= scaleX * pixelRatio;
9637
+ height *= scaleY * pixelRatio;
9638
+ if (data.scaleX) {
9639
+ width *= data.scaleX;
9640
+ height *= data.scaleY;
9591
9641
  }
9642
+ allowDraw = width * height > Platform.image.maxCacheSize;
9592
9643
  }
9593
9644
  }
9594
9645
  if (allowDraw) {
@@ -9746,81 +9797,87 @@ var LeaferUI = function(exports) {
9746
9797
  conicGradient: conicGradient,
9747
9798
  getTransform: getTransform
9748
9799
  };
9749
- const {copy: copy, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper;
9750
- const tempBounds = {};
9800
+ const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
9801
+ const tempBounds = {}, tempMatrix = new Matrix;
9751
9802
  const offsetOutBounds$1 = {};
9752
9803
  function shadow(ui, current, shape) {
9753
- let copyBounds, spreadScale;
9754
- const {__nowWorld: nowWorld, __layout: __layout} = ui;
9804
+ let copyBounds, transform;
9805
+ const {__nowWorld: nowWorld} = ui;
9755
9806
  const {shadow: shadow} = ui.__;
9756
- const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
9807
+ const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
9757
9808
  const other = current.getSameCanvas();
9758
9809
  const end = shadow.length - 1;
9759
- toOffsetOutBounds$1(bounds, offsetOutBounds$1);
9810
+ toOffsetOutBounds$1(bounds, offsetOutBounds$1, renderBounds);
9760
9811
  shadow.forEach((item, index) => {
9761
9812
  let otherScale = 1;
9762
9813
  if (item.scaleFixed) {
9763
9814
  const sx = Math.abs(nowWorld.scaleX);
9764
9815
  if (sx > 1) otherScale = 1 / sx;
9765
9816
  }
9766
- other.setWorldShadow(offsetOutBounds$1.offsetX + item.x * scaleX * otherScale, offsetOutBounds$1.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale, ColorConvert.string(item.color));
9767
- spreadScale = item.spread ? 1 + item.spread * 2 / (__layout.boxBounds.width + (__layout.strokeBoxSpread || 0) * 2) * otherScale : 0;
9768
- drawWorldShadow(other, offsetOutBounds$1, spreadScale, shape);
9769
- copyBounds = bounds;
9817
+ other.setWorldShadow(offsetOutBounds$1.offsetX + (item.x || 0) * scaleX * otherScale, offsetOutBounds$1.offsetY + (item.y || 0) * scaleY * otherScale, (item.blur || 0) * scaleX * otherScale, ColorConvert.string(item.color));
9818
+ transform = Effect.getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
9819
+ if (transform) other.setTransform(transform);
9820
+ drawWorldShadow(other, offsetOutBounds$1, shape);
9821
+ if (transform) other.resetTransform();
9822
+ copyBounds = renderBounds;
9770
9823
  if (item.box) {
9771
9824
  other.restore();
9772
9825
  other.save();
9773
9826
  if (worldCanvas) {
9774
- other.copyWorld(other, bounds, nowWorld, "copy");
9827
+ other.copyWorld(other, renderBounds, nowWorld, "copy");
9775
9828
  copyBounds = nowWorld;
9776
9829
  }
9777
9830
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
9778
9831
  }
9779
- if (Effect.isTransformShadow(item)) Effect.renderTransformShadow(ui, current, other, copyBounds, item); else LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
9832
+ LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
9780
9833
  if (end && index < end) other.clearWorld(copyBounds);
9781
9834
  });
9782
9835
  other.recycle(copyBounds);
9783
9836
  }
9784
- function getShadowSpread(_ui, shadow) {
9785
- let width = 0;
9786
- shadow.forEach(item => width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5));
9787
- return width;
9837
+ function getShadowRenderSpread(_ui, shadow) {
9838
+ let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
9839
+ shadow.forEach(item => {
9840
+ x = item.x || 0, y = item.y || 0, spread = item.spread || 0, blur = (item.blur || 0) * 1.5;
9841
+ top = max(top, spread + blur - y);
9842
+ right = max(right, spread + blur + x);
9843
+ bottom = max(bottom, spread + blur + y);
9844
+ left = max(left, spread + blur - x);
9845
+ });
9846
+ return top === right && right === bottom && bottom === left ? top : [ top, right, bottom, left ];
9847
+ }
9848
+ function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
9849
+ if (shadow.spread) {
9850
+ const spreadScale = 1 + shadow.spread * 2 / ui.__layout.strokeBounds.width * otherScale * (isInnerShaodw ? -1 : 1);
9851
+ tempMatrix.set().scaleOfOuter({
9852
+ x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
9853
+ y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
9854
+ }, spreadScale);
9855
+ return tempMatrix;
9856
+ }
9857
+ return undefined;
9788
9858
  }
9789
- function drawWorldShadow(canvas, outBounds, spreadScale, shape) {
9790
- const {bounds: bounds, shapeBounds: shapeBounds} = shape;
9859
+ function drawWorldShadow(canvas, outBounds, shape) {
9860
+ const {shapeBounds: shapeBounds} = shape;
9861
+ let from, to;
9791
9862
  if (Platform.fullImageShadow) {
9792
9863
  copy(tempBounds, canvas.bounds);
9793
- tempBounds.x += outBounds.x - shapeBounds.x;
9794
- tempBounds.y += outBounds.y - shapeBounds.y;
9795
- if (spreadScale) {
9796
- const {fitMatrix: fitMatrix} = shape;
9797
- tempBounds.x -= (bounds.x + (fitMatrix ? fitMatrix.e : 0) + bounds.width / 2) * (spreadScale - 1);
9798
- tempBounds.y -= (bounds.y + (fitMatrix ? fitMatrix.f : 0) + bounds.height / 2) * (spreadScale - 1);
9799
- tempBounds.width *= spreadScale;
9800
- tempBounds.height *= spreadScale;
9801
- }
9802
- canvas.copyWorld(shape.canvas, canvas.bounds, tempBounds);
9864
+ move(tempBounds, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
9865
+ from = canvas.bounds, to = tempBounds;
9803
9866
  } else {
9804
- if (spreadScale) {
9805
- copy(tempBounds, outBounds);
9806
- tempBounds.x -= outBounds.width / 2 * (spreadScale - 1);
9807
- tempBounds.y -= outBounds.height / 2 * (spreadScale - 1);
9808
- tempBounds.width *= spreadScale;
9809
- tempBounds.height *= spreadScale;
9810
- }
9811
- canvas.copyWorld(shape.canvas, shapeBounds, spreadScale ? tempBounds : outBounds);
9867
+ from = shapeBounds, to = outBounds;
9812
9868
  }
9869
+ canvas.copyWorld(shape.canvas, from, to);
9813
9870
  }
9814
9871
  const {toOffsetOutBounds: toOffsetOutBounds} = BoundsHelper;
9815
9872
  const offsetOutBounds = {};
9816
9873
  function innerShadow(ui, current, shape) {
9817
- let copyBounds, spreadScale;
9818
- const {__nowWorld: nowWorld, __layout: __layout} = ui;
9874
+ let copyBounds, transform;
9875
+ const {__nowWorld: nowWorld} = ui;
9819
9876
  const {innerShadow: innerShadow} = ui.__;
9820
- const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
9877
+ const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
9821
9878
  const other = current.getSameCanvas();
9822
9879
  const end = innerShadow.length - 1;
9823
- toOffsetOutBounds(bounds, offsetOutBounds);
9880
+ toOffsetOutBounds(bounds, offsetOutBounds, renderBounds);
9824
9881
  innerShadow.forEach((item, index) => {
9825
9882
  let otherScale = 1;
9826
9883
  if (item.scaleFixed) {
@@ -9828,17 +9885,18 @@ var LeaferUI = function(exports) {
9828
9885
  if (sx > 1) otherScale = 1 / sx;
9829
9886
  }
9830
9887
  other.save();
9831
- other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
9832
- spreadScale = item.spread ? 1 - item.spread * 2 / (__layout.boxBounds.width + (__layout.strokeBoxSpread || 0) * 2) * otherScale : 0;
9833
- drawWorldShadow(other, offsetOutBounds, spreadScale, shape);
9888
+ other.setWorldShadow(offsetOutBounds.offsetX + (item.x || 0) * scaleX * otherScale, offsetOutBounds.offsetY + (item.y || 0) * scaleY * otherScale, (item.blur || 0) * scaleX * otherScale);
9889
+ transform = Effect.getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
9890
+ if (transform) other.setTransform(transform);
9891
+ drawWorldShadow(other, offsetOutBounds, shape);
9834
9892
  other.restore();
9835
9893
  if (worldCanvas) {
9836
- other.copyWorld(other, bounds, nowWorld, "copy");
9894
+ other.copyWorld(other, renderBounds, nowWorld, "copy");
9837
9895
  other.copyWorld(worldCanvas, nowWorld, nowWorld, "source-out");
9838
9896
  copyBounds = nowWorld;
9839
9897
  } else {
9840
9898
  other.copyWorld(shape.canvas, shapeBounds, bounds, "source-out");
9841
- copyBounds = bounds;
9899
+ copyBounds = renderBounds;
9842
9900
  }
9843
9901
  other.fillWorld(copyBounds, ColorConvert.string(item.color), "source-in");
9844
9902
  LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
@@ -9846,6 +9904,7 @@ var LeaferUI = function(exports) {
9846
9904
  });
9847
9905
  other.recycle(copyBounds);
9848
9906
  }
9907
+ const getInnerShadowSpread = getShadowRenderSpread;
9849
9908
  function blur(ui, current, origin) {
9850
9909
  const {blur: blur} = ui.__;
9851
9910
  origin.setWorldBlur(blur * ui.__nowWorld.a);
@@ -9858,10 +9917,12 @@ var LeaferUI = function(exports) {
9858
9917
  innerShadow: innerShadow,
9859
9918
  blur: blur,
9860
9919
  backgroundBlur: backgroundBlur,
9861
- getShadowSpread: getShadowSpread,
9920
+ getShadowRenderSpread: getShadowRenderSpread,
9921
+ getShadowTransform: getShadowTransform,
9862
9922
  isTransformShadow(_shadow) {
9863
9923
  return undefined;
9864
- }
9924
+ },
9925
+ getInnerShadowSpread: getInnerShadowSpread
9865
9926
  };
9866
9927
  const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
9867
9928
  let usedGrayscaleAlpha;
@@ -9875,6 +9936,7 @@ var LeaferUI = function(exports) {
9875
9936
  maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity, undefined, true);
9876
9937
  maskCanvas = contentCanvas = null;
9877
9938
  }
9939
+ if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
9878
9940
  maskOpacity = child.__.opacity;
9879
9941
  usedGrayscaleAlpha = false;
9880
9942
  if (mask === "path" || mask === "clipping-path") {
@@ -9892,7 +9954,6 @@ var LeaferUI = function(exports) {
9892
9954
  if (!contentCanvas) contentCanvas = getCanvas(canvas);
9893
9955
  child.__render(maskCanvas, options);
9894
9956
  }
9895
- if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
9896
9957
  continue;
9897
9958
  }
9898
9959
  const childBlendMode = maskOpacity === 1 && child.__.__blendMode;
@@ -10399,6 +10460,7 @@ var LeaferUI = function(exports) {
10399
10460
  getDrawData: getDrawData
10400
10461
  };
10401
10462
  function string(color, opacity) {
10463
+ if (!color) return "#000";
10402
10464
  const doOpacity = isNumber(opacity) && opacity < 1;
10403
10465
  if (isString(color)) {
10404
10466
  if (doOpacity && ColorConvert.object) color = ColorConvert.object(color); else return color;
@@ -10445,6 +10507,7 @@ var LeaferUI = function(exports) {
10445
10507
  exports.Export = Export;
10446
10508
  exports.FileHelper = FileHelper;
10447
10509
  exports.Filter = Filter;
10510
+ exports.FourNumberHelper = FourNumberHelper;
10448
10511
  exports.FrameData = FrameData;
10449
10512
  exports.GroupData = GroupData;
10450
10513
  exports.ImageData = ImageData;
@@ -10583,8 +10646,8 @@ var LeaferUI = function(exports) {
10583
10646
  exports.sortType = sortType;
10584
10647
  exports.strokeType = strokeType;
10585
10648
  exports.surfaceType = surfaceType;
10586
- exports.tempBounds = tempBounds$1;
10587
- exports.tempMatrix = tempMatrix$1;
10649
+ exports.tempBounds = tempBounds$2;
10650
+ exports.tempMatrix = tempMatrix$2;
10588
10651
  exports.tempPoint = tempPoint$2;
10589
10652
  exports.tryToNumber = tryToNumber;
10590
10653
  exports.useCanvas = useCanvas;