@leafer-draw/worker 1.4.0 → 1.4.2

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$4 = Debug;
1376
1376
 
1377
- const debug$d = Debug.get('RunTime');
1377
+ const debug$e = 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$d.log(name, duration, 'ms');
1394
+ R$1.idMap[id] = R$1.nameMap[id] = R$1.nameToIdMap[name] = undefined;
1395
+ debug$e.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$c = Debug.get('UICreator');
1424
+ const debug$d = 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$1[tag])
1430
- debug$c.repeat(tag);
1430
+ debug$d.repeat(tag);
1431
1431
  list$1[tag] = UI;
1432
1432
  },
1433
1433
  get(tag, data, x, y, width, height) {
1434
1434
  if (!list$1[tag])
1435
- debug$c.error('not register ' + tag);
1435
+ debug$d.error('not register ' + tag);
1436
1436
  const ui = new list$1[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$1 } = UICreator;
1450
1450
 
1451
- const debug$b = Debug.get('EventCreator');
1451
+ const debug$c = 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$b.repeat(name), nameList[name] = Event;
1459
+ nameList[name] && debug$c.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$4, m, L: L$5, l, H, h, V, v, C: C$4, c, S, s, Q: Q$3, q, T, t, A, a, Z: Z$4, z, N: N$3, D: D$3, X: X$3, G: G$3, F: F$4, O: O$3, P: P$3, U: U$3 } = PathCommandMap;
2613
2613
  const { rect: rect$2, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
2614
2614
  const { ellipticalArc } = EllipseHelper;
2615
- const debug$a = Debug.get('PathConvert');
2615
+ const debug$b = 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$a.error(`command: ${command} [index:${i}]`, old);
2856
+ debug$b.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$2, x1, y1, x2, y2, min(radius, abs$2(maxRadius)));
2967
- }
2968
- else {
2969
- data.push(U$2, 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$2(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
2970
2967
  }
2968
+ data.push(U$2, 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$2, L: L$3, C: C$2, Q: Q$1, Z: Z$2, N: N$1, D: D$1, X: X$1, G: G$1, F: F$2, O: O$1, P: P$1, U: U$1 } = PathCommandMap;
3081
- const debug$9 = Debug.get('PathDrawer');
3079
+ const debug$a = 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$9.error(`command: ${command} [index:${i}]`, data);
3142
+ debug$a.error(`command: ${command} [index:${i}]`, data);
3145
3143
  return;
3146
3144
  }
3147
3145
  }
@@ -3151,7 +3149,7 @@ const PathDrawer = {
3151
3149
  const { M: M$1, L: L$2, C: C$1, Q, Z: Z$1, N, D, X, G, F: F$1, O, P, U } = PathCommandMap;
3152
3150
  const { toTwoPointBounds, toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc, ellipse: ellipse$1 } = BezierHelper;
3153
3151
  const { addPointBounds, copy: copy$7, addPoint, setPoint, addBounds, toBounds: toBounds$2 } = TwoPointBoundsHelper;
3154
- const debug$8 = Debug.get('PathBounds');
3152
+ const debug$9 = 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$8.error(`command: ${command} [index:${i}]`, data);
3260
+ debug$9.error(`command: ${command} [index:${i}]`, data);
3263
3261
  return;
3264
3262
  }
3265
3263
  }
@@ -3375,7 +3373,7 @@ const FileHelper = {
3375
3373
  const F = FileHelper;
3376
3374
  F.opacityTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
3377
3375
 
3378
- const debug$7 = Debug.get('TaskProcessor');
3376
+ const debug$8 = 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$7.error(error);
3391
+ debug$8.error(error);
3394
3392
  }
3395
3393
  });
3396
3394
  }
@@ -3623,18 +3621,58 @@ class TaskProcessor {
3623
3621
  }
3624
3622
  }
3625
3623
 
