@leafer-editor/worker 1.4.0 → 1.4.1

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.
@@ -1374,7 +1374,7 @@ function getNameList(name) {
1374
1374
  }
1375
1375
  const D$6 = Debug;
1376
1376
 
1377
- const debug$h = Debug.get('RunTime');
1377
+ const debug$i = Debug.get('RunTime');
1378
1378
  const Run = {
1379
1379
  currentId: 0,
1380
1380
  currentName: '',
@@ -1383,24 +1383,24 @@ const Run = {
1383
1383
  nameToIdMap: {},
1384
1384
  start(name, microsecond) {
1385
1385
  const id = IncrementId.create(IncrementId.RUNTIME);
1386
- R.currentId = R.idMap[id] = microsecond ? performance.now() : Date.now();
1387
- R.currentName = R.nameMap[id] = name;
1388
- R.nameToIdMap[name] = id;
1386
+ R$1.currentId = R$1.idMap[id] = microsecond ? performance.now() : Date.now();
1387
+ R$1.currentName = R$1.nameMap[id] = name;
1388
+ R$1.nameToIdMap[name] = id;
1389
1389
  return id;
1390
1390
  },
1391
1391
  end(id, microsecond) {
1392
- const time = R.idMap[id], name = R.nameMap[id];
1392
+ const time = R$1.idMap[id], name = R$1.nameMap[id];
1393
1393
  const duration = microsecond ? (performance.now() - time) / 1000 : Date.now() - time;
1394
- R.idMap[id] = R.nameMap[id] = R.nameToIdMap[name] = undefined;
1395
- debug$h.log(name, duration, 'ms');
1394
+ R$1.idMap[id] = R$1.nameMap[id] = R$1.nameToIdMap[name] = undefined;
1395
+ debug$i.log(name, duration, 'ms');
1396
1396
  },
1397
1397
  endOfName(name, microsecond) {
1398
- const id = R.nameToIdMap[name];
1398
+ const id = R$1.nameToIdMap[name];
1399
1399
  if (id !== undefined)
1400
- R.end(id, microsecond);
1400
+ R$1.end(id, microsecond);
1401
1401
  }
1402
1402
  };
1403
- const R = Run;
1403
+ const R$1 = Run;
1404
1404
 
1405
1405
  const check = [];
1406
1406
  const Plugin = {
@@ -1421,18 +1421,18 @@ const Plugin = {
1421
1421
  };
1422
1422
  setTimeout(() => check.forEach(name => Plugin.has(name, true)));
1423
1423
 
1424
- const debug$g = Debug.get('UICreator');
1424
+ const debug$h = Debug.get('UICreator');
1425
1425
  const UICreator = {
1426
1426
  list: {},
1427
1427
  register(UI) {
1428
1428
  const { __tag: tag } = UI.prototype;
1429
1429
  if (list$3[tag])
1430
- debug$g.repeat(tag);
1430
+ debug$h.repeat(tag);
1431
1431
  list$3[tag] = UI;
1432
1432
  },
1433
1433
  get(tag, data, x, y, width, height) {
1434
1434
  if (!list$3[tag])
1435
- debug$g.error('not register ' + tag);
1435
+ debug$h.error('not register ' + tag);
1436
1436
  const ui = new list$3[tag](data);
1437
1437
  if (x !== undefined) {
1438
1438
  ui.x = x;
@@ -1448,7 +1448,7 @@ const UICreator = {
1448
1448
  };
1449
1449
  const { list: list$3 } = UICreator;
1450
1450
 
1451
- const debug$f = Debug.get('EventCreator');
1451
+ const debug$g = Debug.get('EventCreator');
1452
1452
  const EventCreator = {
1453
1453
  nameList: {},
1454
1454
  register(Event) {
@@ -1456,7 +1456,7 @@ const EventCreator = {
1456
1456
  Object.keys(Event).forEach(key => {
1457
1457
  name = Event[key];
1458
1458
  if (typeof name === 'string')
1459
- nameList[name] && debug$f.repeat(name), nameList[name] = Event;
1459
+ nameList[name] && debug$g.repeat(name), nameList[name] = Event;
1460
1460
  });
1461
1461
  },
1462
1462
  changeName(oldName, newName) {
@@ -1533,10 +1533,10 @@ const DataHelper = {
1533
1533
  Object.keys(merge).forEach(key => {
1534
1534
  var _a, _b;
1535
1535
  value = merge[key];
1536
- if ((value === null || value === undefined ? undefined : value.constructor) === Object && ((_a = t[key]) === null || _a === undefined ? undefined : _a.constructor) === Object)
1536
+ if ((value === null || value === void 0 ? void 0 : value.constructor) === Object && ((_a = t[key]) === null || _a === void 0 ? void 0 : _a.constructor) === Object)
1537
1537
  return assign(t[key], merge[key], exclude && exclude[key]);
1538
1538
  if (exclude && (key in exclude)) {
1539
- if (((_b = exclude[key]) === null || _b === undefined ? undefined : _b.constructor) === Object)
1539
+ if (((_b = exclude[key]) === null || _b === void 0 ? void 0 : _b.constructor) === Object)
1540
1540
  assign(t[key] = {}, merge[key], exclude[key]);
1541
1541
  return;
1542
1542
  }
@@ -1660,7 +1660,7 @@ class LeafData {
1660
1660
  const t = this;
1661
1661
  if (t.blendMode === 'pass-through') {
1662
1662
  const leaf = this.__leaf;
1663
- if ((t.opacity < 1 && (leaf.isBranch || t.__hasMultiPaint)) || leaf.__hasEraser || t.eraser) {
1663
+ if ((t.opacity < 1 && (leaf.isBranch || t.__hasMultiPaint)) || leaf.__hasEraser || t.eraser || t.filter) {
1664
1664
  t.__single = true;
1665
1665
  }
1666
1666
  else if (t.__single) {
@@ -1773,7 +1773,7 @@ let Canvas$1 = class Canvas {
1773
1773
  }
1774
1774
  setTransform(_a, _b, _c, _d, _e, _f) { }
1775
1775
  resetTransform() { }
1776
- getTransform() { return undefined; }
1776
+ getTransform() { return void 0; }
1777
1777
  save() { }
1778
1778
  restore() { }
1779
1779
  transform(a, b, c, d, e, f) {
@@ -1830,12 +1830,12 @@ let Canvas$1 = class Canvas {
1830
1830
  ellipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise) { }
1831
1831
  rect(_x, _y, _width, _height) { }
1832
1832
  roundRect(_x, _y, _width, _height, _radius) { }
1833
- createConicGradient(_startAngle, _x, _y) { return undefined; }
1834
- createLinearGradient(_x0, _y0, _x1, _y1) { return undefined; }
1835
- createPattern(_image, _repetition) { return undefined; }
1836
- createRadialGradient(_x0, _y0, _r0, _x1, _y1, _r1) { return undefined; }
1833
+ createConicGradient(_startAngle, _x, _y) { return void 0; }
1834
+ createLinearGradient(_x0, _y0, _x1, _y1) { return void 0; }
1835
+ createPattern(_image, _repetition) { return void 0; }
1836
+ createRadialGradient(_x0, _y0, _r0, _x1, _y1, _r1) { return void 0; }
1837
1837
  fillText(_text, _x, _y, _maxWidth) { }
1838
- measureText(_text) { return undefined; }
1838
+ measureText(_text) { return void 0; }
1839
1839
  strokeText(_text, _x, _y, _maxWidth) { }
1840
1840
  destroy() {
1841
1841
  this.context = null;
@@ -1843,79 +1843,79 @@ let Canvas$1 = class Canvas {
1843
1843
  };
1844
1844
  __decorate([
1845
1845
  contextAttr('imageSmoothingEnabled')
1846
- ], Canvas$1.prototype, "smooth", undefined);
1846
+ ], Canvas$1.prototype, "smooth", void 0);
1847
1847
  __decorate([
1848
1848
  contextAttr('imageSmoothingQuality')
1849
- ], Canvas$1.prototype, "smoothLevel", undefined);
1849
+ ], Canvas$1.prototype, "smoothLevel", void 0);
1850
1850
  __decorate([
1851
1851
  contextAttr('globalAlpha')
1852
- ], Canvas$1.prototype, "opacity", undefined);
1852
+ ], Canvas$1.prototype, "opacity", void 0);
1853
1853
  __decorate([
1854
1854
  contextAttr()
1855
- ], Canvas$1.prototype, "fillStyle", undefined);
1855
+ ], Canvas$1.prototype, "fillStyle", void 0);
1856
1856
  __decorate([
1857
1857
  contextAttr()
1858
- ], Canvas$1.prototype, "strokeStyle", undefined);
1858
+ ], Canvas$1.prototype, "strokeStyle", void 0);
1859
1859
  __decorate([
1860
1860
  contextAttr('lineWidth')
1861
- ], Canvas$1.prototype, "strokeWidth", undefined);
1861
+ ], Canvas$1.prototype, "strokeWidth", void 0);
1862
1862
  __decorate([
1863
1863
  contextAttr('lineCap')
1864
- ], Canvas$1.prototype, "strokeCap", undefined);
1864
+ ], Canvas$1.prototype, "strokeCap", void 0);
1865
1865
  __decorate([
1866
1866
  contextAttr('lineJoin')
1867
- ], Canvas$1.prototype, "strokeJoin", undefined);
1867
+ ], Canvas$1.prototype, "strokeJoin", void 0);
1868
1868
  __decorate([
1869
1869
  contextAttr('lineDashOffset')
1870
- ], Canvas$1.prototype, "dashOffset", undefined);
1870
+ ], Canvas$1.prototype, "dashOffset", void 0);
1871
1871
  __decorate([
1872
1872
  contextAttr()
1873
- ], Canvas$1.prototype, "miterLimit", undefined);
1873
+ ], Canvas$1.prototype, "miterLimit", void 0);
1874
1874
  __decorate([
1875
1875
  contextAttr()
1876
- ], Canvas$1.prototype, "shadowBlur", undefined);
1876
+ ], Canvas$1.prototype, "shadowBlur", void 0);
1877
1877
  __decorate([
1878
1878
  contextAttr()
1879
- ], Canvas$1.prototype, "shadowColor", undefined);
1879
+ ], Canvas$1.prototype, "shadowColor", void 0);
1880
1880
  __decorate([
1881
1881
  contextAttr()
1882
- ], Canvas$1.prototype, "shadowOffsetX", undefined);
1882
+ ], Canvas$1.prototype, "shadowOffsetX", void 0);
1883
1883
  __decorate([
1884
1884
  contextAttr()
1885
- ], Canvas$1.prototype, "shadowOffsetY", undefined);
1885
+ ], Canvas$1.prototype, "shadowOffsetY", void 0);
1886
1886
  __decorate([
1887
1887
  contextAttr()
1888
- ], Canvas$1.prototype, "filter", undefined);
1888
+ ], Canvas$1.prototype, "filter", void 0);
1889
1889
  __decorate([
1890
1890
  contextAttr()
1891
- ], Canvas$1.prototype, "font", undefined);
1891
+ ], Canvas$1.prototype, "font", void 0);
1892
1892
  __decorate([
1893
1893
  contextAttr()
1894
- ], Canvas$1.prototype, "fontKerning", undefined);
1894
+ ], Canvas$1.prototype, "fontKerning", void 0);
1895
1895
  __decorate([
1896
1896
  contextAttr()
1897
- ], Canvas$1.prototype, "fontStretch", undefined);
1897
+ ], Canvas$1.prototype, "fontStretch", void 0);
1898
1898
  __decorate([
1899
1899
  contextAttr()
1900
- ], Canvas$1.prototype, "fontVariantCaps", undefined);
1900
+ ], Canvas$1.prototype, "fontVariantCaps", void 0);
1901
1901
  __decorate([
1902
1902
  contextAttr()
1903
- ], Canvas$1.prototype, "textAlign", undefined);
1903
+ ], Canvas$1.prototype, "textAlign", void 0);
1904
1904
  __decorate([
1905
1905
  contextAttr()
1906
- ], Canvas$1.prototype, "textBaseline", undefined);
1906
+ ], Canvas$1.prototype, "textBaseline", void 0);
1907
1907
  __decorate([
1908
1908
  contextAttr()
1909
- ], Canvas$1.prototype, "textRendering", undefined);
1909
+ ], Canvas$1.prototype, "textRendering", void 0);
1910
1910
  __decorate([
1911
1911
  contextAttr()
1912
- ], Canvas$1.prototype, "wordSpacing", undefined);
1912
+ ], Canvas$1.prototype, "wordSpacing", void 0);
1913
1913
  __decorate([
1914
1914
  contextAttr()
1915
- ], Canvas$1.prototype, "letterSpacing", undefined);
1915
+ ], Canvas$1.prototype, "letterSpacing", void 0);
1916
1916
  __decorate([
1917
1917
  contextAttr()
1918
- ], Canvas$1.prototype, "direction", undefined);
1918
+ ], Canvas$1.prototype, "direction", void 0);
1919
1919
  __decorate([
1920
1920
  contextMethod()
1921
1921
  ], Canvas$1.prototype, "setTransform", null);
