@leafer/worker 1.12.3 → 2.0.0

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
@@ -199,54 +199,6 @@ var LeaferUI = function(exports) {
199
199
  this.__input = this.__middle = null;
200
200
  }
201
201
  }
202
- const {floor: floor$3, max: max$7} = Math;
203
- const Platform = {
204
- toURL(text, fileType) {
205
- let url = encodeURIComponent(text);
206
- if (fileType === "text") url = "data:text/plain;charset=utf-8," + url; else if (fileType === "svg") url = "data:image/svg+xml," + url;
207
- return url;
208
- },
209
- image: {
210
- hitCanvasSize: 100,
211
- maxCacheSize: 2560 * 1600,
212
- maxPatternSize: 4096 * 2160,
213
- crossOrigin: "anonymous",
214
- isLarge(size, scaleX, scaleY, largeSize) {
215
- return size.width * size.height * (scaleX ? scaleX * scaleY : 1) > (largeSize || image$1.maxCacheSize);
216
- },
217
- isSuperLarge(size, scaleX, scaleY) {
218
- return image$1.isLarge(size, scaleX, scaleY, image$1.maxPatternSize);
219
- },
220
- getRealURL(url) {
221
- const {prefix: prefix, suffix: suffix} = Platform.image;
222
- if (suffix && !url.startsWith("data:") && !url.startsWith("blob:")) url += (url.includes("?") ? "&" : "?") + suffix;
223
- if (prefix && url[0] === "/") url = prefix + url;
224
- return url;
225
- },
226
- resize(image, width, height, xGap, yGap, clip, smooth, opacity, _filters) {
227
- const canvas = Platform.origin.createCanvas(max$7(floor$3(width + (xGap || 0)), 1), max$7(floor$3(height + (yGap || 0)), 1));
228
- const ctx = canvas.getContext("2d");
229
- if (opacity) ctx.globalAlpha = opacity;
230
- ctx.imageSmoothingEnabled = smooth === false ? false : true;
231
- if (clip) {
232
- const scaleX = width / clip.width, scaleY = height / clip.height;
233
- ctx.setTransform(scaleX, 0, 0, scaleY, -clip.x * scaleX, -clip.y * scaleY);
234
- ctx.drawImage(image, 0, 0, image.width, image.height);
235
- } else ctx.drawImage(image, 0, 0, width, height);
236
- return canvas;
237
- },
238
- setPatternTransform(pattern, transform, paint) {
239
- try {
240
- if (transform && pattern.setTransform) {
241
- pattern.setTransform(transform);
242
- transform = undefined;
243
- }
244
- } catch (_a) {}
245
- if (paint) DataHelper.stintSet(paint, "transform", transform);
246
- }
247
- }
248
- };
249
- const {image: image$1} = Platform;
250
202
  const IncrementId = {
251
203
  RUNTIME: "runtime",
252
204
  LEAF: "leaf",
@@ -266,7 +218,7 @@ var LeaferUI = function(exports) {
266
218
  };
267
219
  const I$2 = IncrementId;
268
220
  let tempA, tempB, tempTo;
269
- const {max: max$6} = Math, tempFour = [ 0, 0, 0, 0 ];
221
+ const {max: max$7} = Math, tempFour = [ 0, 0, 0, 0 ];
270
222
  const FourNumberHelper = {
271
223
  zero: [ ...tempFour ],
272
224
  tempFour: tempFour,
@@ -317,9 +269,9 @@ var LeaferUI = function(exports) {
317
269
  return data;
318
270
  },
319
271
  max(t, other, change) {
320
- if (isNumber(t) && isNumber(other)) return max$6(t, other);
272
+ if (isNumber(t) && isNumber(other)) return max$7(t, other);
321
273
  toTempAB(t, other, change);
322
- return set$2(tempTo, max$6(tempA[0], tempB[0]), max$6(tempA[1], tempB[1]), max$6(tempA[2], tempB[2]), max$6(tempA[3], tempB[3]));
274
+ return set$2(tempTo, max$7(tempA[0], tempB[0]), max$7(tempA[1], tempB[1]), max$7(tempA[2], tempB[2]), max$7(tempA[3], tempB[3]));
323
275
  },
324
276
  add(t, other, change) {
325
277
  if (isNumber(t) && isNumber(other)) return t + other;
@@ -334,7 +286,7 @@ var LeaferUI = function(exports) {
334
286
  }
335
287
  };
336
288
  const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
337
- const {round: round$6, pow: pow$2, max: max$5, floor: floor$2, PI: PI$4} = Math;
289
+ const {round: round$6, pow: pow$2, max: max$6, floor: floor$3, PI: PI$4} = Math;
338
290
  const MathHelper = {
339
291
  within(value, min, max) {
340
292
  if (isObject(min)) max = min.max, min = min.min;
@@ -387,7 +339,7 @@ var LeaferUI = function(exports) {
387
339
  }
388
340
  },
389
341
  getFloorScale(num, min = 1) {
390
- return max$5(floor$2(num), min) / num;
342
+ return max$6(floor$3(num), min) / num;
391
343
  },
392
344
  randInt: randInt,
393
345
  randColor(opacity) {
@@ -1193,7 +1145,7 @@ var LeaferUI = function(exports) {
1193
1145
  const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$5, addPoint: addPoint$3, toBounds: toBounds$3} = TwoPointBoundsHelper;
1194
1146
  const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
1195
1147
  const {float: float$3, fourNumber: fourNumber$1} = MathHelper;
1196
- const {floor: floor$1, ceil: ceil$2} = Math;
1148
+ const {floor: floor$2, ceil: ceil$2} = Math;
1197
1149
  let right$4, bottom$3, boundsRight, boundsBottom;
1198
1150
  const point$2 = {};
1199
1151
  const toPoint$5 = {};
@@ -1345,8 +1297,8 @@ var LeaferUI = function(exports) {
1345
1297
  },
1346
1298
  ceil(t) {
1347
1299
  const {x: x, y: y} = t;
1348
- t.x = floor$1(t.x);
1349
- t.y = floor$1(t.y);
1300
+ t.x = floor$2(t.x);
1301
+ t.y = floor$2(t.y);
1350
1302
  t.width = x > t.x ? ceil$2(t.width + x - t.x) : ceil$2(t.width);
1351
1303
  t.height = y > t.y ? ceil$2(t.height + y - t.y) : ceil$2(t.height);
1352
1304
  },
@@ -1478,6 +1430,9 @@ var LeaferUI = function(exports) {
1478
1430
  isEmpty(t) {
1479
1431
  return t.x === 0 && t.y === 0 && t.width === 0 && t.height === 0;
1480
1432
  },
1433
+ hasSize(t) {
1434
+ return t.width && t.height;
1435
+ },
1481
1436
  reset(t) {
1482
1437
  B.set(t);
1483
1438
  }
@@ -1648,6 +1603,11 @@ var LeaferUI = function(exports) {
1648
1603
  return new Bounds(left, top, width ? width : parent.width - left - right, height ? height : parent.height - top - bottom);
1649
1604
  }
1650
1605
  }
1606
+ const UnitConvertHelper = {
1607
+ number(value, percentRefer) {
1608
+ return isObject(value) ? value.type === "percent" ? value.value * percentRefer : value.value : value;
1609
+ }
1610
+ };
1651
1611
  const StringNumberMap = {
1652
1612
  0: 1,
1653
1613
  1: 1,
@@ -1663,6 +1623,66 @@ var LeaferUI = function(exports) {
1663
1623
  e: 1,
1664
1624
  E: 1
1665
1625
  };
1626
+ const {floor: floor$1, max: max$5} = Math;
1627
+ const Platform = {
1628
+ toURL(text, fileType) {
1629
+ let url = encodeURIComponent(text);
1630
+ if (fileType === "text") url = "data:text/plain;charset=utf-8," + url; else if (fileType === "svg") url = "data:image/svg+xml," + url;
1631
+ return url;
1632
+ },
1633
+ image: {
1634
+ hitCanvasSize: 100,
1635
+ maxCacheSize: 2560 * 1600,
1636
+ maxPatternSize: 4096 * 2160,
1637
+ crossOrigin: "anonymous",
1638
+ isLarge(size, scaleX, scaleY, largeSize) {
1639
+ return size.width * size.height * (scaleX ? scaleX * scaleY : 1) > (largeSize || image$1.maxCacheSize);
1640
+ },
1641
+ isSuperLarge(size, scaleX, scaleY) {
1642
+ return image$1.isLarge(size, scaleX, scaleY, image$1.maxPatternSize);
1643
+ },
1644
+ getRealURL(url) {
1645
+ const {prefix: prefix, suffix: suffix} = image$1;
1646
+ if (suffix && !url.startsWith("data:") && !url.startsWith("blob:")) url += (url.includes("?") ? "&" : "?") + suffix;
1647
+ if (prefix && url[0] === "/") url = prefix + url;
1648
+ return url;
1649
+ },
1650
+ resize(view, width, height, xGap, yGap, clip, smooth, opacity, _filters, interlace) {
1651
+ const realWidth = max$5(floor$1(width + (xGap || 0)), 1), realHeight = max$5(floor$1(height + (yGap || 0)), 1);
1652
+ let interlaceX, interlaceY, interlaceOffset;
1653
+ if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset, (interlaceX = interlace.type === "x") ? width : height))) interlaceX || (interlaceY = true);
1654
+ const canvas = Platform.origin.createCanvas(interlaceY ? realWidth * 2 : realWidth, interlaceX ? realHeight * 2 : realHeight);
1655
+ const ctx = canvas.getContext("2d");
1656
+ if (opacity) ctx.globalAlpha = opacity;
1657
+ ctx.imageSmoothingEnabled = smooth === false ? false : true;
1658
+ if (image$1.canUse(view)) {
1659
+ if (clip) {
1660
+ const scaleX = width / clip.width, scaleY = height / clip.height;
1661
+ ctx.setTransform(scaleX, 0, 0, scaleY, -clip.x * scaleX, -clip.y * scaleY);
1662
+ ctx.drawImage(view, 0, 0, view.width, view.height);
1663
+ } else ctx.drawImage(view, 0, 0, width, height);
1664
+ if (interlaceOffset) {
1665
+ ctx.drawImage(canvas, 0, 0, realWidth, realHeight, interlaceX ? interlaceOffset - realWidth : realWidth, interlaceX ? realHeight : interlaceOffset - realHeight, realWidth, realHeight);
1666
+ ctx.drawImage(canvas, 0, 0, realWidth, realHeight, interlaceX ? interlaceOffset : realWidth, interlaceX ? realHeight : interlaceOffset, realWidth, realHeight);
1667
+ }
1668
+ }
1669
+ return canvas;
1670
+ },
1671
+ canUse(view) {
1672
+ return view && view.width && !view.__closed;
1673
+ },
1674
+ setPatternTransform(pattern, transform, paint) {
1675
+ try {
1676
+ if (transform && pattern.setTransform) {
1677
+ pattern.setTransform(transform);
1678
+ transform = undefined;
1679
+ }
1680
+ } catch (_a) {}
1681
+ if (paint) DataHelper.stintSet(paint, "transform", transform);
1682
+ }
1683
+ }
1684
+ };
1685
+ const {image: image$1} = Platform;
1666
1686
  const {randColor: randColor} = MathHelper;
1667
1687
  class Debug {
1668
1688
  constructor(name) {
@@ -3549,9 +3569,10 @@ var LeaferUI = function(exports) {
3549
3569
  run() {
3550
3570
  return __awaiter(this, void 0, void 0, function*() {
3551
3571
  try {
3552
- if (this.isComplete) return;
3572
+ if (this.isComplete || this.runing) return;
3573
+ this.runing = true;
3553
3574
  if (this.canUse && !this.canUse()) return this.cancel();
3554
- if (this.task && this.parent.running) yield this.task();
3575
+ if (this.task) yield this.task();
3555
3576
  } catch (error) {
3556
3577
  debug$c.error(error);
3557
3578
  }
@@ -3666,7 +3687,7 @@ var LeaferUI = function(exports) {
3666
3687
  stop() {
3667
3688
  this.isComplete = true;
3668
3689
  this.list.forEach(task => {
3669
- if (!task.isComplete) task.cancel();
3690
+ if (!task.isComplete) task.run();
3670
3691
  });
3671
3692
  this.pause();
3672
3693
  this.empty();
@@ -3949,7 +3970,7 @@ var LeaferUI = function(exports) {
3949
3970
  getFull(_filters) {
3950
3971
  return this.view;
3951
3972
  }
3952
- getCanvas(width, height, opacity, filters, xGap, yGap, smooth) {
3973
+ getCanvas(width, height, opacity, filters, xGap, yGap, smooth, interlace) {
3953
3974
  width || (width = this.width);
3954
3975
  height || (height = this.height);
3955
3976
  if (this.cache) {
@@ -3962,7 +3983,7 @@ var LeaferUI = function(exports) {
3962
3983
  }
3963
3984
  if (data) return data;
3964
3985
  }
3965
- const canvas = Platform.image.resize(this.view, width, height, xGap, yGap, undefined, smooth, opacity, filters);
3986
+ const canvas = Platform.image.resize(this.view, width, height, xGap, yGap, undefined, smooth, opacity, filters, interlace);
3966
3987
  this.cache = this.use > 1 ? {
3967
3988
  data: canvas,
3968
3989
  params: arguments
@@ -3978,13 +3999,13 @@ var LeaferUI = function(exports) {
3978
3999
  return this.url;
3979
4000
  }
3980
4001
  setThumbView(_view) {}
3981
- getThumbSize() {
4002
+ getThumbSize(_lod) {
3982
4003
  return undefined;
3983
4004
  }
3984
4005
  getMinLevel() {
3985
4006
  return undefined;
3986
4007
  }
3987
- getLevelData(_level) {
4008
+ getLevelData(_level, _width, _height) {
3988
4009
  return undefined;
3989
4010
  }
3990
4011
  clearLevels(_checkUse) {}
@@ -5704,7 +5725,7 @@ var LeaferUI = function(exports) {
5704
5725
  if (this.__layout.opacityChanged) this.__layout.opacityChanged = false;
5705
5726
  }
5706
5727
  };
5707
- const {excludeRenderBounds: excludeRenderBounds$1} = LeafBoundsHelper;
5728
+ const {excludeRenderBounds: excludeRenderBounds$1} = LeafBoundsHelper, {hasSize: hasSize} = BoundsHelper;
5708
5729
  const BranchRender = {
5709
5730
  __updateChange() {
5710
5731
  const {__layout: layout} = this;
@@ -5715,8 +5736,8 @@ var LeaferUI = function(exports) {
5715
5736
  this.__.__checkSingle();
5716
5737
  },
5717
5738
  __render(canvas, options) {
5718
- this.__nowWorld = this.__getNowWorld(options);
5719
- if (this.__worldOpacity) {
5739
+ const nowWorld = this.__nowWorld = this.__getNowWorld(options);
5740
+ if (this.__worldOpacity && hasSize(nowWorld)) {
5720
5741
  const data = this.__;
5721
5742
  if (data.__useDim) {
5722
5743
  if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.bright && !options.topRendering) return options.topList.add(this); else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
@@ -5725,7 +5746,6 @@ var LeaferUI = function(exports) {
5725
5746
  if (data.eraser === "path") return this.__renderEraser(canvas, options);
5726
5747
  const tempCanvas = canvas.getSameCanvas(false, true);
5727
5748
  this.__renderBranch(tempCanvas, options);
5728
- const nowWorld = this.__nowWorld;
5729
5749
  canvas.opacity = options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
5730
5750
  canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld, data.__blendMode, true);
5731
5751
  tempCanvas.recycle(nowWorld);
@@ -6547,7 +6567,7 @@ var LeaferUI = function(exports) {
6547
6567
  this.levelMap = null;
6548
6568
  }
6549
6569
  }
6550
- const version = "1.12.3";
6570
+ const version = "2.0.0";
6551
6571
  class LeaferCanvas extends LeaferCanvasBase {
6552
6572
  get allowBackgroundColor() {
6553
6573
  return true;
@@ -6947,6 +6967,7 @@ var LeaferUI = function(exports) {
6947
6967
  this.times = 0;
6948
6968
  this.config = {
6949
6969
  usePartRender: true,
6970
+ ceilPartPixel: true,
6950
6971
  maxFPS: 120
6951
6972
  };
6952
6973
  this.frames = [];
@@ -7055,8 +7076,9 @@ var LeaferUI = function(exports) {
7055
7076
  const {canvas: canvas} = this, bounds = block.getIntersect(canvas.bounds), realBounds = new Bounds(bounds);
7056
7077
  canvas.save();
7057
7078
  bounds.spread(Renderer.clipSpread).ceil();
7058
- canvas.clearWorld(bounds);
7059
- canvas.clipWorld(bounds);
7079
+ const {ceilPartPixel: ceilPartPixel} = this.config;
7080
+ canvas.clipWorld(bounds, ceilPartPixel);
7081
+ canvas.clearWorld(bounds, ceilPartPixel);
7060
7082
  this.__render(bounds, realBounds);
7061
7083
  canvas.restore();
7062
7084
  Run.end(t);
@@ -7438,11 +7460,7 @@ var LeaferUI = function(exports) {
7438
7460
  const ColorConvert = {
7439
7461
  hasTransparent: hasTransparent$3
7440
7462
  };
7441
- const UnitConvert = {
7442
- number(value, percentRefer) {
7443
- return isObject(value) ? value.type === "percent" ? value.value * percentRefer : value.value : value;
7444
- }
7445
- };
7463
+ const UnitConvert = UnitConvertHelper;
7446
7464
  const PathArrow = {};
7447
7465
  const Paint = {};
7448
7466
  const PaintImage = {};
@@ -8660,9 +8678,10 @@ var LeaferUI = function(exports) {
8660
8678
  const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = this.__;
8661
8679
  const rx = width / 2, ry = height / 2;
8662
8680
  const path = this.__.path = [];
8681
+ let open;
8663
8682
  if (innerRadius) {
8664
8683
  if (startAngle || endAngle) {
8665
- if (innerRadius < 1) ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false);
8684
+ if (innerRadius < 1) ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false); else open = true;
8666
8685
  ellipse(path, rx, ry, rx, ry, 0, endAngle, startAngle, true);
8667
8686
  } else {
8668
8687
  if (innerRadius < 1) {
@@ -8679,7 +8698,7 @@ var LeaferUI = function(exports) {
8679
8698
  ellipse(path, rx, ry, rx, ry);
8680
8699
  }
8681
8700
  }
8682
- closePath$2(path);
8701
+ if (!open) closePath$2(path);
8683
8702
  if (Platform.ellipseToCurve) this.__.path = this.getPath(true);
8684
8703
  }
8685
8704
  };
@@ -10345,6 +10364,7 @@ var LeaferUI = function(exports) {
10345
10364
  ImageManager.patternLocked = true;
10346
10365
  this.__renderShape(h, {
10347
10366
  matrix: matrix$2.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y),
10367
+ snapshot: true,
10348
10368
  ignoreFill: !isHitPixelFill,
10349
10369
  ignoreStroke: !isHitPixelStroke
10350
10370
  });
@@ -10813,7 +10833,7 @@ var LeaferUI = function(exports) {
10813
10833
  ignoreRender(ui, false);
10814
10834
  onLoadError(ui, event, error);
10815
10835
  leafPaint.loadId = undefined;
10816
- }, paint.lod && image.getThumbSize());
10836
+ }, paint.lod && image.getThumbSize(paint.lod));
10817
10837
  if (ui.placeholderColor) {
10818
10838
  if (!ui.placeholderDelay) image.isPlacehold = true; else setTimeout(() => {
10819
10839
  if (!image.ready) {
@@ -10871,7 +10891,7 @@ var LeaferUI = function(exports) {
10871
10891
  if (paint.padding) box = tempBox.set(box).shrink(paint.padding);
10872
10892
  if (paint.mode === "strench") paint.mode = "stretch";
10873
10893
  const {width: width, height: height} = image;
10874
- const {opacity: opacity, mode: mode, align: align, offset: offset, scale: scale, size: size, rotation: rotation, skew: skew, clipSize: clipSize, repeat: repeat, gap: gap, filters: filters} = paint;
10894
+ const {opacity: opacity, mode: mode, align: align, offset: offset, scale: scale, size: size, rotation: rotation, skew: skew, clipSize: clipSize, repeat: repeat, gap: gap, filters: filters, interlace: interlace} = paint;
10875
10895
  const sameBox = box.width === width && box.height === height;
10876
10896
  const data = {
10877
10897
  mode: mode
@@ -10937,6 +10957,10 @@ var LeaferUI = function(exports) {
10937
10957
  if (opacity && opacity < 1) data.opacity = opacity;
10938
10958
  if (filters) data.filters = filters;
10939
10959
  if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
10960
+ if (interlace) data.interlace = isNumber(interlace) || interlace.type === "percent" ? {
10961
+ type: "x",
10962
+ offset: interlace
10963
+ } : interlace;
10940
10964
  return data;
10941
10965
  }
10942
10966
  function getGapData(gap, repeat, width, height, box) {
@@ -11057,7 +11081,7 @@ var LeaferUI = function(exports) {
11057
11081
  if (transform) copy$4(imageMatrix, transform);
11058
11082
  scale$1(imageMatrix, 1 / scaleX, 1 / scaleY);
11059
11083
  }
11060
- const imageCanvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth);
11084
+ const imageCanvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
11061
11085
  const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
11062
11086
  paint.style = pattern;
11063
11087
  paint.patternId = id;
@@ -11077,8 +11101,8 @@ var LeaferUI = function(exports) {
11077
11101
  }
11078
11102
  function checkImage(paint, drawImage, ui, canvas, renderOptions) {
11079
11103
  const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions);
11080
- const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting} = renderOptions;
11081
- if (!data || paint.patternId === scaleX + "-" + scaleY && !exporting) {
11104
+ const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting, snapshot: snapshot} = renderOptions;
11105
+ if (!data || paint.patternId === scaleX + "-" + scaleY && !exporting || snapshot) {
11082
11106
  return false;
11083
11107
  } else {
11084
11108
  if (drawImage) {
@@ -11671,7 +11695,7 @@ var LeaferUI = function(exports) {
11671
11695
  const TextMode = 2;
11672
11696
  function layoutChar(drawData, style, width, _height) {
11673
11697
  const {rows: rows} = drawData;
11674
- const {textAlign: textAlign, paraIndent: paraIndent, letterSpacing: letterSpacing} = style;
11698
+ const {textAlign: textAlign, paraIndent: paraIndent, __letterSpacing: __letterSpacing} = style;
11675
11699
  const justifyLast = width && textAlign.includes("both");
11676
11700
  const justify = justifyLast || width && textAlign.includes("justify");
11677
11701
  const justifyLetter = justify && textAlign.includes("letter");
@@ -11684,8 +11708,8 @@ var LeaferUI = function(exports) {
11684
11708
  remainingWidth = width - row.width - indentWidth;
11685
11709
  if (justifyLetter) addLetterWidth = remainingWidth / (row.words.reduce((total, item) => total + item.data.length, 0) - 1); else addWordWidth = wordsLength > 1 ? remainingWidth / (wordsLength - 1) : 0;
11686
11710
  }
11687
- mode = letterSpacing || row.isOverflow || justifyLetter ? CharMode : addWordWidth ? WordMode : TextMode;
11688
- if (row.isOverflow && !letterSpacing) row.textMode = true;
11711
+ mode = __letterSpacing || row.isOverflow || justifyLetter ? CharMode : addWordWidth ? WordMode : TextMode;
11712
+ if (row.isOverflow && !__letterSpacing) row.textMode = true;
11689
11713
  if (mode === TextMode) {
11690
11714
  row.x += indentWidth;
11691
11715
  toTextChar$1(row);
@@ -15106,13 +15130,14 @@ var LeaferUI = function(exports) {
15106
15130
  LeaferTypeCreator.run(type, this);
15107
15131
  };
15108
15132
  leafer.getValidMove = function(moveX, moveY, checkLimit = true) {
15109
- const {disabled: disabled} = this.app.config.move;
15133
+ const {disabled: disabled, scrollSpread: scrollSpread} = this.app.config.move;
15110
15134
  move$4.set(moveX, moveY);
15111
15135
  const scrollType = getScrollType(this);
15112
15136
  if (scrollType) {
15113
15137
  if (scrollType.includes("x")) move$4.y = 0; else if (scrollType.includes("y")) move$4.x = 0; else Math.abs(move$4.x) > Math.abs(move$4.y) ? move$4.y = 0 : move$4.x = 0;
15114
15138
  if (checkLimit && scrollType.includes("limit")) {
15115
15139
  bounds.set(this.__world).addPoint(this.zoomLayer);
15140
+ if (scrollSpread) bounds.spread(scrollSpread);
15116
15141
  DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, "auto", move$4, true);
15117
15142
  if (scrollType.includes("x")) move$4.y = 0; else if (scrollType.includes("y")) move$4.x = 0;
15118
15143
  }
@@ -18492,7 +18517,13 @@ var LeaferUI = function(exports) {
18492
18517
  MathHelper.getScaleData(options.scale, options.size, renderBounds, scaleData);
18493
18518
  let pixelRatio = options.pixelRatio || 1;
18494
18519
  let {x: x, y: y, width: width, height: height} = new Bounds(renderBounds).scale(scaleData.scaleX, scaleData.scaleY);
18495
- if (clip) x += clip.x, y += clip.y, width = clip.width, height = clip.height;
18520
+ if (clip) {
18521
+ x += clip.x, y += clip.y, width = clip.width, height = clip.height;
18522
+ if (clip.rotation) matrix.rotateOfInner({
18523
+ x: x,
18524
+ y: y
18525
+ }, -clip.rotation);
18526
+ }
18496
18527
  const renderOptions = {
18497
18528
  exporting: true,
18498
18529
  matrix: matrix.scale(1 / scaleData.scaleX, 1 / scaleData.scaleY).invert().translate(-x, -y).withScale(1 / scaleX * scaleData.scaleX, 1 / scaleY * scaleData.scaleY)
@@ -18815,6 +18846,7 @@ var LeaferUI = function(exports) {
18815
18846
  exports.UIEvent = UIEvent;
18816
18847
  exports.UIRender = UIRender;
18817
18848
  exports.UnitConvert = UnitConvert;
18849
+ exports.UnitConvertHelper = UnitConvertHelper;
18818
18850
  exports.WaitHelper = WaitHelper;
18819
18851
  exports.WatchEvent = WatchEvent;
18820
18852
  exports.Watcher = Watcher;