3626
- const ImageManager = {
3624
+ const debug$7 = 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$7.repeat(key);
3632
+ R.map[key] = value;
3633
+ },
3634
+ get(key) {
3635
+ return R.map[key];
3636
+ },
3637
+ remove(key) {
3638
+ const r = R.map[key];
3639
+ if (r) {
3640
+ if (r.destroy)
3641
+ r.destroy();
3642
+ delete R.map[key];
3643
+ }
3644
+ },
3645
+ loadImage(key, format) {
3646
+ return new Promise((resolve, reject) => {
3647
+ const image = this.setImage(key, key, format);
3648
+ image.load(() => resolve(image), (e) => reject(e));
3649
+ });
3650
+ },
3651
+ setImage(key, value, format) {
3652
+ let config;
3653
+ if (typeof value === 'string')
3654
+ config = { url: value };
3655
+ else if (!value.url)
3656
+ config = { url: key, view: value };
3657
+ if (config)
3658
+ format && (config.format = format), value = Creator.image(config);
3659
+ R.set(key, value);
3660
+ return value;
3661
+ },
3662
+ destroy() {
3663
+ R.map = {};
3664
+ }
3665
+ };
3666
+ const R = Resource;
3667
+
3668
+ const ImageManager = {
3669
+ maxRecycled: 100,
3628
3670
  recycledList: [],
3629
- tasker: new TaskProcessor(),
3630
3671
  patternTasker: new TaskProcessor(),
3631
- get isComplete() { return I.tasker.isComplete; },
3632
3672
  get(config) {
3633
- let image = I.map[config.url];
3634
- if (!image) {
3635
- image = Creator.image(config);
3636
- I.map[config.url] = image;
3637
- }
3673
+ let image = Resource.get(config.url);
3674
+ if (!image)
3675
+ Resource.set(config.url, image = Creator.image(config));
3638
3676
  image.use++;
3639
3677
  return image;
3640
3678
  },
@@ -3645,13 +3683,8 @@ const ImageManager = {
3645
3683
  },
3646
3684
  clearRecycled() {
3647
3685
  const list = I.recycledList;
3648
- if (list.length > 100) {
3649
- list.forEach(image => {
3650
- if (!image.use && image.url) {
3651
- delete I.map[image.url];
3652
- image.destroy();
3653
- }
3654
- });
3686
+ if (list.length > I.maxRecycled) {
3687
+ list.forEach(image => (!image.use && image.url) && Resource.remove(image.url));
3655
3688
  list.length = 0;
3656
3689
  }
3657
3690
  },
@@ -3675,7 +3708,6 @@ const ImageManager = {
3675
3708
  return false;
3676
3709
  },
3677
3710
  destroy() {
3678
- I.map = {};
3679
3711
  I.recycledList = [];
3680
3712
  }
3681
3713
  };
@@ -3689,21 +3721,19 @@ class LeaferImage {
3689
3721
  this.use = 0;
3690
3722
  this.waitComplete = [];
3691
3723
  this.innerId = create$1(IMAGE);
3692
- this.config = config || { url: '' };
3693
- this.isSVG = ImageManager.isFormat('svg', config);
3694
- this.hasOpacityPixel = ImageManager.hasOpacityPixel(config);
3724
+ this.config = config || (config = { url: '' });
3725
+ if (config.view) {
3726
+ const { view } = config;
3727
+ this.setView(view.config ? view.view : view);
3728
+ }
3729
+ ImageManager.isFormat('svg', config) && (this.isSVG = true);
3730
+ ImageManager.hasOpacityPixel(config) && (this.hasOpacityPixel = true);
3695
3731
  }
3696
3732
  load(onSuccess, onError) {
3697
3733
  if (!this.loading) {
3698
3734
  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) => {
3735
+ Resource.tasker.add(() => __awaiter(this, void 0, void 0, function* () {
3736
+ return yield Platform.origin.loadImage(this.url).then(img => this.setView(img)).catch((e) => {
3707
3737
  this.error = e;
3708
3738
  this.onComplete(false);
3709
3739
  });
@@ -3721,6 +3751,13 @@ class LeaferImage {
3721
3751
  }
3722
3752
  l[index] = l[index + 1] = undefined;
3723
3753
  }
3754
+ setView(img) {
3755
+ this.ready = true;
3756
+ this.width = img.naturalWidth || img.width;
3757
+ this.height = img.naturalHeight || img.height;
3758
+ this.view = img;
3759
+ this.onComplete(true);
3760
+ }
3724
3761
  onComplete(isSuccess) {
3725
3762
  let odd;
3726
3763
  this.waitComplete.forEach((item, index) => {
@@ -3739,6 +3776,9 @@ class LeaferImage {
3739
3776
  this.waitComplete.length = 0;
3740
3777
  this.loading = false;
3741
3778
  }
3779
+ getFull(_filters) {
3780
+ return this.view;
3781
+ }
3742
3782
  getCanvas(width, height, opacity, _filters) {
3743
3783
  width || (width = this.width);
3744
3784
  height || (height = this.height);
@@ -5219,7 +5259,7 @@ const LeafRender = {
5219
5259
  if (this.__.eraser === 'path')
5220
5260
  return this.__renderEraser(canvas, options);
5221
5261
  const tempCanvas = canvas.getSameCanvas(true, true);
5222
- this.__draw(tempCanvas, options);
5262
+ this.__draw(tempCanvas, options, canvas);
5223
5263
  if (this.__worldFlipped) {
5224
5264
  canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, this.__.__blendMode, true);
5225
5265
  }
@@ -6012,7 +6052,7 @@ class LeafLevelList {
6012
6052
  }
6013
6053
  }
6014
6054
 
6015
- const version = "1.4.0";
6055
+ const version = "1.4.2";
6016
6056
 
6017
6057
  class LeaferCanvas extends LeaferCanvasBase {
6018
6058
  get allowBackgroundColor() { return true; }
@@ -6357,7 +6397,7 @@ class Layouter {
6357
6397
  }
6358
6398
  partLayout() {
6359
6399
  var _a;
6360
- if (!((_a = this.__updatedList) === null || _a === undefined ? undefined : _a.length))
6400
+ if (!((_a = this.__updatedList) === null || _a === void 0 ? void 0 : _a.length))
6361
6401
  return;
6362
6402
  const t = Run.start('PartLayout');
6363
6403
  const { target, __updatedList: updateList } = this;
@@ -6726,9 +6766,7 @@ const TextConvert = {};
6726
6766
  const ColorConvert = {};
6727
6767
  const UnitConvert = {
6728
6768
  number(value, percentRefer) {
6729
- if (typeof value === 'object')
6730
- return value.type === 'percent' ? value.value * percentRefer : value.value;
6731
- return value;
6769
+ return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
6732
6770
  }
6733
6771
  };
6734
6772
  const PathArrow = {};
@@ -6736,16 +6774,15 @@ const Paint = {};
6736
6774
  const PaintImage = {};
6737
6775
  const PaintGradient = {};
6738
6776
  const Effect = {};
6777
+ const Filter = {
6778
+ apply() { Plugin.need('filter'); }
6779
+ };
6739
6780
  const Export = {};
6740
6781
  const State = {
6741
- setStyleName(_leaf, _styleName, _value) { return Plugin.need('state'); },
6742
- set(_leaf, _stateName) { return Plugin.need('state'); }
6743
- };
6744
- const Transition = {
6745
- list: {},
6746
- register(attrName, fn) { Transition.list[attrName] = fn; },
6747
- get(attrName) { return Transition.list[attrName]; }
6782
+ setStyleName() { return Plugin.need('state'); },
6783
+ set() { return Plugin.need('state'); }
6748
6784
  };
6785
+ const Transition = {};
6749
6786
 
6750
6787
  const { parse, objectToCanvasData } = PathConvert;
6751
6788
  const emptyPaint = {};
@@ -6852,24 +6889,13 @@ class UIData extends LeafData {
6852
6889
  }
6853
6890
  }
6854
6891
  setShadow(value) {
6855
- this.__setInput('shadow', value);
6856
- if (value instanceof Array) {
6857
- if (value.some((item) => item.visible === false))
6858
- value = value.filter((item) => item.visible !== false);
6859
- this._shadow = value.length ? value : null;
6860
- }
6861
- else
6862
- this._shadow = value && value.visible !== false ? [value] : null;
6892
+ setArray(this, 'shadow', value);
6863
6893
  }
6864
6894
  setInnerShadow(value) {
6865
- this.__setInput('innerShadow', value);
6866
- if (value instanceof Array) {
6867
- if (value.some((item) => item.visible === false))
6868
- value = value.filter((item) => item.visible !== false);
6869
- this._innerShadow = value.length ? value : null;
6870
- }
6871
- else
6872
- this._innerShadow = value && value.visible !== false ? [value] : null;
6895
+ setArray(this, 'innerShadow', value);
6896
+ }
6897
+ setFilter(value) {
6898
+ setArray(this, 'filter', value);
6873
6899
  }
6874
6900
  __computePaint() {
6875
6901
  const { fill, stroke } = this.__input;
@@ -6880,6 +6906,17 @@ class UIData extends LeafData {
6880
6906
  this.__needComputePaint = false;
6881
6907
  }
6882
6908
  }
6909
+ function setArray(data, key, value) {
6910
+ data.__setInput(key, value);
6911
+ if (value instanceof Array) {
6912
+ if (value.some((item) => item.visible === false))
6913
+ value = value.filter((item) => item.visible !== false);
6914
+ value.length || (value = null);
6915
+ }
6916
+ else
6917
+ value = value && value.visible !== false ? [value] : null;
6918
+ data['_' + key] = value;
6919
+ }
6883
6920
 
6884
6921
  class GroupData extends UIData {
6885
6922
  }
@@ -7002,11 +7039,13 @@ const UIBounds = {
7002
7039
  },
7003
7040
  __updateRenderSpread() {
7004
7041
  let width = 0;
7005
- const { shadow, innerShadow, blur, backgroundBlur } = this.__;
7042
+ const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
7006
7043
  if (shadow)
7007
7044
  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));
7008
7045
  if (blur)
7009
7046
  width = Math.max(width, blur);
7047
+ if (filter)
7048
+ width += Filter.getSpread(filter);
7010
7049
  let shapeWidth = width = Math.ceil(width);
7011
7050
  if (innerShadow)
7012
7051
  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));
@@ -7021,8 +7060,8 @@ const UIRender = {
7021
7060
  __updateChange() {
7022
7061
  const data = this.__;
7023
7062
  if (data.__useEffect) {
7024
- const { shadow, innerShadow, blur, backgroundBlur } = this.__;
7025
- data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur);
7063
+ const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
7064
+ data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur || filter);
7026
7065
  }
7027
7066
  data.__checkSingle();
7028
7067
  const complex = data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect;
@@ -7036,7 +7075,7 @@ const UIRender = {
7036
7075
  __drawFast(canvas, options) {
7037
7076
  drawFast(this, canvas, options);
7038
7077
  },
7039
- __draw(canvas, options) {
7078
+ __draw(canvas, options, originCanvas) {
7040
7079
  const data = this.__;
7041
7080
  if (data.__complex) {
7042
7081
  if (data.__needComputePaint)
@@ -7046,7 +7085,7 @@ const UIRender = {
7046
7085
  if (data.__useEffect) {
7047
7086
  const shape = Paint.shape(this, canvas, options);
7048
7087
  this.__nowWorld = this.__getNowWorld(options);
7049
- const { shadow, innerShadow } = data;
7088
+ const { shadow, innerShadow, filter } = data;
7050
7089
  if (shadow)
7051
7090
  Effect.shadow(this, canvas, shape);
7052
7091
  if (fill)
@@ -7057,6 +7096,8 @@ const UIRender = {
7057
7096
  Effect.innerShadow(this, canvas, shape);
7058
7097
  if (stroke)
7059
7098
  data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
7099
+ if (filter)
7100
+ Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
7060
7101
  if (shape.worldCanvas)
7061
7102
  shape.worldCanvas.recycle();
7062
7103
  shape.canvas.recycle();
@@ -7276,199 +7317,202 @@ let UI = UI_1 = class UI extends Leaf {
7276
7317
  };
7277
7318
  __decorate([
7278
7319
  dataProcessor(UIData)
7279
- ], UI.prototype, "__", undefined);
7320
+ ], UI.prototype, "__", void 0);
7280
7321
  __decorate([
7281
7322
  zoomLayerType()
7282
- ], UI.prototype, "zoomLayer", undefined);
7323
+ ], UI.prototype, "zoomLayer", void 0);
7283
7324
  __decorate([
7284
7325
  dataType('')
7285
- ], UI.prototype, "id", undefined);
7326
+ ], UI.prototype, "id", void 0);
7286
7327
  __decorate([
7287
7328
  dataType('')
7288
- ], UI.prototype, "name", undefined);
7329
+ ], UI.prototype, "name", void 0);
7289
7330
  __decorate([
7290
7331
  dataType('')
7291
- ], UI.prototype, "className", undefined);
7332
+ ], UI.prototype, "className", void 0);
7292
7333
  __decorate([
7293
7334
  surfaceType('pass-through')
7294
- ], UI.prototype, "blendMode", undefined);
7335
+ ], UI.prototype, "blendMode", void 0);
7295
7336
  __decorate([
7296
7337
  opacityType(1)
7297
- ], UI.prototype, "opacity", undefined);
7338
+ ], UI.prototype, "opacity", void 0);
7298
7339
  __decorate([
7299
7340
  visibleType(true)
7300
- ], UI.prototype, "visible", undefined);
7341
+ ], UI.prototype, "visible", void 0);
7301
7342
  __decorate([
7302
7343
  surfaceType(false)
7303
- ], UI.prototype, "locked", undefined);
7344
+ ], UI.prototype, "locked", void 0);
7304
7345
  __decorate([
7305
7346
  sortType(0)
7306
- ], UI.prototype, "zIndex", undefined);
7347
+ ], UI.prototype, "zIndex", void 0);
7307
7348
  __decorate([
7308
7349
  maskType(false)
7309
- ], UI.prototype, "mask", undefined);
7350
+ ], UI.prototype, "mask", void 0);
7310
7351
  __decorate([
7311
7352
  eraserType(false)
7312
- ], UI.prototype, "eraser", undefined);
7353
+ ], UI.prototype, "eraser", void 0);
7313
7354
  __decorate([
7314
7355
  positionType(0, true)
7315
- ], UI.prototype, "x", undefined);
7356
+ ], UI.prototype, "x", void 0);
7316
7357
  __decorate([
7317
7358
  positionType(0, true)
7318
- ], UI.prototype, "y", undefined);
7359
+ ], UI.prototype, "y", void 0);
7319
7360
  __decorate([
7320
7361
  boundsType(100, true)
7321
- ], UI.prototype, "width", undefined);
7362
+ ], UI.prototype, "width", void 0);
7322
7363
  __decorate([
7323
7364
  boundsType(100, true)
7324
- ], UI.prototype, "height", undefined);
7365
+ ], UI.prototype, "height", void 0);
7325
7366
  __decorate([
7326
7367
  scaleType(1, true)
7327
- ], UI.prototype, "scaleX", undefined);
7368
+ ], UI.prototype, "scaleX", void 0);
7328
7369
  __decorate([
7329
7370
  scaleType(1, true)
7330
- ], UI.prototype, "scaleY", undefined);
7371
+ ], UI.prototype, "scaleY", void 0);
7331
7372
  __decorate([
7332
7373
  rotationType(0, true)
7333
- ], UI.prototype, "rotation", undefined);
7374
+ ], UI.prototype, "rotation", void 0);
7334
7375
  __decorate([
7335
7376
  rotationType(0, true)
7336
- ], UI.prototype, "skewX", undefined);
7377
+ ], UI.prototype, "skewX", void 0);
7337
7378
  __decorate([
7338
7379
  rotationType(0, true)
7339
- ], UI.prototype, "skewY", undefined);
7380
+ ], UI.prototype, "skewY", void 0);
7340
7381
  __decorate([
7341
7382
  positionType(0, true)
7342
- ], UI.prototype, "offsetX", undefined);
7383
+ ], UI.prototype, "offsetX", void 0);
7343
7384
  __decorate([
7344
7385
  positionType(0, true)
7345
- ], UI.prototype, "offsetY", undefined);
7386
+ ], UI.prototype, "offsetY", void 0);
7346
7387
  __decorate([
7347
7388
  positionType(0, true)
7348
- ], UI.prototype, "scrollX", undefined);
7389
+ ], UI.prototype, "scrollX", void 0);
7349
7390
  __decorate([
7350
7391
  positionType(0, true)
7351
- ], UI.prototype, "scrollY", undefined);
7392
+ ], UI.prototype, "scrollY", void 0);
7352
7393
  __decorate([
7353
7394
  autoLayoutType()
7354
- ], UI.prototype, "origin", undefined);
7395
+ ], UI.prototype, "origin", void 0);
7355
7396
  __decorate([
7356
7397
  autoLayoutType()
7357
- ], UI.prototype, "around", undefined);
7398
+ ], UI.prototype, "around", void 0);
7358
7399
  __decorate([
7359
7400
  dataType(false)
7360
- ], UI.prototype, "lazy", undefined);
7401
+ ], UI.prototype, "lazy", void 0);
7361
7402
  __decorate([
7362
7403
  naturalBoundsType(1)
7363
- ], UI.prototype, "pixelRatio", undefined);
7404
+ ], UI.prototype, "pixelRatio", void 0);
7364
7405
  __decorate([
7365
7406
  pathInputType()
7366
- ], UI.prototype, "path", undefined);
7407
+ ], UI.prototype, "path", void 0);
7367
7408
  __decorate([
7368
7409
  pathType()
7369
- ], UI.prototype, "windingRule", undefined);
7410
+ ], UI.prototype, "windingRule", void 0);
7370
7411
  __decorate([
7371
7412
  pathType(true)
7372
- ], UI.prototype, "closed", undefined);
7413
+ ], UI.prototype, "closed", void 0);
7373
7414
  __decorate([
7374
7415
  boundsType(0)
7375
- ], UI.prototype, "padding", undefined);
7416
+ ], UI.prototype, "padding", void 0);
7376
7417
  __decorate([
7377
7418
  boundsType(false)
7378
- ], UI.prototype, "lockRatio", undefined);
7419
+ ], UI.prototype, "lockRatio", void 0);
7379
7420
  __decorate([
7380
7421
  boundsType()
7381
- ], UI.prototype, "widthRange", undefined);
7422
+ ], UI.prototype, "widthRange", void 0);
7382
7423
  __decorate([
7383
7424
  boundsType()
7384
- ], UI.prototype, "heightRange", undefined);
7425
+ ], UI.prototype, "heightRange", void 0);
7385
7426
  __decorate([
7386
7427
  dataType(false)
7387
- ], UI.prototype, "draggable", undefined);
7428
+ ], UI.prototype, "draggable", void 0);
7388
7429
  __decorate([
7389
7430
  dataType()
7390
- ], UI.prototype, "dragBounds", undefined);
7431
+ ], UI.prototype, "dragBounds", void 0);
7391
7432
  __decorate([
7392
7433
  dataType(false)
7393
- ], UI.prototype, "editable", undefined);
7434
+ ], UI.prototype, "editable", void 0);
7394
7435
  __decorate([
7395
7436
  hitType(true)
7396
- ], UI.prototype, "hittable", undefined);
7437
+ ], UI.prototype, "hittable", void 0);
7397
7438
  __decorate([
7398
7439
  hitType('path')
7399
- ], UI.prototype, "hitFill", undefined);
7440
+ ], UI.prototype, "hitFill", void 0);
7400
7441
  __decorate([
7401
7442
  strokeType('path')
7402
- ], UI.prototype, "hitStroke", undefined);
7443
+ ], UI.prototype, "hitStroke", void 0);
7403
7444
  __decorate([
7404
7445
  hitType(false)
7405
- ], UI.prototype, "hitBox", undefined);
7446
+ ], UI.prototype, "hitBox", void 0);
7406
7447
  __decorate([
7407
7448
  hitType(true)
7408
- ], UI.prototype, "hitChildren", undefined);
7449
+ ], UI.prototype, "hitChildren", void 0);
7409
7450
  __decorate([
7410
7451
  hitType(true)
7411
- ], UI.prototype, "hitSelf", undefined);
7452
+ ], UI.prototype, "hitSelf", void 0);
7412
7453
  __decorate([
7413
7454
  hitType()
7414
- ], UI.prototype, "hitRadius", undefined);
7455
+ ], UI.prototype, "hitRadius", void 0);
7415
7456
  __decorate([
7416
7457
  cursorType('')
7417
- ], UI.prototype, "cursor", undefined);
7458
+ ], UI.prototype, "cursor", void 0);
7418
7459
  __decorate([
7419
7460
  surfaceType()
7420
- ], UI.prototype, "fill", undefined);
7461
+ ], UI.prototype, "fill", void 0);
7421
7462
  __decorate([
7422
7463
  strokeType()
7423
- ], UI.prototype, "stroke", undefined);
7464
+ ], UI.prototype, "stroke", void 0);
7424
7465
  __decorate([
7425
7466
  strokeType('inside')
7426
- ], UI.prototype, "strokeAlign", undefined);
7467
+ ], UI.prototype, "strokeAlign", void 0);
7427
7468
  __decorate([
7428
7469
  strokeType(1)
7429
- ], UI.prototype, "strokeWidth", undefined);
7470
+ ], UI.prototype, "strokeWidth", void 0);
7430
7471
  __decorate([
7431
7472
  strokeType(false)
7432
- ], UI.prototype, "strokeWidthFixed", undefined);
7473
+ ], UI.prototype, "strokeWidthFixed", void 0);
7433
7474
  __decorate([
7434
7475
  strokeType('none')
7435
- ], UI.prototype, "strokeCap", undefined);
7476
+ ], UI.prototype, "strokeCap", void 0);
7436
7477
  __decorate([
7437
7478
  strokeType('miter')
7438
- ], UI.prototype, "strokeJoin", undefined);
7479
+ ], UI.prototype, "strokeJoin", void 0);
7439
7480
  __decorate([
7440
7481
  strokeType()
7441
- ], UI.prototype, "dashPattern", undefined);
7482
+ ], UI.prototype, "dashPattern", void 0);
7442
7483
  __decorate([
7443
7484
  strokeType()
7444
- ], UI.prototype, "dashOffset", undefined);
7485
+ ], UI.prototype, "dashOffset", void 0);
7445
7486
  __decorate([
7446
7487
  strokeType(10)
7447
- ], UI.prototype, "miterLimit", undefined);
7488
+ ], UI.prototype, "miterLimit", void 0);
7448
7489
  __decorate([
7449
7490
  pathType(0)
7450
- ], UI.prototype, "cornerRadius", undefined);
7491
+ ], UI.prototype, "cornerRadius", void 0);
7451
7492
  __decorate([
7452
7493
  pathType()
7453
- ], UI.prototype, "cornerSmoothing", undefined);
7494
+ ], UI.prototype, "cornerSmoothing", void 0);
7495
+ __decorate([
7496
+ effectType()
7497
+ ], UI.prototype, "shadow", void 0);
7454
7498
  __decorate([
7455
7499
  effectType()
7456
- ], UI.prototype, "shadow", undefined);
7500
+ ], UI.prototype, "innerShadow", void 0);
7457
7501
  __decorate([
7458
7502
  effectType()
7459
- ], UI.prototype, "innerShadow", undefined);
7503
+ ], UI.prototype, "blur", void 0);
7460
7504
  __decorate([
7461
7505
  effectType()
7462
- ], UI.prototype, "blur", undefined);
7506
+ ], UI.prototype, "backgroundBlur", void 0);
7463
7507
  __decorate([
7464
7508
  effectType()
7465
- ], UI.prototype, "backgroundBlur", undefined);
7509
+ ], UI.prototype, "grayscale", void 0);
7466
7510
  __decorate([
7467
7511
  effectType()
7468
- ], UI.prototype, "grayscale", undefined);
7512
+ ], UI.prototype, "filter", void 0);
7469
7513
  __decorate([
7470
7514
  dataType({})
7471
- ], UI.prototype, "data", undefined);
7515
+ ], UI.prototype, "data", void 0);
7472
7516
  __decorate([
7473
7517
  rewrite(Leaf.prototype.reset)
7474
7518
  ], UI.prototype, "reset", null);