@@ -2612,7 +2612,7 @@ const EllipseHelper = {
2612
2612
  const { M: M$7, m, L: L$8, l, H, h, V, v, C: C$7, c, S, s, Q: Q$6, q, T, t, A, a, Z: Z$6, z, N: N$5, D: D$5, X: X$5, G: G$5, F: F$6, O: O$6, P: P$5, U: U$5 } = PathCommandMap;
2613
2613
  const { rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
2614
2614
  const { ellipticalArc } = EllipseHelper;
2615
- const debug$e = Debug.get('PathConvert');
2615
+ const debug$f = Debug.get('PathConvert');
2616
2616
  const setEndPoint$1 = {};
2617
2617
  const PathConvert = {
2618
2618
  current: { dot: 0 },
@@ -2853,7 +2853,7 @@ const PathConvert = {
2853
2853
  i += 6;
2854
2854
  break;
2855
2855
  default:
2856
- debug$e.error(`command: ${command} [index:${i}]`, old);
2856
+ debug$f.error(`command: ${command} [index:${i}]`, old);
2857
2857
  return data;
2858
2858
  }
2859
2859
  lastCommand = command;
@@ -2962,12 +2962,10 @@ const PathCommandDataHelper = {
2962
2962
  },
2963
2963
  arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
2964
2964
  if (lastX !== undefined) {
2965
- const maxRadius = tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2) * (getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / 2);
2966
- data.push(U$4, x1, y1, x2, y2, min(radius, abs$4(maxRadius)));
2967
- }
2968
- else {
2969
- data.push(U$4, x1, y1, x2, y2, radius);
2965
+ const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
2966
+ radius = min(radius, min(d / 2, d / 2 * abs$4(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
2970
2967
  }
2968
+ data.push(U$4, x1, y1, x2, y2, radius);
2971
2969
  },
2972
2970
  drawEllipse(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
2973
2971
  BezierHelper.ellipse(null, x, y, radiusX, radiusY, rotation === undefined ? 0 : rotation, startAngle === undefined ? 0 : startAngle, endAngle === undefined ? 360 : endAngle, anticlockwise, null, null, startPoint);
@@ -3078,7 +3076,7 @@ class PathCreator {
3078
3076
  }
3079
3077
 
3080
3078
  const { M: M$5, L: L$6, C: C$5, Q: Q$4, Z: Z$4, N: N$3, D: D$3, X: X$3, G: G$3, F: F$4, O: O$4, P: P$3, U: U$3 } = PathCommandMap;
3081
- const debug$d = Debug.get('PathDrawer');
3079
+ const debug$e = Debug.get('PathDrawer');
3082
3080
  const PathDrawer = {
3083
3081
  drawPathByData(drawer, data) {
3084
3082
  if (!data)
@@ -3141,7 +3139,7 @@ const PathDrawer = {
3141
3139
  i += 6;
3142
3140
  break;
3143
3141
  default:
3144
- debug$d.error(`command: ${command} [index:${i}]`, data);
3142
+ debug$e.error(`command: ${command} [index:${i}]`, data);
3145
3143
  return;
3146
3144
  }
3147
3145
  }
@@ -3151,7 +3149,7 @@ const PathDrawer = {
3151
3149
  const { M: M$4, L: L$5, C: C$4, Q: Q$3, Z: Z$3, N: N$2, D: D$2, X: X$2, G: G$2, F: F$3, O: O$3, P: P$2, U: U$2 } = PathCommandMap;
3152
3150
  const { toTwoPointBounds, toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc, ellipse: ellipse$1 } = BezierHelper;
3153
3151
  const { addPointBounds, copy: copy$b, addPoint: addPoint$1, setPoint: setPoint$3, addBounds, toBounds: toBounds$3 } = TwoPointBoundsHelper;
3154
- const debug$c = Debug.get('PathBounds');
3152
+ const debug$d = Debug.get('PathBounds');
3155
3153
  let radius, radiusX, radiusY;
3156
3154
  const tempPointBounds = {};
3157
3155
  const setPointBounds = {};
@@ -3259,7 +3257,7 @@ const PathBounds = {
3259
3257
  i += 6;
3260
3258
  break;
3261
3259
  default:
3262
- debug$c.error(`command: ${command} [index:${i}]`, data);
3260
+ debug$d.error(`command: ${command} [index:${i}]`, data);
3263
3261
  return;
3264
3262
  }
3265
3263
  }
@@ -3375,7 +3373,7 @@ const FileHelper = {
3375
3373
  const F$2 = FileHelper;
3376
3374
  F$2.opacityTypes.forEach(type => F$2.upperCaseTypeMap[type] = type.toUpperCase());
3377
3375
 
3378
- const debug$b = Debug.get('TaskProcessor');
3376
+ const debug$c = Debug.get('TaskProcessor');
3379
3377
  class TaskItem {
3380
3378
  constructor(task) {
3381
3379
  this.parallel = true;
@@ -3384,13 +3382,13 @@ class TaskItem {
3384
3382
  this.task = task;
3385
3383
  }
3386
3384
  run() {
3387
- return __awaiter(this, undefined, undefined, function* () {
3385
+ return __awaiter(this, void 0, void 0, function* () {
3388
3386
  try {
3389
3387
  if (this.task && !this.isComplete && this.parent.running)
3390
3388
  yield this.task();
3391
3389
  }
3392
3390
  catch (error) {
3393
- debug$b.error(error);
3391
+ debug$c.error(error);
3394
3392
  }
3395
3393
  });
3396
3394
  }
@@ -3623,18 +3621,52 @@ class TaskProcessor {
3623
3621
  }
3624
3622
  }
3625
3623
 
3626
- const ImageManager = {
3624
+ const debug$b = Debug.get('Resource');
3625
+ const Resource = {
3626
+ tasker: new TaskProcessor(),
3627
3627
  map: {},
3628
+ get isComplete() { return R.tasker.isComplete; },
3629
+ set(key, value) {
3630
+ if (R.map[key])
3631
+ debug$b.repeat(key);
3632
+ R.map[key] = value;
3633
+ },
3634
+ get(key) {
3635
+ return R.map[key];
3636
+ },
3637
+ remove(key) {
3638
+ delete R.map[key];
3639
+ },
3640
+ loadImage(key, format) {
3641
+ return new Promise((resolve, reject) => {
3642
+ const image = this.setImage(key, key, format);
3643
+ image.load(() => resolve(image), (e) => reject(e));
3644
+ });
3645
+ },
3646
+ setImage(key, value, format) {
3647
+ let config;
3648
+ if (typeof value === 'string')
3649
+ config = { url: value };
3650
+ else if (!value.url)
3651
+ config = { url: key, view: value };
3652
+ if (config)
3653
+ format && (config.format = format), value = Creator.image(config);
3654
+ R.set(key, value);
3655
+ return value;
3656
+ },
3657
+ destroy() {
3658
+ R.map = {};
3659
+ }
3660
+ };
3661
+ const R = Resource;
3662
+
3663
+ const ImageManager = {
3628
3664
  recycledList: [],
3629
- tasker: new TaskProcessor(),
3630
3665
  patternTasker: new TaskProcessor(),
3631
- get isComplete() { return I$1.tasker.isComplete; },
3632
3666
  get(config) {
3633
- let image = I$1.map[config.url];
3634
- if (!image) {
3635
- image = Creator.image(config);
3636
- I$1.map[config.url] = image;
3637
- }
3667
+ let image = Resource.get(config.url);
3668
+ if (!image)
3669
+ Resource.set(config.url, image = Creator.image(config));
3638
3670
  image.use++;
3639
3671
  return image;
3640
3672
  },
@@ -3648,7 +3680,7 @@ const ImageManager = {
3648
3680
  if (list.length > 100) {
3649
3681
  list.forEach(image => {
3650
3682
  if (!image.use && image.url) {
3651
- delete I$1.map[image.url];
3683
+ Resource.remove(image.url);
3652
3684
  image.destroy();
3653
3685
  }
3654
3686
  });
@@ -3675,7 +3707,6 @@ const ImageManager = {
3675
3707
  return false;
3676
3708
  },
3677
3709
  destroy() {
3678
- I$1.map = {};
3679
3710
  I$1.recycledList = [];
3680
3711
  }
3681
3712
  };
@@ -3689,21 +3720,19 @@ class LeaferImage {
3689
3720
  this.use = 0;
3690
3721
  this.waitComplete = [];
3691
3722
  this.innerId = create$1(IMAGE);
3692
- this.config = config || { url: '' };
3693
- this.isSVG = ImageManager.isFormat('svg', config);
3694
- this.hasOpacityPixel = ImageManager.hasOpacityPixel(config);
3723
+ this.config = config || (config = { url: '' });
3724
+ if (config.view) {
3725
+ const { view } = config;
3726
+ this.setView(view.config ? view.view : view);
3727
+ }
3728
+ ImageManager.isFormat('svg', config) && (this.isSVG = true);
3729
+ ImageManager.hasOpacityPixel(config) && (this.hasOpacityPixel = true);
3695
3730
  }
3696
3731
  load(onSuccess, onError) {
3697
3732
  if (!this.loading) {
3698
3733
  this.loading = true;
3699
- ImageManager.tasker.add(() => __awaiter(this, undefined, undefined, function* () {
3700
- return yield Platform.origin.loadImage(this.url).then((img) => {
3701
- this.ready = true;
3702
- this.width = img.naturalWidth || img.width;
3703
- this.height = img.naturalHeight || img.height;
3704
- this.view = img;
3705
- this.onComplete(true);
3706
- }).catch((e) => {
3734
+ Resource.tasker.add(() => __awaiter(this, void 0, void 0, function* () {
3735
+ return yield Platform.origin.loadImage(this.url).then(img => this.setView(img)).catch((e) => {
3707
3736
  this.error = e;
3708
3737
  this.onComplete(false);
3709
3738
  });
@@ -3721,6 +3750,13 @@ class LeaferImage {
3721
3750
  }
3722
3751
  l[index] = l[index + 1] = undefined;
3723
3752
  }
3753
+ setView(img) {
3754
+ this.ready = true;
3755
+ this.width = img.naturalWidth || img.width;
3756
+ this.height = img.naturalHeight || img.height;
3757
+ this.view = img;
3758
+ this.onComplete(true);
3759
+ }
3724
3760
  onComplete(isSuccess) {
3725
3761
  let odd;
3726
3762
  this.waitComplete.forEach((item, index) => {
@@ -3739,6 +3775,9 @@ class LeaferImage {
3739
3775
  this.waitComplete.length = 0;
3740
3776
  this.loading = false;
3741
3777
  }
3778
+ getFull(_filters) {
3779
+ return this.view;
3780
+ }
3742
3781
  getCanvas(width, height, opacity, _filters) {
3743
3782
  width || (width = this.width);
3744
3783
  height || (height = this.height);
@@ -5219,7 +5258,7 @@ const LeafRender = {
5219
5258
  if (this.__.eraser === 'path')
5220
5259
  return this.__renderEraser(canvas, options);
5221
5260
  const tempCanvas = canvas.getSameCanvas(true, true);
5222
- this.__draw(tempCanvas, options);
5261
+ this.__draw(tempCanvas, options, canvas);
5223
5262
  if (this.__worldFlipped) {
5224
5263
  canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, this.__.__blendMode, true);
5225
5264
  }
@@ -6012,7 +6051,7 @@ class LeafLevelList {
6012
6051
  }
6013
6052
  }
6014
6053
 
6015
- const version = "1.4.0";
6054
+ const version = "1.4.1";
6016
6055
 
6017
6056
  class LeaferCanvas extends LeaferCanvasBase {
6018
6057
  get allowBackgroundColor() { return true; }
@@ -6357,7 +6396,7 @@ class Layouter {
6357
6396
  }
6358
6397
  partLayout() {
6359
6398
  var _a;
6360
- if (!((_a = this.__updatedList) === null || _a === undefined ? undefined : _a.length))
6399
+ if (!((_a = this.__updatedList) === null || _a === void 0 ? void 0 : _a.length))
6361
6400
  return;
6362
6401
  const t = Run.start('PartLayout');
6363
6402
  const { target, __updatedList: updateList } = this;
@@ -6822,9 +6861,10 @@ class Selector {
6822
6861
  this.finder = Creator.finder && Creator.finder();
6823
6862
  }
6824
6863
  getByPoint(hitPoint, hitRadius, options) {
6825
- if (Platform.backgrounder && this.target)
6826
- this.target.updateLayout();
6827
- return this.picker.getByPoint(hitPoint, hitRadius, options);
6864
+ const { target, picker } = this;
6865
+ if (Platform.backgrounder)
6866
+ target && target.updateLayout();
6867
+ return picker.getByPoint(hitPoint, hitRadius, options);
6828
6868
  }
6829
6869
  getBy(condition, branch, one, options) {
6830
6870
  return this.finder ? this.finder.getBy(condition, branch, one, options) : Plugin.need('find');
@@ -6882,9 +6922,7 @@ const TextConvert = {};
6882
6922
  const ColorConvert = {};
6883
6923
  const UnitConvert = {
6884
6924
  number(value, percentRefer) {
6885
- if (typeof value === 'object')
6886
- return value.type === 'percent' ? value.value * percentRefer : value.value;
6887
- return value;
6925
+ return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
6888
6926
  }
6889
6927
  };
6890
6928
  const PathArrow = {};
@@ -6892,16 +6930,15 @@ const Paint = {};
6892
6930
  const PaintImage = {};
6893
6931
  const PaintGradient = {};
6894
6932
  const Effect = {};
6933
+ const Filter = {
6934
+ apply() { Plugin.need('filter'); }
6935
+ };
6895
6936
  const Export = {};
6896
6937
  const State = {
6897
- setStyleName(_leaf, _styleName, _value) { return Plugin.need('state'); },
6898
- set(_leaf, _stateName) { return Plugin.need('state'); }
6899
- };
6900
- const Transition = {
6901
- list: {},
6902
- register(attrName, fn) { Transition.list[attrName] = fn; },
6903
- get(attrName) { return Transition.list[attrName]; }
6938
+ setStyleName() { return Plugin.need('state'); },
6939
+ set() { return Plugin.need('state'); }
6904
6940
  };
6941
+ const Transition = {};
6905
6942
 
6906
6943
  const { parse, objectToCanvasData } = PathConvert;
6907
6944
  const emptyPaint = {};
@@ -7008,24 +7045,13 @@ class UIData extends LeafData {
7008
7045
  }
7009
7046
  }
7010
7047
  setShadow(value) {
7011
- this.__setInput('shadow', value);
7012
- if (value instanceof Array) {
7013
- if (value.some((item) => item.visible === false))
7014
- value = value.filter((item) => item.visible !== false);
7015
- this._shadow = value.length ? value : null;
7016
- }
7017
- else
7018
- this._shadow = value && value.visible !== false ? [value] : null;
7048
+ setArray(this, 'shadow', value);
7019
7049
  }
7020
7050
  setInnerShadow(value) {
7021
- this.__setInput('innerShadow', value);
7022
- if (value instanceof Array) {
7023
- if (value.some((item) => item.visible === false))
7024
- value = value.filter((item) => item.visible !== false);
7025
- this._innerShadow = value.length ? value : null;
7026
- }
7027
- else
7028
- this._innerShadow = value && value.visible !== false ? [value] : null;
7051
+ setArray(this, 'innerShadow', value);
7052
+ }
7053
+ setFilter(value) {
7054
+ setArray(this, 'filter', value);
7029
7055
  }
7030
7056
  __computePaint() {
7031
7057
  const { fill, stroke } = this.__input;
@@ -7036,6 +7062,17 @@ class UIData extends LeafData {
7036
7062
  this.__needComputePaint = false;
7037
7063
  }
7038
7064
  }
7065
+ function setArray(data, key, value) {
7066
+ data.__setInput(key, value);
7067
+ if (value instanceof Array) {
7068
+ if (value.some((item) => item.visible === false))
7069
+ value = value.filter((item) => item.visible !== false);
7070
+ value.length || (value = null);
7071
+ }
7072
+ else
7073
+ value = value && value.visible !== false ? [value] : null;
7074
+ data['_' + key] = value;
7075
+ }
7039
7076
 
7040
7077
  class GroupData extends UIData {
7041
7078
  }
@@ -7158,11 +7195,13 @@ const UIBounds = {
7158
7195
  },
7159
7196
  __updateRenderSpread() {
7160
7197
  let width = 0;
7161
- const { shadow, innerShadow, blur, backgroundBlur } = this.__;
7198
+ const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
7162
7199
  if (shadow)
7163
7200
  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));
7164
7201
  if (blur)
7165
7202
  width = Math.max(width, blur);
7203
+ if (filter)
7204
+ width += Filter.getSpread(filter);
7166
7205
  let shapeWidth = width = Math.ceil(width);
7167
7206
  if (innerShadow)
7168
7207
  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));
@@ -7177,8 +7216,8 @@ const UIRender = {
7177
7216
  __updateChange() {
7178
7217
  const data = this.__;
7179
7218
  if (data.__useEffect) {
7180
- const { shadow, innerShadow, blur, backgroundBlur } = this.__;
7181
- data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur);
7219
+ const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
7220
+ data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur || filter);
7182
7221
  }
7183
7222
  data.__checkSingle();
7184
7223
  const complex = data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect;
@@ -7192,7 +7231,7 @@ const UIRender = {
7192
7231
  __drawFast(canvas, options) {
7193
7232
  drawFast(this, canvas, options);
7194
7233
  },
7195
- __draw(canvas, options) {
7234
+ __draw(canvas, options, originCanvas) {
7196
7235
  const data = this.__;
7197
7236
  if (data.__complex) {
7198
7237
  if (data.__needComputePaint)
@@ -7202,7 +7241,7 @@ const UIRender = {
7202
7241
  if (data.__useEffect) {
7203
7242
  const shape = Paint.shape(this, canvas, options);
7204
7243
  this.__nowWorld = this.__getNowWorld(options);
7205
- const { shadow, innerShadow } = data;
7244
+ const { shadow, innerShadow, filter } = data;
7206
7245
  if (shadow)
7207
7246
  Effect.shadow(this, canvas, shape);
7208
7247
  if (fill)
@@ -7213,6 +7252,8 @@ const UIRender = {
7213
7252
  Effect.innerShadow(this, canvas, shape);
7214
7253
  if (stroke)
7215
7254
  data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
7255
+ if (filter)
7256
+ Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
7216
7257
  if (shape.worldCanvas)
7217
7258
  shape.worldCanvas.recycle();
7218
7259
  shape.canvas.recycle();
@@ -7432,199 +7473,202 @@ let UI = UI_1 = class UI extends Leaf {
7432
7473
  };
7433
7474
  __decorate([
7434
7475
  dataProcessor(UIData)
7435
- ], UI.prototype, "__", undefined);
7476
+ ], UI.prototype, "__", void 0);
7436
7477
  __decorate([
7437
7478
  zoomLayerType()
7438
- ], UI.prototype, "zoomLayer", undefined);
7479
+ ], UI.prototype, "zoomLayer", void 0);
7439
7480
  __decorate([
7440
7481
  dataType('')
7441
- ], UI.prototype, "id", undefined);
7482
+ ], UI.prototype, "id", void 0);
7442
7483
  __decorate([
7443
7484
  dataType('')
7444
- ], UI.prototype, "name", undefined);
7485
+ ], UI.prototype, "name", void 0);
7445
7486
  __decorate([
7446
7487
  dataType('')
7447
- ], UI.prototype, "className", undefined);
7488
+ ], UI.prototype, "className", void 0);
7448
7489
  __decorate([
7449
7490
  surfaceType('pass-through')
7450
- ], UI.prototype, "blendMode", undefined);
7491
+ ], UI.prototype, "blendMode", void 0);
7451
7492
  __decorate([
7452
7493
  opacityType(1)
7453
- ], UI.prototype, "opacity", undefined);
7494
+ ], UI.prototype, "opacity", void 0);
7454
7495
  __decorate([
7455
7496
  visibleType(true)
7456
- ], UI.prototype, "visible", undefined);
7497
+ ], UI.prototype, "visible", void 0);
7457
7498
  __decorate([
7458
7499
  surfaceType(false)
7459
- ], UI.prototype, "locked", undefined);
7500
+ ], UI.prototype, "locked", void 0);
7460
7501
  __decorate([
7461
7502
  sortType(0)
7462
- ], UI.prototype, "zIndex", undefined);
7503
+ ], UI.prototype, "zIndex", void 0);
7463
7504
  __decorate([
7464
7505
  maskType(false)
7465
- ], UI.prototype, "mask", undefined);
7506
+ ], UI.prototype, "mask", void 0);
7466
7507
  __decorate([
7467
7508
  eraserType(false)
7468
- ], UI.prototype, "eraser", undefined);
7509
+ ], UI.prototype, "eraser", void 0);
7469
7510
  __decorate([
7470
7511
  positionType(0, true)
7471
- ], UI.prototype, "x", undefined);
7512
+ ], UI.prototype, "x", void 0);
7472
7513
  __decorate([
7473
7514
  positionType(0, true)
7474
- ], UI.prototype, "y", undefined);
7515
+ ], UI.prototype, "y", void 0);
7475
7516
  __decorate([
7476
7517
  boundsType(100, true)
7477
- ], UI.prototype, "width", undefined);
7518
+ ], UI.prototype, "width", void 0);
7478
7519
  __decorate([
7479
7520
  boundsType(100, true)
7480
- ], UI.prototype, "height", undefined);
7521
+ ], UI.prototype, "height", void 0);
7481
7522
  __decorate([
7482
7523
  scaleType(1, true)
7483
- ], UI.prototype, "scaleX", undefined);
7524
+ ], UI.prototype, "scaleX", void 0);
7484
7525
  __decorate([
7485
7526
  scaleType(1, true)
7486
- ], UI.prototype, "scaleY", undefined);
7527
+ ], UI.prototype, "scaleY", void 0);
7487
7528
  __decorate([
7488
7529
  rotationType(0, true)
7489
- ], UI.prototype, "rotation", undefined);
7530
+ ], UI.prototype, "rotation", void 0);
7490
7531
  __decorate([
7491
7532
  rotationType(0, true)
7492
- ], UI.prototype, "skewX", undefined);
7533
+ ], UI.prototype, "skewX", void 0);
7493
7534
  __decorate([
7494
7535
  rotationType(0, true)
7495
- ], UI.prototype, "skewY", undefined);
7536
+ ], UI.prototype, "skewY", void 0);
7496
7537
  __decorate([
7497
7538
  positionType(0, true)
7498
- ], UI.prototype, "offsetX", undefined);
7539
+ ], UI.prototype, "offsetX", void 0);
7499
7540
  __decorate([
7500
7541
  positionType(0, true)
7501
- ], UI.prototype, "offsetY", undefined);
7542
+ ], UI.prototype, "offsetY", void 0);
7502
7543
  __decorate([
7503
7544
  positionType(0, true)
7504
- ], UI.prototype, "scrollX", undefined);
7545
+ ], UI.prototype, "scrollX", void 0);
7505
7546
  __decorate([
7506
7547
  positionType(0, true)
7507
- ], UI.prototype, "scrollY", undefined);
7548
+ ], UI.prototype, "scrollY", void 0);
7508
7549
  __decorate([
7509
7550
  autoLayoutType()
7510
- ], UI.prototype, "origin", undefined);
7551
+ ], UI.prototype, "origin", void 0);
7511
7552
  __decorate([
7512
7553
  autoLayoutType()
7513
- ], UI.prototype, "around", undefined);
7554
+ ], UI.prototype, "around", void 0);
7514
7555
  __decorate([
7515
7556
  dataType(false)
7516
- ], UI.prototype, "lazy", undefined);
7557
+ ], UI.prototype, "lazy", void 0);
7517
7558
  __decorate([
7518
7559
  naturalBoundsType(1)
7519
- ], UI.prototype, "pixelRatio", undefined);
7560
+ ], UI.prototype, "pixelRatio", void 0);
7520
7561
  __decorate([
7521
7562
  pathInputType()
7522
- ], UI.prototype, "path", undefined);
7563
+ ], UI.prototype, "path", void 0);
7523
7564
  __decorate([
7524
7565
  pathType()
7525
- ], UI.prototype, "windingRule", undefined);
7566
+ ], UI.prototype, "windingRule", void 0);
7526
7567
  __decorate([
7527
7568
  pathType(true)
7528
- ], UI.prototype, "closed", undefined);
7569
+ ], UI.prototype, "closed", void 0);
7529
7570
  __decorate([
7530
7571
  boundsType(0)
7531
- ], UI.prototype, "padding", undefined);
7572
+ ], UI.prototype, "padding", void 0);
7532
7573
  __decorate([
7533
7574
  boundsType(false)
7534
- ], UI.prototype, "lockRatio", undefined);
7575
+ ], UI.prototype, "lockRatio", void 0);
7535
7576
  __decorate([
7536
7577
  boundsType()
7537
- ], UI.prototype, "widthRange", undefined);
7578
+ ], UI.prototype, "widthRange", void 0);
7538
7579
  __decorate([
7539
7580
  boundsType()
7540
- ], UI.prototype, "heightRange", undefined);
7581
+ ], UI.prototype, "heightRange", void 0);
7541
7582
  __decorate([
7542
7583
  dataType(false)
7543
- ], UI.prototype, "draggable", undefined);
7584
+ ], UI.prototype, "draggable", void 0);
7544
7585
  __decorate([
7545
7586
  dataType()
7546
- ], UI.prototype, "dragBounds", undefined);
7587
+ ], UI.prototype, "dragBounds", void 0);
7547
7588
  __decorate([
7548
7589
  dataType(false)
7549
- ], UI.prototype, "editable", undefined);
7590
+ ], UI.prototype, "editable", void 0);
7550
7591
  __decorate([
7551
7592
  hitType(true)
7552
- ], UI.prototype, "hittable", undefined);
7593
+ ], UI.prototype, "hittable", void 0);
7553
7594
  __decorate([
7554
7595
  hitType('path')
7555
- ], UI.prototype, "hitFill", undefined);
7596
+ ], UI.prototype, "hitFill", void 0);
7556
7597
  __decorate([
7557
7598
  strokeType('path')
7558
- ], UI.prototype, "hitStroke", undefined);
7599
+ ], UI.prototype, "hitStroke", void 0);
7559
7600
  __decorate([
7560
7601
  hitType(false)
7561
- ], UI.prototype, "hitBox", undefined);
7602
+ ], UI.prototype, "hitBox", void 0);
7562
7603
  __decorate([
7563
7604
  hitType(true)
7564
- ], UI.prototype, "hitChildren", undefined);
7605
+ ], UI.prototype, "hitChildren", void 0);
7565
7606
  __decorate([
7566
7607
  hitType(true)
7567
- ], UI.prototype, "hitSelf", undefined);
7608
+ ], UI.prototype, "hitSelf", void 0);
7568
7609
  __decorate([
7569
7610
  hitType()
7570
- ], UI.prototype, "hitRadius", undefined);
7611
+ ], UI.prototype, "hitRadius", void 0);
7571
7612
  __decorate([
7572
7613
  cursorType('')
7573
- ], UI.prototype, "cursor", undefined);
7614
+ ], UI.prototype, "cursor", void 0);
7574
7615
  __decorate([
7575
7616
  surfaceType()
7576
- ], UI.prototype, "fill", undefined);
7617
+ ], UI.prototype, "fill", void 0);
7577
7618
  __decorate([
7578
7619
  strokeType()
7579
- ], UI.prototype, "stroke", undefined);
7620
+ ], UI.prototype, "stroke", void 0);
7580
7621
  __decorate([
7581
7622
  strokeType('inside')
7582
- ], UI.prototype, "strokeAlign", undefined);
7623
+ ], UI.prototype, "strokeAlign", void 0);
7583
7624
  __decorate([
7584
7625
  strokeType(1)
7585
- ], UI.prototype, "strokeWidth", undefined);
7626
+ ], UI.prototype, "strokeWidth", void 0);
7586
7627
  __decorate([
7587
7628
  strokeType(false)
7588
- ], UI.prototype, "strokeWidthFixed", undefined);
7629
+ ], UI.prototype, "strokeWidthFixed", void 0);
7589
7630
  __decorate([
7590
7631
  strokeType('none')
7591
- ], UI.prototype, "strokeCap", undefined);
7632
+ ], UI.prototype, "strokeCap", void 0);
7592
7633
  __decorate([
7593
7634
  strokeType('miter')
7594
- ], UI.prototype, "strokeJoin", undefined);
7635
+ ], UI.prototype, "strokeJoin", void 0);
7595
7636
  __decorate([
7596
7637
  strokeType()
7597
- ], UI.prototype, "dashPattern", undefined);
7638
+ ], UI.prototype, "dashPattern", void 0);
7598
7639
  __decorate([
7599
7640
  strokeType()
7600
- ], UI.prototype, "dashOffset", undefined);
7641
+ ], UI.prototype, "dashOffset", void 0);
7601
7642
  __decorate([
7602
7643
  strokeType(10)
7603
- ], UI.prototype, "miterLimit", undefined);
7644
+ ], UI.prototype, "miterLimit", void 0);
7604
7645
  __decorate([
7605
7646
  pathType(0)
7606
- ], UI.prototype, "cornerRadius", undefined);
7647
+ ], UI.prototype, "cornerRadius", void 0);
7607
7648
  __decorate([
7608
7649
  pathType()
7609
- ], UI.prototype, "cornerSmoothing", undefined);
7650
+ ], UI.prototype, "cornerSmoothing", void 0);
7610
7651
  __decorate([
7611
7652
  effectType()
7612
- ], UI.prototype, "shadow", undefined);
7653
+ ], UI.prototype, "shadow", void 0);
7613
7654
  __decorate([
7614
7655
  effectType()
7615
- ], UI.prototype, "innerShadow", undefined);
7656
+ ], UI.prototype, "innerShadow", void 0);
7616
7657
  __decorate([
7617
7658
  effectType()
7618
- ], UI.prototype, "blur", undefined);
7659
+ ], UI.prototype, "blur", void 0);
7619
7660
  __decorate([
7620
7661
  effectType()
7621
- ], UI.prototype, "backgroundBlur", undefined);
7662
+ ], UI.prototype, "backgroundBlur", void 0);
7622
7663
  __decorate([
7623
7664
  effectType()
7624
- ], UI.prototype, "grayscale", undefined);
7665
+ ], UI.prototype, "grayscale", void 0);
7666
+ __decorate([
7667
+ effectType()
7668
+ ], UI.prototype, "filter", void 0);
7625
7669
  __decorate([
7626
7670
  dataType({})
7627
- ], UI.prototype, "data", undefined);
7671
+ ], UI.prototype, "data", void 0);
7628
7672
  __decorate([
7629
7673
  rewrite(Leaf.prototype.reset)
7630
7674
  ], UI.prototype, "reset", null);
@@ -7685,7 +7729,7 @@ let Group = class Group extends UI {
7685
7729
  };
7686
7730
  __decorate([
7687
7731
  dataProcessor(GroupData)
7688
- ], Group.prototype, "__", undefined);
7732
+ ], Group.prototype, "__", void 0);
7689
7733
  Group = __decorate([
7690
7734
  useModule(Branch),
7691
7735
  registerUI()
@@ -7698,7 +7742,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7698
7742
  get isApp() { return false; }
7699
7743
  get app() { return this.parent || this; }
7700
7744
  get isLeafer() { return true; }
7701
- get imageReady() { return this.viewReady && ImageManager.isComplete; }
7745
+ get imageReady() { return this.viewReady && Resource.isComplete; }
7702
7746
  get layoutLocked() { return !this.layouter.running; }
7703
7747
  get FPS() { return this.renderer ? this.renderer.FPS : 60; }
7704
7748
  get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
@@ -7909,13 +7953,13 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7909
7953
  WaitHelper.run(this.__viewReadyWait);
7910
7954
  }
7911
7955
  __onLayoutEnd() {
7912
- const { grow, growWidth, growHeight } = this.config;
7956
+ const { grow, width: fixedWidth, height: fixedHeight } = this.config;
7913
7957
  if (grow) {
7914
7958
  let { width, height, pixelRatio } = this;
7915
7959
  const bounds = grow === 'box' ? this.worldBoxBounds : this.__world;
7916
- if (growWidth !== false)
7960
+ if (!fixedWidth)
7917
7961
  width = Math.max(1, bounds.x + bounds.width);
7918
- if (growHeight !== false)
7962
+ if (!fixedHeight)
7919
7963
  height = Math.max(1, bounds.y + bounds.height);
7920
7964
  this.__doResize({ width, height, pixelRatio });
7921
7965
  }
@@ -7993,7 +8037,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7993
8037
  list.push(item);
7994
8038
  this.requestRender();
7995
8039
  }
7996
- zoom(_zoomType, _padding, _fixedScale) {
8040
+ zoom(_zoomType, _padding, _fixedScale, _transition) {
7997
8041
  return Plugin.need('view');
7998
8042
  }
7999
8043
  getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
@@ -8058,10 +8102,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8058
8102
  Leafer.list = new LeafList();
8059
8103
  __decorate([
8060
8104
  dataProcessor(LeaferData)
8061
- ], Leafer.prototype, "__", undefined);
8105
+ ], Leafer.prototype, "__", void 0);
8062
8106
  __decorate([
8063
8107
  boundsType()
8064
- ], Leafer.prototype, "pixelRatio", undefined);
8108
+ ], Leafer.prototype, "pixelRatio", void 0);
8065
8109
  Leafer = Leafer_1 = __decorate([
8066
8110
  registerUI()
8067
8111
  ], Leafer);