@@ -7529,7 +7573,7 @@ let Group = class Group extends UI {
7529
7573
  };
7530
7574
  __decorate([
7531
7575
  dataProcessor(GroupData)
7532
- ], Group.prototype, "__", undefined);
7576
+ ], Group.prototype, "__", void 0);
7533
7577
  Group = __decorate([
7534
7578
  useModule(Branch),
7535
7579
  registerUI()
@@ -7542,7 +7586,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7542
7586
  get isApp() { return false; }
7543
7587
  get app() { return this.parent || this; }
7544
7588
  get isLeafer() { return true; }
7545
- get imageReady() { return this.viewReady && ImageManager.isComplete; }
7589
+ get imageReady() { return this.viewReady && Resource.isComplete; }
7546
7590
  get layoutLocked() { return !this.layouter.running; }
7547
7591
  get FPS() { return this.renderer ? this.renderer.FPS : 60; }
7548
7592
  get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
@@ -7753,13 +7797,13 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7753
7797
  WaitHelper.run(this.__viewReadyWait);
7754
7798
  }
7755
7799
  __onLayoutEnd() {
7756
- const { grow, growWidth, growHeight } = this.config;
7800
+ const { grow, width: fixedWidth, height: fixedHeight } = this.config;
7757
7801
  if (grow) {
7758
7802
  let { width, height, pixelRatio } = this;
7759
7803
  const bounds = grow === 'box' ? this.worldBoxBounds : this.__world;
7760
- if (growWidth !== false)
7804
+ if (!fixedWidth)
7761
7805
  width = Math.max(1, bounds.x + bounds.width);
7762
- if (growHeight !== false)
7806
+ if (!fixedHeight)
7763
7807
  height = Math.max(1, bounds.y + bounds.height);
7764
7808
  this.__doResize({ width, height, pixelRatio });
7765
7809
  }
@@ -7837,7 +7881,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7837
7881
  list.push(item);
7838
7882
  this.requestRender();
7839
7883
  }
7840
- zoom(_zoomType, _padding, _fixedScale) {
7884
+ zoom(_zoomType, _padding, _fixedScale, _transition) {
7841
7885
  return Plugin.need('view');
7842
7886
  }
7843
7887
  getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
@@ -7902,10 +7946,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7902
7946
  Leafer.list = new LeafList();
7903
7947
  __decorate([
7904
7948
  dataProcessor(LeaferData)
7905
- ], Leafer.prototype, "__", undefined);
7949
+ ], Leafer.prototype, "__", void 0);
7906
7950
  __decorate([
7907
7951
  boundsType()
7908
- ], Leafer.prototype, "pixelRatio", undefined);
7952
+ ], Leafer.prototype, "pixelRatio", void 0);
7909
7953
  Leafer = Leafer_1 = __decorate([
7910
7954
  registerUI()
7911
7955
  ], Leafer);