@@ -8074,7 +8118,7 @@ let Rect = class Rect extends UI {
8074
8118
  };
8075
8119
  __decorate([
8076
8120
  dataProcessor(RectData)
8077
- ], Rect.prototype, "__", undefined);
8121
+ ], Rect.prototype, "__", void 0);
8078
8122
  Rect = __decorate([
8079
8123
  useModule(RectRender),
8080
8124
  rewriteAble(),
@@ -8165,13 +8209,13 @@ let Box = class Box extends Group {
8165
8209
  };
8166
8210
  __decorate([
8167
8211
  dataProcessor(BoxData)
8168
- ], Box.prototype, "__", undefined);
8212
+ ], Box.prototype, "__", void 0);
8169
8213
  __decorate([
8170
8214
  dataType(false)
8171
- ], Box.prototype, "resizeChildren", undefined);
8215
+ ], Box.prototype, "resizeChildren", void 0);
8172
8216
  __decorate([
8173
8217
  affectRenderBoundsType('show')
8174
- ], Box.prototype, "overflow", undefined);
8218
+ ], Box.prototype, "overflow", void 0);
8175
8219
  __decorate([
8176
8220
  rewrite(rect$1.__updateStrokeSpread)
8177
8221
  ], Box.prototype, "__updateStrokeSpread", null);
@@ -8210,13 +8254,13 @@ let Frame = class Frame extends Box {
8210
8254
  };
8211
8255
  __decorate([
8212
8256
  dataProcessor(FrameData)
8213
- ], Frame.prototype, "__", undefined);
8257
+ ], Frame.prototype, "__", void 0);
8214
8258
  __decorate([
8215
8259
  surfaceType('#FFFFFF')
8216
- ], Frame.prototype, "fill", undefined);
8260
+ ], Frame.prototype, "fill", void 0);
8217
8261
  __decorate([
8218
8262
  affectRenderBoundsType('hide')
8219
- ], Frame.prototype, "overflow", undefined);
8263
+ ], Frame.prototype, "overflow", void 0);
8220
8264
  Frame = __decorate([
8221
8265
  registerUI()
8222
8266
  ], Frame);
@@ -8263,16 +8307,16 @@ let Ellipse = class Ellipse extends UI {
8263
8307
  };
8264
8308
  __decorate([
8265
8309
  dataProcessor(EllipseData)
8266
- ], Ellipse.prototype, "__", undefined);
8310
+ ], Ellipse.prototype, "__", void 0);
8267
8311
  __decorate([
8268
8312
  pathType(0)
8269
- ], Ellipse.prototype, "innerRadius", undefined);
8313
+ ], Ellipse.prototype, "innerRadius", void 0);
8270
8314
  __decorate([
8271
8315
  pathType(0)
8272
- ], Ellipse.prototype, "startAngle", undefined);
8316
+ ], Ellipse.prototype, "startAngle", void 0);
8273
8317
  __decorate([
8274
8318
  pathType(0)
8275
- ], Ellipse.prototype, "endAngle", undefined);
8319
+ ], Ellipse.prototype, "endAngle", void 0);
8276
8320
  Ellipse = __decorate([
8277
8321
  registerUI()
8278
8322
  ], Ellipse);