@@ -7918,7 +7962,7 @@ let Rect = class Rect extends UI {
7918
7962
  };
7919
7963
  __decorate([
7920
7964
  dataProcessor(RectData)
7921
- ], Rect.prototype, "__", undefined);
7965
+ ], Rect.prototype, "__", void 0);
7922
7966
  Rect = __decorate([
7923
7967
  useModule(RectRender),
7924
7968
  rewriteAble(),
@@ -8009,13 +8053,13 @@ let Box = class Box extends Group {
8009
8053
  };
8010
8054
  __decorate([
8011
8055
  dataProcessor(BoxData)
8012
- ], Box.prototype, "__", undefined);
8056
+ ], Box.prototype, "__", void 0);
8013
8057
  __decorate([
8014
8058
  dataType(false)
8015
- ], Box.prototype, "resizeChildren", undefined);
8059
+ ], Box.prototype, "resizeChildren", void 0);
8016
8060
  __decorate([
8017
8061
  affectRenderBoundsType('show')
8018
- ], Box.prototype, "overflow", undefined);
8062
+ ], Box.prototype, "overflow", void 0);
8019
8063
  __decorate([
8020
8064
  rewrite(rect.__updateStrokeSpread)
8021
8065
  ], Box.prototype, "__updateStrokeSpread", null);