@@ -8331,22 +8375,22 @@ let Line = class Line extends UI {
8331
8375
  };
8332
8376
  __decorate([
8333
8377
  dataProcessor(LineData)
8334
- ], Line.prototype, "__", undefined);
8378
+ ], Line.prototype, "__", void 0);
8335
8379
  __decorate([
8336
8380
  affectStrokeBoundsType('center')
8337
- ], Line.prototype, "strokeAlign", undefined);
8381
+ ], Line.prototype, "strokeAlign", void 0);
8338
8382
  __decorate([
8339
8383
  boundsType(0)
8340
- ], Line.prototype, "height", undefined);
8384
+ ], Line.prototype, "height", void 0);
8341
8385
  __decorate([
8342
8386
  pathType()
8343
- ], Line.prototype, "points", undefined);
8387
+ ], Line.prototype, "points", void 0);
8344
8388
  __decorate([
8345
8389
  pathType(0)
8346
- ], Line.prototype, "curve", undefined);
8390
+ ], Line.prototype, "curve", void 0);
8347
8391
  __decorate([
8348
8392
  pathType(false)
8349
- ], Line.prototype, "closed", undefined);
8393
+ ], Line.prototype, "closed", void 0);
8350
8394
  Line = __decorate([
8351
8395
  registerUI()
8352
8396
  ], Line);
@@ -8379,16 +8423,16 @@ let Polygon = class Polygon extends UI {
8379
8423
  };
8380
8424
  __decorate([
8381
8425
  dataProcessor(PolygonData)
8382
- ], Polygon.prototype, "__", undefined);
8426
+ ], Polygon.prototype, "__", void 0);
8383
8427
  __decorate([
8384
8428
  pathType(3)
8385
- ], Polygon.prototype, "sides", undefined);
8429
+ ], Polygon.prototype, "sides", void 0);
8386
8430
  __decorate([
8387
8431
  pathType()
8388
- ], Polygon.prototype, "points", undefined);
8432
+ ], Polygon.prototype, "points", void 0);
8389
8433
  __decorate([
8390
8434
  pathType(0)
8391
- ], Polygon.prototype, "curve", undefined);
8435
+ ], Polygon.prototype, "curve", void 0);
8392
8436
  __decorate([
8393
8437
  rewrite(line.__updateRenderPath)
8394
8438
  ], Polygon.prototype, "__updateRenderPath", null);
@@ -8420,13 +8464,13 @@ let Star = class Star extends UI {
8420
8464
  };
8421
8465
  __decorate([
8422
8466
  dataProcessor(StarData)
8423
- ], Star.prototype, "__", undefined);
8467
+ ], Star.prototype, "__", void 0);
8424
8468
  __decorate([
8425
8469
  pathType(5)
8426
- ], Star.prototype, "corners", undefined);
8470
+ ], Star.prototype, "corners", void 0);
8427
8471
  __decorate([
8428
8472
  pathType(0.382)
8429
- ], Star.prototype, "innerRadius", undefined);
8473
+ ], Star.prototype, "innerRadius", void 0);
8430
8474
  Star = __decorate([
8431
8475
  registerUI()
8432
8476
  ], Star);
@@ -8448,10 +8492,10 @@ let Image = class Image extends Rect {
8448
8492
  };
8449
8493
  __decorate([
8450
8494
  dataProcessor(ImageData)
8451
- ], Image.prototype, "__", undefined);
8495
+ ], Image.prototype, "__", void 0);
8452
8496
  __decorate([
8453
8497
  boundsType('')
8454
- ], Image.prototype, "url", undefined);
8498
+ ], Image.prototype, "url", void 0);
8455
8499
  Image = __decorate([
8456
8500
  registerUI()
8457
8501
  ], Image);
@@ -8514,25 +8558,25 @@ let Canvas = class Canvas extends Rect {
8514
8558
  };
8515
8559
  __decorate([
8516
8560
  dataProcessor(CanvasData)
8517
- ], Canvas.prototype, "__", undefined);
8561
+ ], Canvas.prototype, "__", void 0);
8518
8562
  __decorate([
8519
8563
  resizeType(100)
8520
- ], Canvas.prototype, "width", undefined);
8564
+ ], Canvas.prototype, "width", void 0);
8521
8565
  __decorate([
8522
8566
  resizeType(100)
8523
- ], Canvas.prototype, "height", undefined);
8567
+ ], Canvas.prototype, "height", void 0);
8524
8568
  __decorate([
8525
8569
  resizeType(1)
8526
- ], Canvas.prototype, "pixelRatio", undefined);
8570
+ ], Canvas.prototype, "pixelRatio", void 0);
8527
8571
  __decorate([
8528
8572
  resizeType(true)
8529
- ], Canvas.prototype, "smooth", undefined);
8573
+ ], Canvas.prototype, "smooth", void 0);
8530
8574
  __decorate([
8531
8575
  dataType(false)
8532
- ], Canvas.prototype, "safeResize", undefined);
8576
+ ], Canvas.prototype, "safeResize", void 0);
8533
8577
  __decorate([
8534
8578
  resizeType()
8535
- ], Canvas.prototype, "contextSettings", undefined);
8579
+ ], Canvas.prototype, "contextSettings", void 0);
8536
8580
  Canvas = __decorate([
8537
8581
  registerUI()
8538
8582
  ], Canvas);
@@ -8623,76 +8667,76 @@ let Text = class Text extends UI {
8623
8667
  };