@@ -8054,13 +8098,13 @@ let Frame = class Frame extends Box {
8054
8098
  };
8055
8099
  __decorate([
8056
8100
  dataProcessor(FrameData)
8057
- ], Frame.prototype, "__", undefined);
8101
+ ], Frame.prototype, "__", void 0);
8058
8102
  __decorate([
8059
8103
  surfaceType('#FFFFFF')
8060
- ], Frame.prototype, "fill", undefined);
8104
+ ], Frame.prototype, "fill", void 0);
8061
8105
  __decorate([
8062
8106
  affectRenderBoundsType('hide')
8063
- ], Frame.prototype, "overflow", undefined);
8107
+ ], Frame.prototype, "overflow", void 0);
8064
8108
  Frame = __decorate([
8065
8109
  registerUI()
8066
8110
  ], Frame);
@@ -8107,16 +8151,16 @@ let Ellipse = class Ellipse extends UI {
8107
8151
  };
8108
8152
  __decorate([
8109
8153
  dataProcessor(EllipseData)
8110
- ], Ellipse.prototype, "__", undefined);
8154
+ ], Ellipse.prototype, "__", void 0);
8111
8155
  __decorate([
8112
8156
  pathType(0)
8113
- ], Ellipse.prototype, "innerRadius", undefined);
8157
+ ], Ellipse.prototype, "innerRadius", void 0);
8114
8158
  __decorate([
8115
8159
  pathType(0)
8116
- ], Ellipse.prototype, "startAngle", undefined);
8160
+ ], Ellipse.prototype, "startAngle", void 0);
8117
8161
  __decorate([
8118
8162
  pathType(0)
8119
- ], Ellipse.prototype, "endAngle", undefined);
8163
+ ], Ellipse.prototype, "endAngle", void 0);
8120
8164
  Ellipse = __decorate([
8121
8165
  registerUI()
8122
8166
  ], Ellipse);
@@ -8175,22 +8219,22 @@ let Line = class Line extends UI {
8175
8219
  };
8176
8220
  __decorate([
8177
8221
  dataProcessor(LineData)
8178
- ], Line.prototype, "__", undefined);
8222
+ ], Line.prototype, "__", void 0);
8179
8223
  __decorate([
8180
8224
  affectStrokeBoundsType('center')
8181
- ], Line.prototype, "strokeAlign", undefined);
8225
+ ], Line.prototype, "strokeAlign", void 0);
8182
8226
  __decorate([
8183
8227
  boundsType(0)
8184
- ], Line.prototype, "height", undefined);
8228
+ ], Line.prototype, "height", void 0);
8185
8229
  __decorate([
8186
8230
  pathType()
8187
- ], Line.prototype, "points", undefined);
8231
+ ], Line.prototype, "points", void 0);
8188
8232
  __decorate([
8189
8233
  pathType(0)
8190
- ], Line.prototype, "curve", undefined);
8234
+ ], Line.prototype, "curve", void 0);
8191
8235
  __decorate([
8192
8236
  pathType(false)
8193
- ], Line.prototype, "closed", undefined);
8237
+ ], Line.prototype, "closed", void 0);
8194
8238
  Line = __decorate([
8195
8239
  registerUI()
8196
8240
  ], Line);
@@ -8223,16 +8267,16 @@ let Polygon = class Polygon extends UI {
8223
8267
  };
8224
8268
  __decorate([
8225
8269
  dataProcessor(PolygonData)
8226
- ], Polygon.prototype, "__", undefined);
8270
+ ], Polygon.prototype, "__", void 0);
8227
8271
  __decorate([
8228
8272
  pathType(3)
8229
- ], Polygon.prototype, "sides", undefined);
8273
+ ], Polygon.prototype, "sides", void 0);
8230
8274
  __decorate([
8231
8275
  pathType()
8232
- ], Polygon.prototype, "points", undefined);
8276
+ ], Polygon.prototype, "points", void 0);
8233
8277
  __decorate([
8234
8278
  pathType(0)
8235
- ], Polygon.prototype, "curve", undefined);
8279
+ ], Polygon.prototype, "curve", void 0);
8236
8280
  __decorate([
8237
8281
  rewrite(line.__updateRenderPath)
8238
8282
  ], Polygon.prototype, "__updateRenderPath", null);