8624
8668
  __decorate([
8625
8669
  dataProcessor(TextData)
8626
- ], Text.prototype, "__", undefined);
8670
+ ], Text.prototype, "__", void 0);
8627
8671
  __decorate([
8628
8672
  boundsType(0)
8629
- ], Text.prototype, "width", undefined);
8673
+ ], Text.prototype, "width", void 0);
8630
8674
  __decorate([
8631
8675
  boundsType(0)
8632
- ], Text.prototype, "height", undefined);
8676
+ ], Text.prototype, "height", void 0);
8633
8677
  __decorate([
8634
8678
  dataType(false)
8635
- ], Text.prototype, "resizeFontSize", undefined);
8679
+ ], Text.prototype, "resizeFontSize", void 0);
8636
8680
  __decorate([
8637
8681
  surfaceType('#000000')
8638
- ], Text.prototype, "fill", undefined);
8682
+ ], Text.prototype, "fill", void 0);
8639
8683
  __decorate([
8640
8684
  affectStrokeBoundsType('outside')
8641
- ], Text.prototype, "strokeAlign", undefined);
8685
+ ], Text.prototype, "strokeAlign", void 0);
8642
8686
  __decorate([
8643
8687
  hitType('all')
8644
- ], Text.prototype, "hitFill", undefined);
8688
+ ], Text.prototype, "hitFill", void 0);
8645
8689
  __decorate([
8646
8690
  boundsType('')
8647
- ], Text.prototype, "text", undefined);
8691
+ ], Text.prototype, "text", void 0);
8648
8692
  __decorate([
8649
8693
  boundsType('caption')
8650
- ], Text.prototype, "fontFamily", undefined);
8694
+ ], Text.prototype, "fontFamily", void 0);
8651
8695
  __decorate([
8652
8696
  boundsType(12)
8653
- ], Text.prototype, "fontSize", undefined);
8697
+ ], Text.prototype, "fontSize", void 0);
8654
8698
  __decorate([
8655
8699
  boundsType('normal')
8656
- ], Text.prototype, "fontWeight", undefined);
8700
+ ], Text.prototype, "fontWeight", void 0);
8657
8701
  __decorate([
8658
8702
  boundsType(false)
8659
- ], Text.prototype, "italic", undefined);
8703
+ ], Text.prototype, "italic", void 0);
8660
8704
  __decorate([
8661
8705
  boundsType('none')
8662
- ], Text.prototype, "textCase", undefined);
8706
+ ], Text.prototype, "textCase", void 0);
8663
8707
  __decorate([
8664
8708
  boundsType('none')
8665
- ], Text.prototype, "textDecoration", undefined);
8709
+ ], Text.prototype, "textDecoration", void 0);
8666
8710
  __decorate([
8667
8711
  boundsType(0)
8668
- ], Text.prototype, "letterSpacing", undefined);
8712
+ ], Text.prototype, "letterSpacing", void 0);
8669
8713
  __decorate([
8670
8714
  boundsType({ type: 'percent', value: 1.5 })
8671
- ], Text.prototype, "lineHeight", undefined);
8715
+ ], Text.prototype, "lineHeight", void 0);
8672
8716
  __decorate([
8673
8717
  boundsType(0)
8674
- ], Text.prototype, "paraIndent", undefined);
8718
+ ], Text.prototype, "paraIndent", void 0);
8675
8719
  __decorate([
8676
8720
  boundsType(0)
8677
- ], Text.prototype, "paraSpacing", undefined);
8721
+ ], Text.prototype, "paraSpacing", void 0);
8678
8722
  __decorate([
8679
8723
  boundsType('x')
8680
- ], Text.prototype, "writingMode", undefined);
8724
+ ], Text.prototype, "writingMode", void 0);
8681
8725
  __decorate([
8682
8726
  boundsType('left')
8683
- ], Text.prototype, "textAlign", undefined);
8727
+ ], Text.prototype, "textAlign", void 0);
8684
8728
  __decorate([
8685
8729
  boundsType('top')
8686
- ], Text.prototype, "verticalAlign", undefined);
8730
+ ], Text.prototype, "verticalAlign", void 0);
8687
8731
  __decorate([
8688
8732
  boundsType(true)
8689
- ], Text.prototype, "autoSizeAlign", undefined);
8733
+ ], Text.prototype, "autoSizeAlign", void 0);
8690
8734
  __decorate([
8691
8735
  boundsType('normal')
8692
- ], Text.prototype, "textWrap", undefined);
8736
+ ], Text.prototype, "textWrap", void 0);
8693
8737
  __decorate([
8694
8738
  boundsType('show')
8695
- ], Text.prototype, "textOverflow", undefined);
8739
+ ], Text.prototype, "textOverflow", void 0);
8696
8740
  Text = __decorate([
8697
8741
  registerUI()
8698
8742
  ], Text);
@@ -8705,10 +8749,10 @@ let Path = class Path extends UI {
8705
8749
  };
8706
8750
  __decorate([
8707
8751
  dataProcessor(PathData)
8708
- ], Path.prototype, "__", undefined);
8752
+ ], Path.prototype, "__", void 0);
8709
8753
  __decorate([
8710
8754
  affectStrokeBoundsType('center')
8711
- ], Path.prototype, "strokeAlign", undefined);
8755
+ ], Path.prototype, "strokeAlign", void 0);
8712
8756
  Path = __decorate([
8713
8757
  registerUI()
8714
8758
  ], Path);
@@ -8747,10 +8791,10 @@ let Pen = class Pen extends Group {
8747
8791
  };
8748
8792
  __decorate([
8749
8793
  dataProcessor(PenData)
8750
- ], Pen.prototype, "__", undefined);
8794
+ ], Pen.prototype, "__", void 0);
8751
8795
  __decorate([
8752
8796
  penPathType()
8753
- ], Pen.prototype, "path", undefined);
8797
+ ], Pen.prototype, "path", void 0);
8754
8798
  Pen = __decorate([
8755
8799
  useModule(PathCreator, ['set', 'path', 'paint']),
8756
8800
  registerUI()
@@ -8986,7 +9030,7 @@ let DragEvent = class DragEvent extends PointerEvent {
8986
9030
  const { draggable, dragBounds } = leaf, move = leaf.getLocalPoint(total, null, true);
8987
9031
  PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
8988
9032
  if (dragBounds)
8989
- this.getMoveInDragBounds(leaf.__local, dragBounds === 'parent' ? leaf.parent.boxBounds : dragBounds, move, true);
9033
+ this.getMoveInDragBounds(leaf.__localBoxBounds, dragBounds === 'parent' ? leaf.parent.boxBounds : dragBounds, move, true);
8990
9034
  if (draggable === 'x')
8991
9035
  move.y = 0;
8992
9036
  if (draggable === 'y')
@@ -9689,7 +9733,9 @@ class InteractionBase {
9689
9733
  }
9690
9734
  findPath(data, options) {
9691
9735
  const { hitRadius, through } = this.p;
9692
- const { bottomList } = this;
9736
+ const { bottomList, target } = this;
9737
+ if (!Platform.backgrounder && !data.origin)
9738
+ target && target.updateLayout();
9693
9739
  const find = this.selector.getByPoint(data, hitRadius, Object.assign({ bottomList, name: data.type }, (options || { through })));
9694
9740
  if (find.throughPath)
9695
9741
  data.throughPath = find.throughPath;
@@ -9934,9 +9980,9 @@ leaf$1.__hitWorld = function (point) {
9934
9980
  }
9935
9981
  return this.__hit(inner);
9936
9982
  };
9937
- leaf$1.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === undefined ? undefined : _a.hitFill(inner, this.__.windingRule); };
9938
- leaf$1.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === undefined ? undefined : _a.hitStroke(inner, strokeWidth); };
9939
- leaf$1.__hitPixel = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === undefined ? undefined : _a.hitPixel(inner, this.__layout.renderBounds, this.__hitCanvas.hitScale); };
9983
+ leaf$1.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitFill(inner, this.__.windingRule); };
9984
+ leaf$1.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitStroke(inner, strokeWidth); };
9985
+ leaf$1.__hitPixel = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitPixel(inner, this.__layout.renderBounds, this.__hitCanvas.hitScale); };
9940
9986
  leaf$1.__drawHitPath = function (canvas) { if (canvas)
9941
9987
  this.__drawRenderPath(canvas); };
9942
9988
 
@@ -10024,8 +10070,8 @@ function getSelector$1(ui) {
10024
10070
  return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
10025
10071
  }
10026
10072
  Group.prototype.pick = function (hitPoint, options) {
10027
- this.leafer || this.updateLayout();
10028
10073
  options || (options = emptyData);
10074
+ this.updateLayout();
10029
10075
  return getSelector$1(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
10030
10076
  };
10031
10077
 
@@ -10409,7 +10455,7 @@ function getPatternData(paint, box, image) {
10409
10455
  box = tempBox.set(box).shrink(paint.padding);
10410
10456
  if (paint.mode === 'strench')
10411
10457
  paint.mode = 'stretch';
10412
- const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
10458
+ const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
10413
10459
  const sameBox = box.width === width && box.height === height;
10414
10460
  const data = { mode };
10415
10461
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -10472,6 +10518,8 @@ function getPatternData(paint, box, image) {
10472
10518
  data.height = height;
10473
10519
  if (opacity)
10474
10520
  data.opacity = opacity;
10521
+ if (filters)
10522
+ data.filters = filters;
10475
10523
  if (repeat)
10476
10524
  data.repeat = typeof repeat === 'string' ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat';
10477
10525
  return data;
@@ -10574,7 +10622,7 @@ function createPattern(ui, paint, pixelRatio) {
10574
10622
  scaleX = abs$3(scaleX);
10575
10623
  scaleY = abs$3(scaleY);
10576
10624
  const { image, data } = paint;
10577
- let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform, repeat } = data;
10625
+ let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
10578
10626
  if (sx) {
10579
10627
  imageMatrix = get$1();
10580
10628
  copy$4(imageMatrix, transform);
@@ -10617,7 +10665,7 @@ function createPattern(ui, paint, pixelRatio) {
10617
10665
  }
10618
10666
  scale$2(imageMatrix, 1 / scaleX, 1 / scaleY);
10619
10667
  }
10620
- const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, opacity);
10668
+ const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, data.opacity, data.filters);
10621
10669
  const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || 'no-repeat'), imageMatrix, paint);
10622
10670
  paint.style = pattern;
10623
10671
  paint.patternId = id;
@@ -10661,7 +10709,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
10661
10709
  canvas.opacity *= data.opacity;
10662
10710
  if (data.transform)
10663
10711
  canvas.transform(data.transform);
10664
- canvas.drawImage(paint.image.view, 0, 0, data.width, data.height);
10712
+ canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height);
10665
10713
  canvas.restore();
10666
10714
  return true;
10667
10715
  }
@@ -10671,7 +10719,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
10671
10719
  }