@@ -8264,13 +8308,13 @@ let Star = class Star extends UI {
8264
8308
  };
8265
8309
  __decorate([
8266
8310
  dataProcessor(StarData)
8267
- ], Star.prototype, "__", undefined);
8311
+ ], Star.prototype, "__", void 0);
8268
8312
  __decorate([
8269
8313
  pathType(5)
8270
- ], Star.prototype, "corners", undefined);
8314
+ ], Star.prototype, "corners", void 0);
8271
8315
  __decorate([
8272
8316
  pathType(0.382)
8273
- ], Star.prototype, "innerRadius", undefined);
8317
+ ], Star.prototype, "innerRadius", void 0);
8274
8318
  Star = __decorate([
8275
8319
  registerUI()
8276
8320
  ], Star);
@@ -8292,10 +8336,10 @@ let Image = class Image extends Rect {
8292
8336
  };
8293
8337
  __decorate([
8294
8338
  dataProcessor(ImageData)
8295
- ], Image.prototype, "__", undefined);
8339
+ ], Image.prototype, "__", void 0);
8296
8340
  __decorate([
8297
8341
  boundsType('')
8298
- ], Image.prototype, "url", undefined);
8342
+ ], Image.prototype, "url", void 0);
8299
8343
  Image = __decorate([
8300
8344
  registerUI()
8301
8345
  ], Image);
@@ -8358,25 +8402,25 @@ let Canvas = class Canvas extends Rect {
8358
8402
  };
8359
8403
  __decorate([
8360
8404
  dataProcessor(CanvasData)
8361
- ], Canvas.prototype, "__", undefined);
8405
+ ], Canvas.prototype, "__", void 0);
8362
8406
  __decorate([
8363
8407
  resizeType(100)
8364
- ], Canvas.prototype, "width", undefined);
8408
+ ], Canvas.prototype, "width", void 0);
8365
8409
  __decorate([
8366
8410
  resizeType(100)
8367
- ], Canvas.prototype, "height", undefined);
8411
+ ], Canvas.prototype, "height", void 0);
8368
8412
  __decorate([
8369
8413
  resizeType(1)
8370
- ], Canvas.prototype, "pixelRatio", undefined);
8414
+ ], Canvas.prototype, "pixelRatio", void 0);
8371
8415
  __decorate([
8372
8416
  resizeType(true)
8373
- ], Canvas.prototype, "smooth", undefined);
8417
+ ], Canvas.prototype, "smooth", void 0);
8374
8418
  __decorate([
8375
8419
  dataType(false)
8376
- ], Canvas.prototype, "safeResize", undefined);
8420
+ ], Canvas.prototype, "safeResize", void 0);
8377
8421
  __decorate([
8378
8422
  resizeType()
8379
- ], Canvas.prototype, "contextSettings", undefined);
8423
+ ], Canvas.prototype, "contextSettings", void 0);
8380
8424
  Canvas = __decorate([
8381
8425
  registerUI()
8382
8426
  ], Canvas);
@@ -8467,76 +8511,76 @@ let Text = class Text extends UI {
8467
8511
  };
8468
8512
  __decorate([
8469
8513
  dataProcessor(TextData)
8470
- ], Text.prototype, "__", undefined);
8514
+ ], Text.prototype, "__", void 0);
8471
8515
  __decorate([
8472
8516
  boundsType(0)
8473
- ], Text.prototype, "width", undefined);
8517
+ ], Text.prototype, "width", void 0);
8474
8518
  __decorate([
8475
8519
  boundsType(0)
8476
- ], Text.prototype, "height", undefined);
8520
+ ], Text.prototype, "height", void 0);
8477
8521
  __decorate([
8478
8522
  dataType(false)
8479
- ], Text.prototype, "resizeFontSize", undefined);
8523
+ ], Text.prototype, "resizeFontSize", void 0);
8480
8524
  __decorate([
8481
8525
  surfaceType('#000000')
8482
- ], Text.prototype, "fill", undefined);
8526
+ ], Text.prototype, "fill", void 0);
8483
8527
  __decorate([
8484
8528
  affectStrokeBoundsType('outside')
8485
- ], Text.prototype, "strokeAlign", undefined);
8529
+ ], Text.prototype, "strokeAlign", void 0);
8486
8530
  __decorate([
8487
8531
  hitType('all')
8488
- ], Text.prototype, "hitFill", undefined);
8532
+ ], Text.prototype, "hitFill", void 0);
8489
8533
  __decorate([
8490
8534
  boundsType('')
8491
- ], Text.prototype, "text", undefined);
8535
+ ], Text.prototype, "text", void 0);
8492
8536
  __decorate([
8493
8537
  boundsType('caption')
8494
- ], Text.prototype, "fontFamily", undefined);
8538
+ ], Text.prototype, "fontFamily", void 0);
8495
8539
  __decorate([
8496
8540
  boundsType(12)
8497
- ], Text.prototype, "fontSize", undefined);
8541
+ ], Text.prototype, "fontSize", void 0);
8498
8542
  __decorate([
8499
8543
  boundsType('normal')
8500
- ], Text.prototype, "fontWeight", undefined);
8544
+ ], Text.prototype, "fontWeight", void 0);
8501
8545
  __decorate([
8502
8546
  boundsType(false)
8503
- ], Text.prototype, "italic", undefined);
8547
+ ], Text.prototype, "italic", void 0);
8504
8548
  __decorate([
8505
8549
  boundsType('none')
8506
- ], Text.prototype, "textCase", undefined);
8550
+ ], Text.prototype, "textCase", void 0);
8507
8551
  __decorate([
8508
8552
  boundsType('none')
8509
- ], Text.prototype, "textDecoration", undefined);
8553
+ ], Text.prototype, "textDecoration", void 0);
8510
8554
  __decorate([
8511
8555
  boundsType(0)
8512
- ], Text.prototype, "letterSpacing", undefined);
8556
+ ], Text.prototype, "letterSpacing", void 0);
8513
8557
  __decorate([
8514
8558
  boundsType({ type: 'percent', value: 1.5 })
8515
- ], Text.prototype, "lineHeight", undefined);
8559
+ ], Text.prototype, "lineHeight", void 0);
8516
8560
  __decorate([
8517
8561
  boundsType(0)
8518
- ], Text.prototype, "paraIndent", undefined);
8562
+ ], Text.prototype, "paraIndent", void 0);
8519
8563
  __decorate([
8520
8564
  boundsType(0)
8521
- ], Text.prototype, "paraSpacing", undefined);
8565
+ ], Text.prototype, "paraSpacing", void 0);
8522
8566
  __decorate([
8523
8567
  boundsType('x')
8524
- ], Text.prototype, "writingMode", undefined);
8568
+ ], Text.prototype, "writingMode", void 0);
8525
8569
  __decorate([
8526
8570
  boundsType('left')
8527
- ], Text.prototype, "textAlign", undefined);
8571
+ ], Text.prototype, "textAlign", void 0);
8528
8572
  __decorate([
8529
8573
  boundsType('top')
8530
- ], Text.prototype, "verticalAlign", undefined);
8574
+ ], Text.prototype, "verticalAlign", void 0);
8531
8575
  __decorate([
8532
8576
  boundsType(true)
8533
- ], Text.prototype, "autoSizeAlign", undefined);
8577
+ ], Text.prototype, "autoSizeAlign", void 0);
8534
8578
  __decorate([
8535
8579
  boundsType('normal')
8536
- ], Text.prototype, "textWrap", undefined);
8580
+ ], Text.prototype, "textWrap", void 0);
8537
8581
  __decorate([
8538
8582
  boundsType('show')
8539
- ], Text.prototype, "textOverflow", undefined);
8583
+ ], Text.prototype, "textOverflow", void 0);
8540
8584
  Text = __decorate([
8541
8585
  registerUI()
8542
8586
  ], Text);