10672
10720
  else {
10673
10721
  if (!paint.patternTask) {
10674
- paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, undefined, undefined, function* () {
10722
+ paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
10675
10723
  paint.patternTask = null;
10676
10724
  if (canvas.bounds.hit(ui.__nowWorld))
10677
10725
  createPattern(ui, paint, pixelRatio);
@@ -11672,7 +11720,7 @@ class Stroker extends UI {
11672
11720
  }
11673
11721
  __decorate([
11674
11722
  targetAttr(onTarget$1)
11675
- ], Stroker.prototype, "target", undefined);
11723
+ ], Stroker.prototype, "target", void 0);
11676
11724
  function onTarget$1(stroker) {
11677
11725
  const value = stroker.target;
11678
11726
  stroker.list = value ? (value instanceof Array ? value : [value]) : [];
@@ -11951,7 +11999,7 @@ const { within } = MathHelper;
11951
11999
  const EditDataHelper = {
11952
12000
  getScaleData(element, startBounds, direction, totalMove, lockRatio, around, flipable, scaleMode) {
11953
12001
  let align, origin = {}, scaleX = 1, scaleY = 1;
11954
- const { boxBounds, widthRange, heightRange } = element;
12002
+ const { boxBounds, widthRange, heightRange, dragBounds } = element;
11955
12003
  const { width, height } = startBounds;
11956
12004
  if (around) {
11957
12005
  totalMove.x *= 2;
@@ -12039,6 +12087,17 @@ const EditDataHelper = {
12039
12087
  if (scaleY < 0)
12040
12088
  scaleY = 1 / boxBounds.height / worldTransform.scaleY;
12041
12089
  }
12090
+ toPoint(around || align, boxBounds, origin, true);
12091
+ if (dragBounds) {
12092
+ const allowBounds = dragBounds === 'parent' ? element.parent.boxBounds : dragBounds;
12093
+ const localBounds = new Bounds(element.__localBoxBounds);
12094
+ localBounds.scaleOf(element.getLocalPointByInner(origin), scaleX, scaleY);
12095
+ if (!BoundsHelper.includes(allowBounds, localBounds)) {
12096
+ const realBounds = localBounds.getIntersect(allowBounds);
12097
+ scaleX *= realBounds.width / localBounds.width;
12098
+ scaleY *= realBounds.height / localBounds.height;
12099
+ }
12100
+ }
12042
12101
  if (widthRange) {
12043
12102
  const nowWidth = boxBounds.width * element.scaleX;
12044
12103
  scaleX = within(nowWidth * scaleX, widthRange) / nowWidth;
@@ -12047,7 +12106,6 @@ const EditDataHelper = {
12047
12106
  const nowHeight = boxBounds.height * element.scaleY;
12048
12107
  scaleY = within(nowHeight * scaleY, heightRange) / nowHeight;
12049
12108
  }
12050
- toPoint(around || align, boxBounds, origin, true);
12051
12109
  return { origin, scaleX, scaleY, direction, lockRatio, around };
12052
12110
  },
12053
12111
  getRotateData(bounds, direction, current, last, around) {
@@ -12951,9 +13009,9 @@ class Editor extends Group {
12951
13009
  this.skewOf(origin, skewX, skewY);
12952
13010
  }
12953
13011
  move(x, y = 0) {
13012
+ const { element } = this;
12954
13013
  if (!this.checkTransform('moveable'))
12955
13014
  return;
12956
- const { element } = this;
12957
13015
  const world = element.getWorldPointByLocal(typeof x === 'object' ? Object.assign({}, x) : { x, y }, null, true);
12958
13016
  if (this.multiple)
12959
13017
  element.safeChange(() => element.move(x, y));
@@ -13161,10 +13219,10 @@ class Editor extends Group {
13161
13219
  }
13162
13220
  __decorate([
13163
13221
  targetAttr(onHover)
13164
- ], Editor.prototype, "hoverTarget", undefined);
13222
+ ], Editor.prototype, "hoverTarget", void 0);
13165
13223
  __decorate([
13166
13224
  targetAttr(onTarget)
13167
- ], Editor.prototype, "target", undefined);
13225
+ ], Editor.prototype, "target", void 0);
13168
13226
 
13169
13227
  class InnerEditor {
13170
13228
  static registerInnerEditor() {
@@ -14018,7 +14076,8 @@ function getFixBounds(bounds, scaleBounds) {
14018
14076
  }
14019
14077
 
14020
14078
  Plugin.add('view');
14021
- Leafer.prototype.zoom = function (zoomType, padding, fixed) {
14079
+ Leafer.prototype.zoom = function (zoomType, padding, fixed, transition) {
14080
+ this.killAnimate();
14022
14081
  const { zoomLayer } = this;
14023
14082
  const limitBounds = this.canvas.bounds.clone().shrink(padding !== undefined ? padding : 30), bounds = new Bounds();
14024
14083
  const center = { x: limitBounds.x + limitBounds.width / 2, y: limitBounds.y + limitBounds.height / 2 };
@@ -14049,10 +14108,12 @@ Leafer.prototype.zoom = function (zoomType, padding, fixed) {
14049
14108
  changeScale = zoomType / scaleX;
14050
14109
  }
14051
14110
  if (changeScale) {
14052
- if (changeScale !== 1)
14053
- zoomLayer.scaleOfWorld(center, this.getValidScale(changeScale));
14111
+ changeScale = this.getValidScale(changeScale);
14112
+ zoomLayer.scaleOfWorld(center, changeScale, changeScale, false, transition);
14054
14113
  }
14055
14114
  else if (typeof zoomType === 'object') {
14115
+ const { x, y, scaleX, scaleY } = zoomLayer;
14116
+ const data = { x, y, scaleX, scaleY };
14056
14117
  const isArray = zoomType instanceof Array;
14057
14118
  if (isArray || zoomType.tag) {
14058
14119
  const list = isArray ? zoomType : [zoomType];
@@ -14062,21 +14123,25 @@ Leafer.prototype.zoom = function (zoomType, padding, fixed) {
14062
14123
  const innerBounds = getFixBounds(zoomType, limitBounds);
14063
14124
  bounds.set(zoomLayer.getWorldBounds(innerBounds));
14064
14125
  }
14065
- const { x, y, width, height } = bounds;
14066
- let moveX = limitBounds.x - x, moveY = limitBounds.y - y;
14126
+ const { width, height } = bounds;
14127
+ let moveX = limitBounds.x - bounds.x, moveY = limitBounds.y - bounds.y;
14067
14128
  if (fixed) {
14068
14129
  moveX += Math.max((limitBounds.width - width) / 2, 0);
14069
14130
  moveY += Math.max((limitBounds.height - height) / 2, 0);
14070
14131
  }
14071
14132
  else {
14072
- const fitScale = this.getValidScale(Math.min(limitBounds.width / width, limitBounds.height / height));
14073
- moveX += (limitBounds.width - width * fitScale) / 2;
14074
- moveY += (limitBounds.height - height * fitScale) / 2;
14075
- zoomLayer.scaleOfWorld(bounds, fitScale);
14076
- bounds.scaleOf(bounds, fitScale);
14077
- }
14078
- zoomLayer.move(moveX, moveY);
14079
- return bounds.move(moveX, moveY);
14133
+ changeScale = this.getValidScale(Math.min(limitBounds.width / width, limitBounds.height / height));
14134
+ moveX += (limitBounds.width - width * changeScale) / 2;
14135
+ moveY += (limitBounds.height - height * changeScale) / 2;
14136
+ PointHelper.scaleOf(data, bounds, changeScale);
14137
+ bounds.scaleOf(bounds, changeScale);
14138
+ data.scaleX *= changeScale;
14139
+ data.scaleY *= changeScale;
14140
+ }
14141
+ PointHelper.move(data, moveX, moveY);
14142
+ bounds.move(moveX, moveY);
14143
+ zoomLayer.set(data, transition);
14144
+ return bounds;
14080
14145
  }
14081
14146
  return zoomLayer.worldBoxBounds;
14082
14147
  };
@@ -14204,10 +14269,10 @@ let Arrow = class Arrow extends Line {
14204
14269
  };
14205
14270
  __decorate([
14206
14271
  dataProcessor(ArrowData)
14207
- ], Arrow.prototype, "__", undefined);
14272
+ ], Arrow.prototype, "__", void 0);
14208
14273
  __decorate([
14209
14274
  strokeType('angle')
14210
- ], Arrow.prototype, "endArrow", undefined);
14275
+ ], Arrow.prototype, "endArrow", void 0);
14211
14276
  Arrow = __decorate([
14212
14277
  registerUI()
14213
14278
  ], Arrow);
@@ -14646,7 +14711,7 @@ const ExportModule = {
14646
14711
  const { leafer } = leaf;
14647
14712
  if (leafer) {
14648
14713
  checkLazy(leaf);
14649
- leafer.waitViewCompleted(() => __awaiter(this, undefined, undefined, function* () {
14714
+ leafer.waitViewCompleted(() => __awaiter(this, void 0, void 0, function* () {
14650
14715
  let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
14651
14716
  const { worldTransform, isLeafer, isFrame } = leaf;
14652
14717
  const { slice, trim, padding, onCanvas } = options;
@@ -14748,7 +14813,7 @@ function addTask(task) {
14748
14813
  if (!tasker)
14749
14814
  tasker = new TaskProcessor();
14750
14815
  return new Promise((resolve) => {
14751
- tasker.add(() => __awaiter(this, undefined, undefined, function* () { return yield task(resolve); }), { parallel: false });
14816
+ tasker.add(() => __awaiter(this, void 0, void 0, function* () { return yield task(resolve); }), { parallel: false });
14752
14817
  });
14753
14818
  }
14754
14819
  function checkLazy(leaf) {
@@ -15053,15 +15118,15 @@ let HTMLText = class HTMLText extends Image {
15053
15118
  };
15054
15119
  __decorate([
15055
15120
  dataProcessor(HTMLTextData)
15056
- ], HTMLText.prototype, "__", undefined);
15121
+ ], HTMLText.prototype, "__", void 0);
15057
15122
  __decorate([
15058
15123
  boundsType('')
15059
- ], HTMLText.prototype, "text", undefined);
15124
+ ], HTMLText.prototype, "text", void 0);
15060
15125
  HTMLText = __decorate([
15061
15126
  registerUI()
15062
15127
  ], HTMLText);
15063
15128
 
15064
15129
  Plugin.add('html');
15065
15130
 
15066
- export { AlignHelper, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Finder, Frame, FrameData, Group, GroupData, HTMLText, HTMLTextData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, ScrollBar, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TextEditor, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isNull, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
15131
+ export { AlignHelper, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Frame, FrameData, Group, GroupData, HTMLText, HTMLTextData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, ScrollBar, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TextEditor, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isNull, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
15067
15132
  //# sourceMappingURL=worker.module.js.map