@@ -8549,10 +8593,10 @@ let Path = class Path extends UI {
8549
8593
  };
8550
8594
  __decorate([
8551
8595
  dataProcessor(PathData)
8552
- ], Path.prototype, "__", undefined);
8596
+ ], Path.prototype, "__", void 0);
8553
8597
  __decorate([
8554
8598
  affectStrokeBoundsType('center')
8555
- ], Path.prototype, "strokeAlign", undefined);
8599
+ ], Path.prototype, "strokeAlign", void 0);
8556
8600
  Path = __decorate([
8557
8601
  registerUI()
8558
8602
  ], Path);
@@ -8591,10 +8635,10 @@ let Pen = class Pen extends Group {
8591
8635
  };
8592
8636
  __decorate([
8593
8637
  dataProcessor(PenData)
8594
- ], Pen.prototype, "__", undefined);
8638
+ ], Pen.prototype, "__", void 0);
8595
8639
  __decorate([
8596
8640
  penPathType()
8597
- ], Pen.prototype, "path", undefined);
8641
+ ], Pen.prototype, "path", void 0);
8598
8642
  Pen = __decorate([
8599
8643
  useModule(PathCreator, ['set', 'path', 'paint']),
8600
8644
  registerUI()
@@ -8966,7 +9010,7 @@ function getPatternData(paint, box, image) {
8966
9010
  box = tempBox.set(box).shrink(paint.padding);
8967
9011
  if (paint.mode === 'strench')
8968
9012
  paint.mode = 'stretch';
8969
- const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
9013
+ const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
8970
9014
  const sameBox = box.width === width && box.height === height;
8971
9015
  const data = { mode };
8972
9016
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -9029,6 +9073,8 @@ function getPatternData(paint, box, image) {
9029
9073
  data.height = height;
9030
9074
  if (opacity)
9031
9075
  data.opacity = opacity;
9076
+ if (filters)
9077
+ data.filters = filters;
9032
9078
  if (repeat)
9033
9079
  data.repeat = typeof repeat === 'string' ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat';
9034
9080
  return data;
@@ -9131,7 +9177,7 @@ function createPattern(ui, paint, pixelRatio) {
9131
9177
  scaleX = abs$1(scaleX);
9132
9178
  scaleY = abs$1(scaleY);
9133
9179
  const { image, data } = paint;
9134
- let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform, repeat } = data;
9180
+ let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
9135
9181
  if (sx) {
9136
9182
  imageMatrix = get$1();
9137
9183
  copy$1(imageMatrix, transform);
@@ -9174,7 +9220,7 @@ function createPattern(ui, paint, pixelRatio) {
9174
9220
  }
9175
9221
  scale(imageMatrix, 1 / scaleX, 1 / scaleY);
9176
9222
  }
9177
- const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, opacity);
9223
+ const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, data.opacity, data.filters);
9178
9224
  const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || 'no-repeat'), imageMatrix, paint);
9179
9225
  paint.style = pattern;
9180
9226
  paint.patternId = id;
@@ -9218,7 +9264,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
9218
9264
  canvas.opacity *= data.opacity;
9219
9265
  if (data.transform)
9220
9266
  canvas.transform(data.transform);
9221
- canvas.drawImage(paint.image.view, 0, 0, data.width, data.height);
9267
+ canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height);
9222
9268
  canvas.restore();
9223
9269
  return true;
9224
9270
  }
@@ -9228,7 +9274,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
9228
9274
  }
9229
9275
  else {
9230
9276
  if (!paint.patternTask) {
9231
- paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, undefined, undefined, function* () {
9277
+ paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
9232
9278
  paint.patternTask = null;
9233
9279
  if (canvas.bounds.hit(ui.__nowWorld))
9234
9280
  createPattern(ui, paint, pixelRatio);
@@ -10095,5 +10141,5 @@ Object.assign(Effect, EffectModule);
10095
10141
 
10096
10142
  useCanvas();
10097
10143
 
10098
- export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, 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, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
10144
+ export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, 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, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
10099
10145
  //# sourceMappingURL=worker.module.js.map