@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.
package/dist/worker.js CHANGED
@@ -1377,7 +1377,7 @@ var LeaferUI = (function (exports) {
1377
1377
  }
1378
1378
  const D$4 = Debug;
1379
1379
 
1380
- const debug$d = Debug.get('RunTime');
1380
+ const debug$e = Debug.get('RunTime');
1381
1381
  const Run = {
1382
1382
  currentId: 0,
1383
1383
  currentName: '',
@@ -1386,24 +1386,24 @@ var LeaferUI = (function (exports) {
1386
1386
  nameToIdMap: {},
1387
1387
  start(name, microsecond) {
1388
1388
  const id = IncrementId.create(IncrementId.RUNTIME);
1389
- R.currentId = R.idMap[id] = microsecond ? performance.now() : Date.now();
1390
- R.currentName = R.nameMap[id] = name;
1391
- R.nameToIdMap[name] = id;
1389
+ R$1.currentId = R$1.idMap[id] = microsecond ? performance.now() : Date.now();
1390
+ R$1.currentName = R$1.nameMap[id] = name;
1391
+ R$1.nameToIdMap[name] = id;
1392
1392
  return id;
1393
1393
  },
1394
1394
  end(id, microsecond) {
1395
- const time = R.idMap[id], name = R.nameMap[id];
1395
+ const time = R$1.idMap[id], name = R$1.nameMap[id];
1396
1396
  const duration = microsecond ? (performance.now() - time) / 1000 : Date.now() - time;
1397
- R.idMap[id] = R.nameMap[id] = R.nameToIdMap[name] = undefined;
1398
- debug$d.log(name, duration, 'ms');
1397
+ R$1.idMap[id] = R$1.nameMap[id] = R$1.nameToIdMap[name] = undefined;
1398
+ debug$e.log(name, duration, 'ms');
1399
1399
  },
1400
1400
  endOfName(name, microsecond) {
1401
- const id = R.nameToIdMap[name];
1401
+ const id = R$1.nameToIdMap[name];
1402
1402
  if (id !== undefined)
1403
- R.end(id, microsecond);
1403
+ R$1.end(id, microsecond);
1404
1404
  }
1405
1405
  };
1406
- const R = Run;
1406
+ const R$1 = Run;
1407
1407
 
1408
1408
  const check = [];
1409
1409
  const Plugin = {
@@ -1424,18 +1424,18 @@ var LeaferUI = (function (exports) {
1424
1424
  };
1425
1425
  setTimeout(() => check.forEach(name => Plugin.has(name, true)));
1426
1426
 
1427
- const debug$c = Debug.get('UICreator');
1427
+ const debug$d = Debug.get('UICreator');
1428
1428
  const UICreator = {
1429
1429
  list: {},
1430
1430
  register(UI) {
1431
1431
  const { __tag: tag } = UI.prototype;
1432
1432
  if (list$1[tag])
1433
- debug$c.repeat(tag);
1433
+ debug$d.repeat(tag);
1434
1434
  list$1[tag] = UI;
1435
1435
  },
1436
1436
  get(tag, data, x, y, width, height) {
1437
1437
  if (!list$1[tag])
1438
- debug$c.error('not register ' + tag);
1438
+ debug$d.error('not register ' + tag);
1439
1439
  const ui = new list$1[tag](data);
1440
1440
  if (x !== undefined) {
1441
1441
  ui.x = x;
@@ -1451,7 +1451,7 @@ var LeaferUI = (function (exports) {
1451
1451
  };
1452
1452
  const { list: list$1 } = UICreator;
1453
1453
 
1454
- const debug$b = Debug.get('EventCreator');
1454
+ const debug$c = Debug.get('EventCreator');
1455
1455
  const EventCreator = {
1456
1456
  nameList: {},
1457
1457
  register(Event) {
@@ -1459,7 +1459,7 @@ var LeaferUI = (function (exports) {
1459
1459
  Object.keys(Event).forEach(key => {
1460
1460
  name = Event[key];
1461
1461
  if (typeof name === 'string')
1462
- nameList[name] && debug$b.repeat(name), nameList[name] = Event;
1462
+ nameList[name] && debug$c.repeat(name), nameList[name] = Event;
1463
1463
  });
1464
1464
  },
1465
1465
  changeName(oldName, newName) {
@@ -1536,10 +1536,10 @@ var LeaferUI = (function (exports) {
1536
1536
  Object.keys(merge).forEach(key => {
1537
1537
  var _a, _b;
1538
1538
  value = merge[key];
1539
- if ((value === null || value === undefined ? undefined : value.constructor) === Object && ((_a = t[key]) === null || _a === undefined ? undefined : _a.constructor) === Object)
1539
+ if ((value === null || value === void 0 ? void 0 : value.constructor) === Object && ((_a = t[key]) === null || _a === void 0 ? void 0 : _a.constructor) === Object)
1540
1540
  return assign(t[key], merge[key], exclude && exclude[key]);
1541
1541
  if (exclude && (key in exclude)) {
1542
- if (((_b = exclude[key]) === null || _b === undefined ? undefined : _b.constructor) === Object)
1542
+ if (((_b = exclude[key]) === null || _b === void 0 ? void 0 : _b.constructor) === Object)
1543
1543
  assign(t[key] = {}, merge[key], exclude[key]);
1544
1544
  return;
1545
1545
  }
@@ -1663,7 +1663,7 @@ var LeaferUI = (function (exports) {
1663
1663
  const t = this;
1664
1664
  if (t.blendMode === 'pass-through') {
1665
1665
  const leaf = this.__leaf;
1666
- if ((t.opacity < 1 && (leaf.isBranch || t.__hasMultiPaint)) || leaf.__hasEraser || t.eraser) {
1666
+ if ((t.opacity < 1 && (leaf.isBranch || t.__hasMultiPaint)) || leaf.__hasEraser || t.eraser || t.filter) {
1667
1667
  t.__single = true;
1668
1668
  }
1669
1669
  else if (t.__single) {
@@ -1776,7 +1776,7 @@ var LeaferUI = (function (exports) {
1776
1776
  }
1777
1777
  setTransform(_a, _b, _c, _d, _e, _f) { }
1778
1778
  resetTransform() { }
1779
- getTransform() { return undefined; }
1779
+ getTransform() { return void 0; }
1780
1780
  save() { }
1781
1781
  restore() { }
1782
1782
  transform(a, b, c, d, e, f) {
@@ -1833,12 +1833,12 @@ var LeaferUI = (function (exports) {
1833
1833
  ellipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise) { }
1834
1834
  rect(_x, _y, _width, _height) { }
1835
1835
  roundRect(_x, _y, _width, _height, _radius) { }
1836
- createConicGradient(_startAngle, _x, _y) { return undefined; }
1837
- createLinearGradient(_x0, _y0, _x1, _y1) { return undefined; }
1838
- createPattern(_image, _repetition) { return undefined; }
1839
- createRadialGradient(_x0, _y0, _r0, _x1, _y1, _r1) { return undefined; }
1836
+ createConicGradient(_startAngle, _x, _y) { return void 0; }
1837
+ createLinearGradient(_x0, _y0, _x1, _y1) { return void 0; }
1838
+ createPattern(_image, _repetition) { return void 0; }
1839
+ createRadialGradient(_x0, _y0, _r0, _x1, _y1, _r1) { return void 0; }
1840
1840
  fillText(_text, _x, _y, _maxWidth) { }
1841
- measureText(_text) { return undefined; }
1841
+ measureText(_text) { return void 0; }
1842
1842
  strokeText(_text, _x, _y, _maxWidth) { }
1843
1843
  destroy() {
1844
1844
  this.context = null;
@@ -1846,79 +1846,79 @@ var LeaferUI = (function (exports) {
1846
1846
  }
1847
1847
  __decorate([
1848
1848
  contextAttr('imageSmoothingEnabled')
1849
- ], Canvas.prototype, "smooth", undefined);
1849
+ ], Canvas.prototype, "smooth", void 0);
1850
1850
  __decorate([
1851
1851
  contextAttr('imageSmoothingQuality')
1852
- ], Canvas.prototype, "smoothLevel", undefined);
1852
+ ], Canvas.prototype, "smoothLevel", void 0);
1853
1853
  __decorate([
1854
1854
  contextAttr('globalAlpha')
1855
- ], Canvas.prototype, "opacity", undefined);
1855
+ ], Canvas.prototype, "opacity", void 0);
1856
1856
  __decorate([
1857
1857
  contextAttr()
1858
- ], Canvas.prototype, "fillStyle", undefined);
1858
+ ], Canvas.prototype, "fillStyle", void 0);
1859
1859
  __decorate([
1860
1860
  contextAttr()
1861
- ], Canvas.prototype, "strokeStyle", undefined);
1861
+ ], Canvas.prototype, "strokeStyle", void 0);
1862
1862
  __decorate([
1863
1863
  contextAttr('lineWidth')
1864
- ], Canvas.prototype, "strokeWidth", undefined);
1864
+ ], Canvas.prototype, "strokeWidth", void 0);
1865
1865
  __decorate([
1866
1866
  contextAttr('lineCap')
1867
- ], Canvas.prototype, "strokeCap", undefined);
1867
+ ], Canvas.prototype, "strokeCap", void 0);
1868
1868
  __decorate([
1869
1869
  contextAttr('lineJoin')
1870
- ], Canvas.prototype, "strokeJoin", undefined);
1870
+ ], Canvas.prototype, "strokeJoin", void 0);
1871
1871
  __decorate([
1872
1872
  contextAttr('lineDashOffset')
1873
- ], Canvas.prototype, "dashOffset", undefined);
1873
+ ], Canvas.prototype, "dashOffset", void 0);
1874
1874
  __decorate([
1875
1875
  contextAttr()
1876
- ], Canvas.prototype, "miterLimit", undefined);
1876
+ ], Canvas.prototype, "miterLimit", void 0);
1877
1877
  __decorate([
1878
1878
  contextAttr()
1879
- ], Canvas.prototype, "shadowBlur", undefined);
1879
+ ], Canvas.prototype, "shadowBlur", void 0);
1880
1880
  __decorate([
1881
1881
  contextAttr()
1882
- ], Canvas.prototype, "shadowColor", undefined);
1882
+ ], Canvas.prototype, "shadowColor", void 0);
1883
1883
  __decorate([
1884
1884
  contextAttr()
1885
- ], Canvas.prototype, "shadowOffsetX", undefined);
1885
+ ], Canvas.prototype, "shadowOffsetX", void 0);
1886
1886
  __decorate([
1887
1887
  contextAttr()
1888
- ], Canvas.prototype, "shadowOffsetY", undefined);
1888
+ ], Canvas.prototype, "shadowOffsetY", void 0);
1889
1889
  __decorate([
1890
1890
  contextAttr()
1891
- ], Canvas.prototype, "filter", undefined);
1891
+ ], Canvas.prototype, "filter", void 0);
1892
1892
  __decorate([
1893
1893
  contextAttr()
1894
- ], Canvas.prototype, "font", undefined);
1894
+ ], Canvas.prototype, "font", void 0);
1895
1895
  __decorate([
1896
1896
  contextAttr()
1897
- ], Canvas.prototype, "fontKerning", undefined);
1897
+ ], Canvas.prototype, "fontKerning", void 0);
1898
1898
  __decorate([
1899
1899
  contextAttr()
1900
- ], Canvas.prototype, "fontStretch", undefined);
1900
+ ], Canvas.prototype, "fontStretch", void 0);
1901
1901
  __decorate([
1902
1902
  contextAttr()
1903
- ], Canvas.prototype, "fontVariantCaps", undefined);
1903
+ ], Canvas.prototype, "fontVariantCaps", void 0);
1904
1904
  __decorate([
1905
1905
  contextAttr()
1906
- ], Canvas.prototype, "textAlign", undefined);
1906
+ ], Canvas.prototype, "textAlign", void 0);
1907
1907
  __decorate([
1908
1908
  contextAttr()
1909
- ], Canvas.prototype, "textBaseline", undefined);
1909
+ ], Canvas.prototype, "textBaseline", void 0);
1910
1910
  __decorate([
1911
1911
  contextAttr()
1912
- ], Canvas.prototype, "textRendering", undefined);
1912
+ ], Canvas.prototype, "textRendering", void 0);
1913
1913
  __decorate([
1914
1914
  contextAttr()
1915
- ], Canvas.prototype, "wordSpacing", undefined);
1915
+ ], Canvas.prototype, "wordSpacing", void 0);
1916
1916
  __decorate([
1917
1917
  contextAttr()
1918
- ], Canvas.prototype, "letterSpacing", undefined);
1918
+ ], Canvas.prototype, "letterSpacing", void 0);
1919
1919
  __decorate([
1920
1920
  contextAttr()
1921
- ], Canvas.prototype, "direction", undefined);
1921
+ ], Canvas.prototype, "direction", void 0);
1922
1922
  __decorate([
1923
1923
  contextMethod()
1924
1924
  ], Canvas.prototype, "setTransform", null);
@@ -2615,7 +2615,7 @@ var LeaferUI = (function (exports) {
2615
2615
  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;
2616
2616
  const { rect: rect$2, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
2617
2617
  const { ellipticalArc } = EllipseHelper;
2618
- const debug$a = Debug.get('PathConvert');
2618
+ const debug$b = Debug.get('PathConvert');
2619
2619
  const setEndPoint$1 = {};
2620
2620
  const PathConvert = {
2621
2621
  current: { dot: 0 },
@@ -2856,7 +2856,7 @@ var LeaferUI = (function (exports) {
2856
2856
  i += 6;
2857
2857
  break;
2858
2858
  default:
2859
- debug$a.error(`command: ${command} [index:${i}]`, old);
2859
+ debug$b.error(`command: ${command} [index:${i}]`, old);
2860
2860
  return data;
2861
2861
  }
2862
2862
  lastCommand = command;
@@ -2965,12 +2965,10 @@ var LeaferUI = (function (exports) {
2965
2965
  },
2966
2966
  arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
2967
2967
  if (lastX !== undefined) {
2968
- const maxRadius = tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2) * (getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / 2);
2969
- data.push(U$2, x1, y1, x2, y2, min(radius, abs$2(maxRadius)));
2970
- }
2971
- else {
2972
- data.push(U$2, x1, y1, x2, y2, radius);
2968
+ const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
2969
+ radius = min(radius, min(d / 2, d / 2 * abs$2(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
2973
2970
  }
2971
+ data.push(U$2, x1, y1, x2, y2, radius);
2974
2972
  },
2975
2973
  drawEllipse(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
2976
2974
  BezierHelper.ellipse(null, x, y, radiusX, radiusY, rotation === undefined ? 0 : rotation, startAngle === undefined ? 0 : startAngle, endAngle === undefined ? 360 : endAngle, anticlockwise, null, null, startPoint);
@@ -3081,7 +3079,7 @@ var LeaferUI = (function (exports) {
3081
3079
  }
3082
3080
 
3083
3081
  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;
3084
- const debug$9 = Debug.get('PathDrawer');
3082
+ const debug$a = Debug.get('PathDrawer');
3085
3083
  const PathDrawer = {
3086
3084
  drawPathByData(drawer, data) {
3087
3085
  if (!data)
@@ -3144,7 +3142,7 @@ var LeaferUI = (function (exports) {
3144
3142
  i += 6;
3145
3143
  break;
3146
3144
  default:
3147
- debug$9.error(`command: ${command} [index:${i}]`, data);
3145
+ debug$a.error(`command: ${command} [index:${i}]`, data);
3148
3146
  return;
3149
3147
  }
3150
3148
  }
@@ -3154,7 +3152,7 @@ var LeaferUI = (function (exports) {
3154
3152
  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;
3155
3153
  const { toTwoPointBounds, toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc, ellipse: ellipse$1 } = BezierHelper;
3156
3154
  const { addPointBounds, copy: copy$7, addPoint, setPoint, addBounds, toBounds: toBounds$2 } = TwoPointBoundsHelper;
3157
- const debug$8 = Debug.get('PathBounds');
3155
+ const debug$9 = Debug.get('PathBounds');
3158
3156
  let radius, radiusX, radiusY;
3159
3157
  const tempPointBounds = {};
3160
3158
  const setPointBounds = {};
@@ -3262,7 +3260,7 @@ var LeaferUI = (function (exports) {
3262
3260
  i += 6;
3263
3261
  break;
3264
3262
  default:
3265
- debug$8.error(`command: ${command} [index:${i}]`, data);
3263
+ debug$9.error(`command: ${command} [index:${i}]`, data);
3266
3264
  return;
3267
3265
  }
3268
3266
  }
@@ -3378,7 +3376,7 @@ var LeaferUI = (function (exports) {
3378
3376
  const F = FileHelper;
3379
3377
  F.opacityTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
3380
3378
 
3381
- const debug$7 = Debug.get('TaskProcessor');
3379
+ const debug$8 = Debug.get('TaskProcessor');
3382
3380
  class TaskItem {
3383
3381
  constructor(task) {
3384
3382
  this.parallel = true;
@@ -3387,13 +3385,13 @@ var LeaferUI = (function (exports) {
3387
3385
  this.task = task;
3388
3386
  }
3389
3387
  run() {
3390
- return __awaiter(this, undefined, undefined, function* () {
3388
+ return __awaiter(this, void 0, void 0, function* () {
3391
3389
  try {
3392
3390
  if (this.task && !this.isComplete && this.parent.running)
3393
3391
  yield this.task();
3394
3392
  }
3395
3393
  catch (error) {
3396
- debug$7.error(error);
3394
+ debug$8.error(error);
3397
3395
  }
3398
3396
  });
3399
3397
  }
@@ -3626,18 +3624,58 @@ var LeaferUI = (function (exports) {
3626
3624
  }
3627
3625
  }
3628
3626
 
3629
- const ImageManager = {
3627
+ const debug$7 = Debug.get('Resource');
3628
+ const Resource = {
3629
+ tasker: new TaskProcessor(),
3630
3630
  map: {},
3631
+ get isComplete() { return R.tasker.isComplete; },
3632
+ set(key, value) {
3633
+ if (R.map[key])
3634
+ debug$7.repeat(key);
3635
+ R.map[key] = value;
3636
+ },
3637
+ get(key) {
3638
+ return R.map[key];
3639
+ },
3640
+ remove(key) {
3641
+ const r = R.map[key];
3642
+ if (r) {
3643
+ if (r.destroy)
3644
+ r.destroy();
3645
+ delete R.map[key];
3646
+ }
3647
+ },
3648
+ loadImage(key, format) {
3649
+ return new Promise((resolve, reject) => {
3650
+ const image = this.setImage(key, key, format);
3651
+ image.load(() => resolve(image), (e) => reject(e));
3652
+ });
3653
+ },
3654
+ setImage(key, value, format) {
3655
+ let config;
3656
+ if (typeof value === 'string')
3657
+ config = { url: value };
3658
+ else if (!value.url)
3659
+ config = { url: key, view: value };
3660
+ if (config)
3661
+ format && (config.format = format), value = Creator.image(config);
3662
+ R.set(key, value);
3663
+ return value;
3664
+ },
3665
+ destroy() {
3666
+ R.map = {};
3667
+ }
3668
+ };
3669
+ const R = Resource;
3670
+
3671
+ const ImageManager = {
3672
+ maxRecycled: 100,
3631
3673
  recycledList: [],
3632
- tasker: new TaskProcessor(),
3633
3674
  patternTasker: new TaskProcessor(),
3634
- get isComplete() { return I.tasker.isComplete; },
3635
3675
  get(config) {
3636
- let image = I.map[config.url];
3637
- if (!image) {
3638
- image = Creator.image(config);
3639
- I.map[config.url] = image;
3640
- }
3676
+ let image = Resource.get(config.url);
3677
+ if (!image)
3678
+ Resource.set(config.url, image = Creator.image(config));
3641
3679
  image.use++;
3642
3680
  return image;
3643
3681
  },
@@ -3648,13 +3686,8 @@ var LeaferUI = (function (exports) {
3648
3686
  },
3649
3687
  clearRecycled() {
3650
3688
  const list = I.recycledList;
3651
- if (list.length > 100) {
3652
- list.forEach(image => {
3653
- if (!image.use && image.url) {
3654
- delete I.map[image.url];
3655
- image.destroy();
3656
- }
3657
- });
3689
+ if (list.length > I.maxRecycled) {
3690
+ list.forEach(image => (!image.use && image.url) && Resource.remove(image.url));
3658
3691
  list.length = 0;
3659
3692
  }
3660
3693
  },
@@ -3678,7 +3711,6 @@ var LeaferUI = (function (exports) {
3678
3711
  return false;
3679
3712
  },
3680
3713
  destroy() {
3681
- I.map = {};
3682
3714
  I.recycledList = [];
3683
3715
  }
3684
3716
  };
@@ -3692,21 +3724,19 @@ var LeaferUI = (function (exports) {
3692
3724
  this.use = 0;
3693
3725
  this.waitComplete = [];
3694
3726
  this.innerId = create$1(IMAGE);
3695
- this.config = config || { url: '' };
3696
- this.isSVG = ImageManager.isFormat('svg', config);
3697
- this.hasOpacityPixel = ImageManager.hasOpacityPixel(config);
3727
+ this.config = config || (config = { url: '' });
3728
+ if (config.view) {
3729
+ const { view } = config;
3730
+ this.setView(view.config ? view.view : view);
3731
+ }
3732
+ ImageManager.isFormat('svg', config) && (this.isSVG = true);
3733
+ ImageManager.hasOpacityPixel(config) && (this.hasOpacityPixel = true);
3698
3734
  }
3699
3735
  load(onSuccess, onError) {
3700
3736
  if (!this.loading) {
3701
3737
  this.loading = true;
3702
- ImageManager.tasker.add(() => __awaiter(this, undefined, undefined, function* () {
3703
- return yield Platform.origin.loadImage(this.url).then((img) => {
3704
- this.ready = true;
3705
- this.width = img.naturalWidth || img.width;
3706
- this.height = img.naturalHeight || img.height;
3707
- this.view = img;
3708
- this.onComplete(true);
3709
- }).catch((e) => {
3738
+ Resource.tasker.add(() => __awaiter(this, void 0, void 0, function* () {
3739
+ return yield Platform.origin.loadImage(this.url).then(img => this.setView(img)).catch((e) => {
3710
3740
  this.error = e;
3711
3741
  this.onComplete(false);
3712
3742
  });
@@ -3724,6 +3754,13 @@ var LeaferUI = (function (exports) {
3724
3754
  }
3725
3755
  l[index] = l[index + 1] = undefined;
3726
3756
  }
3757
+ setView(img) {
3758
+ this.ready = true;
3759
+ this.width = img.naturalWidth || img.width;
3760
+ this.height = img.naturalHeight || img.height;
3761
+ this.view = img;
3762
+ this.onComplete(true);
3763
+ }
3727
3764
  onComplete(isSuccess) {
3728
3765
  let odd;
3729
3766
  this.waitComplete.forEach((item, index) => {
@@ -3742,6 +3779,9 @@ var LeaferUI = (function (exports) {
3742
3779
  this.waitComplete.length = 0;
3743
3780
  this.loading = false;
3744
3781
  }
3782
+ getFull(_filters) {
3783
+ return this.view;
3784
+ }
3745
3785
  getCanvas(width, height, opacity, _filters) {
3746
3786
  width || (width = this.width);
3747
3787
  height || (height = this.height);
@@ -5222,7 +5262,7 @@ var LeaferUI = (function (exports) {
5222
5262
  if (this.__.eraser === 'path')
5223
5263
  return this.__renderEraser(canvas, options);
5224
5264
  const tempCanvas = canvas.getSameCanvas(true, true);
5225
- this.__draw(tempCanvas, options);
5265
+ this.__draw(tempCanvas, options, canvas);
5226
5266
  if (this.__worldFlipped) {
5227
5267
  canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, this.__.__blendMode, true);
5228
5268
  }
@@ -6015,7 +6055,7 @@ var LeaferUI = (function (exports) {
6015
6055
  }
6016
6056
  }
6017
6057
 
6018
- const version = "1.4.0";
6058
+ const version = "1.4.2";
6019
6059
 
6020
6060
  class LeaferCanvas extends LeaferCanvasBase {
6021
6061
  get allowBackgroundColor() { return true; }
@@ -6360,7 +6400,7 @@ var LeaferUI = (function (exports) {
6360
6400
  }
6361
6401
  partLayout() {
6362
6402
  var _a;
6363
- if (!((_a = this.__updatedList) === null || _a === undefined ? undefined : _a.length))
6403
+ if (!((_a = this.__updatedList) === null || _a === void 0 ? void 0 : _a.length))
6364
6404
  return;
6365
6405
  const t = Run.start('PartLayout');
6366
6406
  const { target, __updatedList: updateList } = this;
@@ -6729,9 +6769,7 @@ var LeaferUI = (function (exports) {
6729
6769
  const ColorConvert = {};
6730
6770
  const UnitConvert = {
6731
6771
  number(value, percentRefer) {
6732
- if (typeof value === 'object')
6733
- return value.type === 'percent' ? value.value * percentRefer : value.value;
6734
- return value;
6772
+ return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
6735
6773
  }
6736
6774
  };
6737
6775
  const PathArrow = {};
@@ -6739,16 +6777,15 @@ var LeaferUI = (function (exports) {
6739
6777
  const PaintImage = {};
6740
6778
  const PaintGradient = {};
6741
6779
  const Effect = {};
6780
+ const Filter = {
6781
+ apply() { Plugin.need('filter'); }
6782
+ };
6742
6783
  const Export = {};
6743
6784
  const State = {
6744
- setStyleName(_leaf, _styleName, _value) { return Plugin.need('state'); },
6745
- set(_leaf, _stateName) { return Plugin.need('state'); }
6746
- };
6747
- const Transition = {
6748
- list: {},
6749
- register(attrName, fn) { Transition.list[attrName] = fn; },
6750
- get(attrName) { return Transition.list[attrName]; }
6785
+ setStyleName() { return Plugin.need('state'); },
6786
+ set() { return Plugin.need('state'); }
6751
6787
  };
6788
+ const Transition = {};
6752
6789
 
6753
6790
  const { parse, objectToCanvasData } = PathConvert;
6754
6791
  const emptyPaint = {};
@@ -6855,24 +6892,13 @@ var LeaferUI = (function (exports) {
6855
6892
  }
6856
6893
  }
6857
6894
  setShadow(value) {
6858
- this.__setInput('shadow', value);
6859
- if (value instanceof Array) {
6860
- if (value.some((item) => item.visible === false))
6861
- value = value.filter((item) => item.visible !== false);
6862
- this._shadow = value.length ? value : null;
6863
- }
6864
- else
6865
- this._shadow = value && value.visible !== false ? [value] : null;
6895
+ setArray(this, 'shadow', value);
6866
6896
  }
6867
6897
  setInnerShadow(value) {
6868
- this.__setInput('innerShadow', value);
6869
- if (value instanceof Array) {
6870
- if (value.some((item) => item.visible === false))
6871
- value = value.filter((item) => item.visible !== false);
6872
- this._innerShadow = value.length ? value : null;
6873
- }
6874
- else
6875
- this._innerShadow = value && value.visible !== false ? [value] : null;
6898
+ setArray(this, 'innerShadow', value);
6899
+ }
6900
+ setFilter(value) {
6901
+ setArray(this, 'filter', value);
6876
6902
  }
6877
6903
  __computePaint() {
6878
6904
  const { fill, stroke } = this.__input;
@@ -6883,6 +6909,17 @@ var LeaferUI = (function (exports) {
6883
6909
  this.__needComputePaint = false;
6884
6910
  }
6885
6911
  }
6912
+ function setArray(data, key, value) {
6913
+ data.__setInput(key, value);
6914
+ if (value instanceof Array) {
6915
+ if (value.some((item) => item.visible === false))
6916
+ value = value.filter((item) => item.visible !== false);
6917
+ value.length || (value = null);
6918
+ }
6919
+ else
6920
+ value = value && value.visible !== false ? [value] : null;
6921
+ data['_' + key] = value;
6922
+ }
6886
6923
 
6887
6924
  class GroupData extends UIData {
6888
6925
  }
@@ -7005,11 +7042,13 @@ var LeaferUI = (function (exports) {
7005
7042
  },
7006
7043
  __updateRenderSpread() {
7007
7044
  let width = 0;
7008
- const { shadow, innerShadow, blur, backgroundBlur } = this.__;
7045
+ const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
7009
7046
  if (shadow)
7010
7047
  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));
7011
7048
  if (blur)
7012
7049
  width = Math.max(width, blur);
7050
+ if (filter)
7051
+ width += Filter.getSpread(filter);
7013
7052
  let shapeWidth = width = Math.ceil(width);
7014
7053
  if (innerShadow)
7015
7054
  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));
@@ -7024,8 +7063,8 @@ var LeaferUI = (function (exports) {
7024
7063
  __updateChange() {
7025
7064
  const data = this.__;
7026
7065
  if (data.__useEffect) {
7027
- const { shadow, innerShadow, blur, backgroundBlur } = this.__;
7028
- data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur);
7066
+ const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
7067
+ data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur || filter);
7029
7068
  }
7030
7069
  data.__checkSingle();
7031
7070
  const complex = data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect;
@@ -7039,7 +7078,7 @@ var LeaferUI = (function (exports) {
7039
7078
  __drawFast(canvas, options) {
7040
7079
  drawFast(this, canvas, options);
7041
7080
  },
7042
- __draw(canvas, options) {
7081
+ __draw(canvas, options, originCanvas) {
7043
7082
  const data = this.__;
7044
7083
  if (data.__complex) {
7045
7084
  if (data.__needComputePaint)
@@ -7049,7 +7088,7 @@ var LeaferUI = (function (exports) {
7049
7088
  if (data.__useEffect) {
7050
7089
  const shape = Paint.shape(this, canvas, options);
7051
7090
  this.__nowWorld = this.__getNowWorld(options);
7052
- const { shadow, innerShadow } = data;
7091
+ const { shadow, innerShadow, filter } = data;
7053
7092
  if (shadow)
7054
7093
  Effect.shadow(this, canvas, shape);
7055
7094
  if (fill)
@@ -7060,6 +7099,8 @@ var LeaferUI = (function (exports) {
7060
7099
  Effect.innerShadow(this, canvas, shape);
7061
7100
  if (stroke)
7062
7101
  data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
7102
+ if (filter)
7103
+ Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
7063
7104
  if (shape.worldCanvas)
7064
7105
  shape.worldCanvas.recycle();
7065
7106
  shape.canvas.recycle();
@@ -7279,199 +7320,202 @@ var LeaferUI = (function (exports) {
7279
7320
  };
7280
7321
  __decorate([
7281
7322
  dataProcessor(UIData)
7282
- ], exports.UI.prototype, "__", undefined);
7323
+ ], exports.UI.prototype, "__", void 0);
7283
7324
  __decorate([
7284
7325
  zoomLayerType()
7285
- ], exports.UI.prototype, "zoomLayer", undefined);
7326
+ ], exports.UI.prototype, "zoomLayer", void 0);
7286
7327
  __decorate([
7287
7328
  dataType('')
7288
- ], exports.UI.prototype, "id", undefined);
7329
+ ], exports.UI.prototype, "id", void 0);
7289
7330
  __decorate([
7290
7331
  dataType('')
7291
- ], exports.UI.prototype, "name", undefined);
7332
+ ], exports.UI.prototype, "name", void 0);
7292
7333
  __decorate([
7293
7334
  dataType('')
7294
- ], exports.UI.prototype, "className", undefined);
7335
+ ], exports.UI.prototype, "className", void 0);
7295
7336
  __decorate([
7296
7337
  surfaceType('pass-through')
7297
- ], exports.UI.prototype, "blendMode", undefined);
7338
+ ], exports.UI.prototype, "blendMode", void 0);
7298
7339
  __decorate([
7299
7340
  opacityType(1)
7300
- ], exports.UI.prototype, "opacity", undefined);
7341
+ ], exports.UI.prototype, "opacity", void 0);
7301
7342
  __decorate([
7302
7343
  visibleType(true)
7303
- ], exports.UI.prototype, "visible", undefined);
7344
+ ], exports.UI.prototype, "visible", void 0);
7304
7345
  __decorate([
7305
7346
  surfaceType(false)
7306
- ], exports.UI.prototype, "locked", undefined);
7347
+ ], exports.UI.prototype, "locked", void 0);
7307
7348
  __decorate([
7308
7349
  sortType(0)
7309
- ], exports.UI.prototype, "zIndex", undefined);
7350
+ ], exports.UI.prototype, "zIndex", void 0);
7310
7351
  __decorate([
7311
7352
  maskType(false)
7312
- ], exports.UI.prototype, "mask", undefined);
7353
+ ], exports.UI.prototype, "mask", void 0);
7313
7354
  __decorate([
7314
7355
  eraserType(false)
7315
- ], exports.UI.prototype, "eraser", undefined);
7356
+ ], exports.UI.prototype, "eraser", void 0);
7316
7357
  __decorate([
7317
7358
  positionType(0, true)
7318
- ], exports.UI.prototype, "x", undefined);
7359
+ ], exports.UI.prototype, "x", void 0);
7319
7360
  __decorate([
7320
7361
  positionType(0, true)
7321
- ], exports.UI.prototype, "y", undefined);
7362
+ ], exports.UI.prototype, "y", void 0);
7322
7363
  __decorate([
7323
7364
  boundsType(100, true)
7324
- ], exports.UI.prototype, "width", undefined);
7365
+ ], exports.UI.prototype, "width", void 0);
7325
7366
  __decorate([
7326
7367
  boundsType(100, true)
7327
- ], exports.UI.prototype, "height", undefined);
7368
+ ], exports.UI.prototype, "height", void 0);
7328
7369
  __decorate([
7329
7370
  scaleType(1, true)
7330
- ], exports.UI.prototype, "scaleX", undefined);
7371
+ ], exports.UI.prototype, "scaleX", void 0);
7331
7372
  __decorate([
7332
7373
  scaleType(1, true)
7333
- ], exports.UI.prototype, "scaleY", undefined);
7374
+ ], exports.UI.prototype, "scaleY", void 0);
7334
7375
  __decorate([
7335
7376
  rotationType(0, true)
7336
- ], exports.UI.prototype, "rotation", undefined);
7377
+ ], exports.UI.prototype, "rotation", void 0);
7337
7378
  __decorate([
7338
7379
  rotationType(0, true)
7339
- ], exports.UI.prototype, "skewX", undefined);
7380
+ ], exports.UI.prototype, "skewX", void 0);
7340
7381
  __decorate([
7341
7382
  rotationType(0, true)
7342
- ], exports.UI.prototype, "skewY", undefined);
7383
+ ], exports.UI.prototype, "skewY", void 0);
7343
7384
  __decorate([
7344
7385
  positionType(0, true)
7345
- ], exports.UI.prototype, "offsetX", undefined);
7386
+ ], exports.UI.prototype, "offsetX", void 0);
7346
7387
  __decorate([
7347
7388
  positionType(0, true)
7348
- ], exports.UI.prototype, "offsetY", undefined);
7389
+ ], exports.UI.prototype, "offsetY", void 0);
7349
7390
  __decorate([
7350
7391
  positionType(0, true)
7351
- ], exports.UI.prototype, "scrollX", undefined);
7392
+ ], exports.UI.prototype, "scrollX", void 0);
7352
7393
  __decorate([
7353
7394
  positionType(0, true)
7354
- ], exports.UI.prototype, "scrollY", undefined);
7395
+ ], exports.UI.prototype, "scrollY", void 0);
7355
7396
  __decorate([
7356
7397
  autoLayoutType()
7357
- ], exports.UI.prototype, "origin", undefined);
7398
+ ], exports.UI.prototype, "origin", void 0);
7358
7399
  __decorate([
7359
7400
  autoLayoutType()
7360
- ], exports.UI.prototype, "around", undefined);
7401
+ ], exports.UI.prototype, "around", void 0);
7361
7402
  __decorate([
7362
7403
  dataType(false)
7363
- ], exports.UI.prototype, "lazy", undefined);
7404
+ ], exports.UI.prototype, "lazy", void 0);
7364
7405
  __decorate([
7365
7406
  naturalBoundsType(1)
7366
- ], exports.UI.prototype, "pixelRatio", undefined);
7407
+ ], exports.UI.prototype, "pixelRatio", void 0);
7367
7408
  __decorate([
7368
7409
  pathInputType()
7369
- ], exports.UI.prototype, "path", undefined);
7410
+ ], exports.UI.prototype, "path", void 0);
7370
7411
  __decorate([
7371
7412
  pathType()
7372
- ], exports.UI.prototype, "windingRule", undefined);
7413
+ ], exports.UI.prototype, "windingRule", void 0);
7373
7414
  __decorate([
7374
7415
  pathType(true)
7375
- ], exports.UI.prototype, "closed", undefined);
7416
+ ], exports.UI.prototype, "closed", void 0);
7376
7417
  __decorate([
7377
7418
  boundsType(0)
7378
- ], exports.UI.prototype, "padding", undefined);
7419
+ ], exports.UI.prototype, "padding", void 0);
7379
7420
  __decorate([
7380
7421
  boundsType(false)
7381
- ], exports.UI.prototype, "lockRatio", undefined);
7422
+ ], exports.UI.prototype, "lockRatio", void 0);
7382
7423
  __decorate([
7383
7424
  boundsType()
7384
- ], exports.UI.prototype, "widthRange", undefined);
7425
+ ], exports.UI.prototype, "widthRange", void 0);
7385
7426
  __decorate([
7386
7427
  boundsType()
7387
- ], exports.UI.prototype, "heightRange", undefined);
7428
+ ], exports.UI.prototype, "heightRange", void 0);
7388
7429
  __decorate([
7389
7430
  dataType(false)
7390
- ], exports.UI.prototype, "draggable", undefined);
7431
+ ], exports.UI.prototype, "draggable", void 0);
7391
7432
  __decorate([
7392
7433
  dataType()
7393
- ], exports.UI.prototype, "dragBounds", undefined);
7434
+ ], exports.UI.prototype, "dragBounds", void 0);
7394
7435
  __decorate([
7395
7436
  dataType(false)
7396
- ], exports.UI.prototype, "editable", undefined);
7437
+ ], exports.UI.prototype, "editable", void 0);
7397
7438
  __decorate([
7398
7439
  hitType(true)
7399
- ], exports.UI.prototype, "hittable", undefined);
7440
+ ], exports.UI.prototype, "hittable", void 0);
7400
7441
  __decorate([
7401
7442
  hitType('path')
7402
- ], exports.UI.prototype, "hitFill", undefined);
7443
+ ], exports.UI.prototype, "hitFill", void 0);
7403
7444
  __decorate([
7404
7445
  strokeType('path')
7405
- ], exports.UI.prototype, "hitStroke", undefined);
7446
+ ], exports.UI.prototype, "hitStroke", void 0);
7406
7447
  __decorate([
7407
7448
  hitType(false)
7408
- ], exports.UI.prototype, "hitBox", undefined);
7449
+ ], exports.UI.prototype, "hitBox", void 0);
7409
7450
  __decorate([
7410
7451
  hitType(true)
7411
- ], exports.UI.prototype, "hitChildren", undefined);
7452
+ ], exports.UI.prototype, "hitChildren", void 0);
7412
7453
  __decorate([
7413
7454
  hitType(true)
7414
- ], exports.UI.prototype, "hitSelf", undefined);
7455
+ ], exports.UI.prototype, "hitSelf", void 0);
7415
7456
  __decorate([
7416
7457
  hitType()
7417
- ], exports.UI.prototype, "hitRadius", undefined);
7458
+ ], exports.UI.prototype, "hitRadius", void 0);
7418
7459
  __decorate([
7419
7460
  cursorType('')
7420
- ], exports.UI.prototype, "cursor", undefined);
7461
+ ], exports.UI.prototype, "cursor", void 0);
7421
7462
  __decorate([
7422
7463
  surfaceType()
7423
- ], exports.UI.prototype, "fill", undefined);
7464
+ ], exports.UI.prototype, "fill", void 0);
7424
7465
  __decorate([
7425
7466
  strokeType()
7426
- ], exports.UI.prototype, "stroke", undefined);
7467
+ ], exports.UI.prototype, "stroke", void 0);
7427
7468
  __decorate([
7428
7469
  strokeType('inside')
7429
- ], exports.UI.prototype, "strokeAlign", undefined);
7470
+ ], exports.UI.prototype, "strokeAlign", void 0);
7430
7471
  __decorate([
7431
7472
  strokeType(1)
7432
- ], exports.UI.prototype, "strokeWidth", undefined);
7473
+ ], exports.UI.prototype, "strokeWidth", void 0);
7433
7474
  __decorate([
7434
7475
  strokeType(false)
7435
- ], exports.UI.prototype, "strokeWidthFixed", undefined);
7476
+ ], exports.UI.prototype, "strokeWidthFixed", void 0);
7436
7477
  __decorate([
7437
7478
  strokeType('none')
7438
- ], exports.UI.prototype, "strokeCap", undefined);
7479
+ ], exports.UI.prototype, "strokeCap", void 0);
7439
7480
  __decorate([
7440
7481
  strokeType('miter')
7441
- ], exports.UI.prototype, "strokeJoin", undefined);
7482
+ ], exports.UI.prototype, "strokeJoin", void 0);
7442
7483
  __decorate([
7443
7484
  strokeType()
7444
- ], exports.UI.prototype, "dashPattern", undefined);
7485
+ ], exports.UI.prototype, "dashPattern", void 0);
7445
7486
  __decorate([
7446
7487
  strokeType()
7447
- ], exports.UI.prototype, "dashOffset", undefined);
7488
+ ], exports.UI.prototype, "dashOffset", void 0);
7448
7489
  __decorate([
7449
7490
  strokeType(10)
7450
- ], exports.UI.prototype, "miterLimit", undefined);
7491
+ ], exports.UI.prototype, "miterLimit", void 0);
7451
7492
  __decorate([
7452
7493
  pathType(0)
7453
- ], exports.UI.prototype, "cornerRadius", undefined);
7494
+ ], exports.UI.prototype, "cornerRadius", void 0);
7454
7495
  __decorate([
7455
7496
  pathType()
7456
- ], exports.UI.prototype, "cornerSmoothing", undefined);
7497
+ ], exports.UI.prototype, "cornerSmoothing", void 0);
7498
+ __decorate([
7499
+ effectType()
7500
+ ], exports.UI.prototype, "shadow", void 0);
7457
7501
  __decorate([
7458
7502
  effectType()
7459
- ], exports.UI.prototype, "shadow", undefined);
7503
+ ], exports.UI.prototype, "innerShadow", void 0);
7460
7504
  __decorate([
7461
7505
  effectType()
7462
- ], exports.UI.prototype, "innerShadow", undefined);
7506
+ ], exports.UI.prototype, "blur", void 0);
7463
7507
  __decorate([
7464
7508
  effectType()
7465
- ], exports.UI.prototype, "blur", undefined);
7509
+ ], exports.UI.prototype, "backgroundBlur", void 0);
7466
7510
  __decorate([
7467
7511
  effectType()
7468
- ], exports.UI.prototype, "backgroundBlur", undefined);
7512
+ ], exports.UI.prototype, "grayscale", void 0);
7469
7513
  __decorate([
7470
7514
  effectType()
7471
- ], exports.UI.prototype, "grayscale", undefined);
7515
+ ], exports.UI.prototype, "filter", void 0);
7472
7516
  __decorate([
7473
7517
  dataType({})
7474
- ], exports.UI.prototype, "data", undefined);
7518
+ ], exports.UI.prototype, "data", void 0);
7475
7519
  __decorate([
7476
7520
  rewrite(exports.Leaf.prototype.reset)
7477
7521
  ], exports.UI.prototype, "reset", null);
@@ -7532,7 +7576,7 @@ var LeaferUI = (function (exports) {
7532
7576
  };
7533
7577
  __decorate([
7534
7578
  dataProcessor(GroupData)
7535
- ], exports.Group.prototype, "__", undefined);
7579
+ ], exports.Group.prototype, "__", void 0);
7536
7580
  exports.Group = __decorate([
7537
7581
  useModule(exports.Branch),
7538
7582
  registerUI()
@@ -7545,7 +7589,7 @@ var LeaferUI = (function (exports) {
7545
7589
  get isApp() { return false; }
7546
7590
  get app() { return this.parent || this; }
7547
7591
  get isLeafer() { return true; }
7548
- get imageReady() { return this.viewReady && ImageManager.isComplete; }
7592
+ get imageReady() { return this.viewReady && Resource.isComplete; }
7549
7593
  get layoutLocked() { return !this.layouter.running; }
7550
7594
  get FPS() { return this.renderer ? this.renderer.FPS : 60; }
7551
7595
  get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
@@ -7756,13 +7800,13 @@ var LeaferUI = (function (exports) {
7756
7800
  WaitHelper.run(this.__viewReadyWait);
7757
7801
  }
7758
7802
  __onLayoutEnd() {
7759
- const { grow, growWidth, growHeight } = this.config;
7803
+ const { grow, width: fixedWidth, height: fixedHeight } = this.config;
7760
7804
  if (grow) {
7761
7805
  let { width, height, pixelRatio } = this;
7762
7806
  const bounds = grow === 'box' ? this.worldBoxBounds : this.__world;
7763
- if (growWidth !== false)
7807
+ if (!fixedWidth)
7764
7808
  width = Math.max(1, bounds.x + bounds.width);
7765
- if (growHeight !== false)
7809
+ if (!fixedHeight)
7766
7810
  height = Math.max(1, bounds.y + bounds.height);
7767
7811
  this.__doResize({ width, height, pixelRatio });
7768
7812
  }
@@ -7840,7 +7884,7 @@ var LeaferUI = (function (exports) {
7840
7884
  list.push(item);
7841
7885
  this.requestRender();
7842
7886
  }
7843
- zoom(_zoomType, _padding, _fixedScale) {
7887
+ zoom(_zoomType, _padding, _fixedScale, _transition) {
7844
7888
  return Plugin.need('view');
7845
7889
  }
7846
7890
  getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
@@ -7905,10 +7949,10 @@ var LeaferUI = (function (exports) {
7905
7949
  exports.Leafer.list = new LeafList();
7906
7950
  __decorate([
7907
7951
  dataProcessor(LeaferData)
7908
- ], exports.Leafer.prototype, "__", undefined);
7952
+ ], exports.Leafer.prototype, "__", void 0);
7909
7953
  __decorate([
7910
7954
  boundsType()
7911
- ], exports.Leafer.prototype, "pixelRatio", undefined);
7955
+ ], exports.Leafer.prototype, "pixelRatio", void 0);
7912
7956
  exports.Leafer = Leafer_1 = __decorate([
7913
7957
  registerUI()
7914
7958
  ], exports.Leafer);
@@ -7921,7 +7965,7 @@ var LeaferUI = (function (exports) {
7921
7965
  };
7922
7966
  __decorate([
7923
7967
  dataProcessor(RectData)
7924
- ], exports.Rect.prototype, "__", undefined);
7968
+ ], exports.Rect.prototype, "__", void 0);
7925
7969
  exports.Rect = __decorate([
7926
7970
  useModule(RectRender),
7927
7971
  rewriteAble(),
@@ -8012,13 +8056,13 @@ var LeaferUI = (function (exports) {
8012
8056
  };
8013
8057
  __decorate([
8014
8058
  dataProcessor(BoxData)
8015
- ], exports.Box.prototype, "__", undefined);
8059
+ ], exports.Box.prototype, "__", void 0);
8016
8060
  __decorate([
8017
8061
  dataType(false)
8018
- ], exports.Box.prototype, "resizeChildren", undefined);
8062
+ ], exports.Box.prototype, "resizeChildren", void 0);
8019
8063
  __decorate([
8020
8064
  affectRenderBoundsType('show')
8021
- ], exports.Box.prototype, "overflow", undefined);
8065
+ ], exports.Box.prototype, "overflow", void 0);
8022
8066
  __decorate([
8023
8067
  rewrite(rect.__updateStrokeSpread)
8024
8068
  ], exports.Box.prototype, "__updateStrokeSpread", null);
@@ -8057,13 +8101,13 @@ var LeaferUI = (function (exports) {
8057
8101
  };
8058
8102
  __decorate([
8059
8103
  dataProcessor(FrameData)
8060
- ], exports.Frame.prototype, "__", undefined);
8104
+ ], exports.Frame.prototype, "__", void 0);
8061
8105
  __decorate([
8062
8106
  surfaceType('#FFFFFF')
8063
- ], exports.Frame.prototype, "fill", undefined);
8107
+ ], exports.Frame.prototype, "fill", void 0);
8064
8108
  __decorate([
8065
8109
  affectRenderBoundsType('hide')
8066
- ], exports.Frame.prototype, "overflow", undefined);
8110
+ ], exports.Frame.prototype, "overflow", void 0);
8067
8111
  exports.Frame = __decorate([
8068
8112
  registerUI()
8069
8113
  ], exports.Frame);
@@ -8110,16 +8154,16 @@ var LeaferUI = (function (exports) {
8110
8154
  };
8111
8155
  __decorate([
8112
8156
  dataProcessor(EllipseData)
8113
- ], exports.Ellipse.prototype, "__", undefined);
8157
+ ], exports.Ellipse.prototype, "__", void 0);
8114
8158
  __decorate([
8115
8159
  pathType(0)
8116
- ], exports.Ellipse.prototype, "innerRadius", undefined);
8160
+ ], exports.Ellipse.prototype, "innerRadius", void 0);
8117
8161
  __decorate([
8118
8162
  pathType(0)
8119
- ], exports.Ellipse.prototype, "startAngle", undefined);
8163
+ ], exports.Ellipse.prototype, "startAngle", void 0);
8120
8164
  __decorate([
8121
8165
  pathType(0)
8122
- ], exports.Ellipse.prototype, "endAngle", undefined);
8166
+ ], exports.Ellipse.prototype, "endAngle", void 0);
8123
8167
  exports.Ellipse = __decorate([
8124
8168
  registerUI()
8125
8169
  ], exports.Ellipse);
@@ -8178,22 +8222,22 @@ var LeaferUI = (function (exports) {
8178
8222
  };
8179
8223
  __decorate([
8180
8224
  dataProcessor(LineData)
8181
- ], exports.Line.prototype, "__", undefined);
8225
+ ], exports.Line.prototype, "__", void 0);
8182
8226
  __decorate([
8183
8227
  affectStrokeBoundsType('center')
8184
- ], exports.Line.prototype, "strokeAlign", undefined);
8228
+ ], exports.Line.prototype, "strokeAlign", void 0);
8185
8229
  __decorate([
8186
8230
  boundsType(0)
8187
- ], exports.Line.prototype, "height", undefined);
8231
+ ], exports.Line.prototype, "height", void 0);
8188
8232
  __decorate([
8189
8233
  pathType()
8190
- ], exports.Line.prototype, "points", undefined);
8234
+ ], exports.Line.prototype, "points", void 0);
8191
8235
  __decorate([
8192
8236
  pathType(0)
8193
- ], exports.Line.prototype, "curve", undefined);
8237
+ ], exports.Line.prototype, "curve", void 0);
8194
8238
  __decorate([
8195
8239
  pathType(false)
8196
- ], exports.Line.prototype, "closed", undefined);
8240
+ ], exports.Line.prototype, "closed", void 0);
8197
8241
  exports.Line = __decorate([
8198
8242
  registerUI()
8199
8243
  ], exports.Line);
@@ -8226,16 +8270,16 @@ var LeaferUI = (function (exports) {
8226
8270
  };
8227
8271
  __decorate([
8228
8272
  dataProcessor(PolygonData)
8229
- ], exports.Polygon.prototype, "__", undefined);
8273
+ ], exports.Polygon.prototype, "__", void 0);
8230
8274
  __decorate([
8231
8275
  pathType(3)
8232
- ], exports.Polygon.prototype, "sides", undefined);
8276
+ ], exports.Polygon.prototype, "sides", void 0);
8233
8277
  __decorate([
8234
8278
  pathType()
8235
- ], exports.Polygon.prototype, "points", undefined);
8279
+ ], exports.Polygon.prototype, "points", void 0);
8236
8280
  __decorate([
8237
8281
  pathType(0)
8238
- ], exports.Polygon.prototype, "curve", undefined);
8282
+ ], exports.Polygon.prototype, "curve", void 0);
8239
8283
  __decorate([
8240
8284
  rewrite(line.__updateRenderPath)
8241
8285
  ], exports.Polygon.prototype, "__updateRenderPath", null);
@@ -8267,13 +8311,13 @@ var LeaferUI = (function (exports) {
8267
8311
  };
8268
8312
  __decorate([
8269
8313
  dataProcessor(StarData)
8270
- ], exports.Star.prototype, "__", undefined);
8314
+ ], exports.Star.prototype, "__", void 0);
8271
8315
  __decorate([
8272
8316
  pathType(5)
8273
- ], exports.Star.prototype, "corners", undefined);
8317
+ ], exports.Star.prototype, "corners", void 0);
8274
8318
  __decorate([
8275
8319
  pathType(0.382)
8276
- ], exports.Star.prototype, "innerRadius", undefined);
8320
+ ], exports.Star.prototype, "innerRadius", void 0);
8277
8321
  exports.Star = __decorate([
8278
8322
  registerUI()
8279
8323
  ], exports.Star);
@@ -8295,10 +8339,10 @@ var LeaferUI = (function (exports) {
8295
8339
  };
8296
8340
  __decorate([
8297
8341
  dataProcessor(ImageData)
8298
- ], exports.Image.prototype, "__", undefined);
8342
+ ], exports.Image.prototype, "__", void 0);
8299
8343
  __decorate([
8300
8344
  boundsType('')
8301
- ], exports.Image.prototype, "url", undefined);
8345
+ ], exports.Image.prototype, "url", void 0);
8302
8346
  exports.Image = __decorate([
8303
8347
  registerUI()
8304
8348
  ], exports.Image);
@@ -8361,25 +8405,25 @@ var LeaferUI = (function (exports) {
8361
8405
  };
8362
8406
  __decorate([
8363
8407
  dataProcessor(CanvasData)
8364
- ], exports.Canvas.prototype, "__", undefined);
8408
+ ], exports.Canvas.prototype, "__", void 0);
8365
8409
  __decorate([
8366
8410
  resizeType(100)
8367
- ], exports.Canvas.prototype, "width", undefined);
8411
+ ], exports.Canvas.prototype, "width", void 0);
8368
8412
  __decorate([
8369
8413
  resizeType(100)
8370
- ], exports.Canvas.prototype, "height", undefined);
8414
+ ], exports.Canvas.prototype, "height", void 0);
8371
8415
  __decorate([
8372
8416
  resizeType(1)
8373
- ], exports.Canvas.prototype, "pixelRatio", undefined);
8417
+ ], exports.Canvas.prototype, "pixelRatio", void 0);
8374
8418
  __decorate([
8375
8419
  resizeType(true)
8376
- ], exports.Canvas.prototype, "smooth", undefined);
8420
+ ], exports.Canvas.prototype, "smooth", void 0);
8377
8421
  __decorate([
8378
8422
  dataType(false)
8379
- ], exports.Canvas.prototype, "safeResize", undefined);
8423
+ ], exports.Canvas.prototype, "safeResize", void 0);
8380
8424
  __decorate([
8381
8425
  resizeType()
8382
- ], exports.Canvas.prototype, "contextSettings", undefined);
8426
+ ], exports.Canvas.prototype, "contextSettings", void 0);
8383
8427
  exports.Canvas = __decorate([
8384
8428
  registerUI()
8385
8429
  ], exports.Canvas);
@@ -8470,76 +8514,76 @@ var LeaferUI = (function (exports) {
8470
8514
  };
8471
8515
  __decorate([
8472
8516
  dataProcessor(TextData)
8473
- ], exports.Text.prototype, "__", undefined);
8517
+ ], exports.Text.prototype, "__", void 0);
8474
8518
  __decorate([
8475
8519
  boundsType(0)
8476
- ], exports.Text.prototype, "width", undefined);
8520
+ ], exports.Text.prototype, "width", void 0);
8477
8521
  __decorate([
8478
8522
  boundsType(0)
8479
- ], exports.Text.prototype, "height", undefined);
8523
+ ], exports.Text.prototype, "height", void 0);
8480
8524
  __decorate([
8481
8525
  dataType(false)
8482
- ], exports.Text.prototype, "resizeFontSize", undefined);
8526
+ ], exports.Text.prototype, "resizeFontSize", void 0);
8483
8527
  __decorate([
8484
8528
  surfaceType('#000000')
8485
- ], exports.Text.prototype, "fill", undefined);
8529
+ ], exports.Text.prototype, "fill", void 0);
8486
8530
  __decorate([
8487
8531
  affectStrokeBoundsType('outside')
8488
- ], exports.Text.prototype, "strokeAlign", undefined);
8532
+ ], exports.Text.prototype, "strokeAlign", void 0);
8489
8533
  __decorate([
8490
8534
  hitType('all')
8491
- ], exports.Text.prototype, "hitFill", undefined);
8535
+ ], exports.Text.prototype, "hitFill", void 0);
8492
8536
  __decorate([
8493
8537
  boundsType('')
8494
- ], exports.Text.prototype, "text", undefined);
8538
+ ], exports.Text.prototype, "text", void 0);
8495
8539
  __decorate([
8496
8540
  boundsType('caption')
8497
- ], exports.Text.prototype, "fontFamily", undefined);
8541
+ ], exports.Text.prototype, "fontFamily", void 0);
8498
8542
  __decorate([
8499
8543
  boundsType(12)
8500
- ], exports.Text.prototype, "fontSize", undefined);
8544
+ ], exports.Text.prototype, "fontSize", void 0);
8501
8545
  __decorate([
8502
8546
  boundsType('normal')
8503
- ], exports.Text.prototype, "fontWeight", undefined);
8547
+ ], exports.Text.prototype, "fontWeight", void 0);
8504
8548
  __decorate([
8505
8549
  boundsType(false)
8506
- ], exports.Text.prototype, "italic", undefined);
8550
+ ], exports.Text.prototype, "italic", void 0);
8507
8551
  __decorate([
8508
8552
  boundsType('none')
8509
- ], exports.Text.prototype, "textCase", undefined);
8553
+ ], exports.Text.prototype, "textCase", void 0);
8510
8554
  __decorate([
8511
8555
  boundsType('none')
8512
- ], exports.Text.prototype, "textDecoration", undefined);
8556
+ ], exports.Text.prototype, "textDecoration", void 0);
8513
8557
  __decorate([
8514
8558
  boundsType(0)
8515
- ], exports.Text.prototype, "letterSpacing", undefined);
8559
+ ], exports.Text.prototype, "letterSpacing", void 0);
8516
8560
  __decorate([
8517
8561
  boundsType({ type: 'percent', value: 1.5 })
8518
- ], exports.Text.prototype, "lineHeight", undefined);
8562
+ ], exports.Text.prototype, "lineHeight", void 0);
8519
8563
  __decorate([
8520
8564
  boundsType(0)
8521
- ], exports.Text.prototype, "paraIndent", undefined);
8565
+ ], exports.Text.prototype, "paraIndent", void 0);
8522
8566
  __decorate([
8523
8567
  boundsType(0)
8524
- ], exports.Text.prototype, "paraSpacing", undefined);
8568
+ ], exports.Text.prototype, "paraSpacing", void 0);
8525
8569
  __decorate([
8526
8570
  boundsType('x')
8527
- ], exports.Text.prototype, "writingMode", undefined);
8571
+ ], exports.Text.prototype, "writingMode", void 0);
8528
8572
  __decorate([
8529
8573
  boundsType('left')
8530
- ], exports.Text.prototype, "textAlign", undefined);
8574
+ ], exports.Text.prototype, "textAlign", void 0);
8531
8575
  __decorate([
8532
8576
  boundsType('top')
8533
- ], exports.Text.prototype, "verticalAlign", undefined);
8577
+ ], exports.Text.prototype, "verticalAlign", void 0);
8534
8578
  __decorate([
8535
8579
  boundsType(true)
8536
- ], exports.Text.prototype, "autoSizeAlign", undefined);
8580
+ ], exports.Text.prototype, "autoSizeAlign", void 0);
8537
8581
  __decorate([
8538
8582
  boundsType('normal')
8539
- ], exports.Text.prototype, "textWrap", undefined);
8583
+ ], exports.Text.prototype, "textWrap", void 0);
8540
8584
  __decorate([
8541
8585
  boundsType('show')
8542
- ], exports.Text.prototype, "textOverflow", undefined);
8586
+ ], exports.Text.prototype, "textOverflow", void 0);
8543
8587
  exports.Text = __decorate([
8544
8588
  registerUI()
8545
8589
  ], exports.Text);
@@ -8552,10 +8596,10 @@ var LeaferUI = (function (exports) {
8552
8596
  };
8553
8597
  __decorate([
8554
8598
  dataProcessor(PathData)
8555
- ], exports.Path.prototype, "__", undefined);
8599
+ ], exports.Path.prototype, "__", void 0);
8556
8600
  __decorate([
8557
8601
  affectStrokeBoundsType('center')
8558
- ], exports.Path.prototype, "strokeAlign", undefined);
8602
+ ], exports.Path.prototype, "strokeAlign", void 0);
8559
8603
  exports.Path = __decorate([
8560
8604
  registerUI()
8561
8605
  ], exports.Path);
@@ -8594,10 +8638,10 @@ var LeaferUI = (function (exports) {
8594
8638
  };
8595
8639
  __decorate([
8596
8640
  dataProcessor(PenData)
8597
- ], exports.Pen.prototype, "__", undefined);
8641
+ ], exports.Pen.prototype, "__", void 0);
8598
8642
  __decorate([
8599
8643
  penPathType()
8600
- ], exports.Pen.prototype, "path", undefined);
8644
+ ], exports.Pen.prototype, "path", void 0);
8601
8645
  exports.Pen = __decorate([
8602
8646
  useModule(PathCreator, ['set', 'path', 'paint']),
8603
8647
  registerUI()
@@ -8969,7 +9013,7 @@ var LeaferUI = (function (exports) {
8969
9013
  box = tempBox.set(box).shrink(paint.padding);
8970
9014
  if (paint.mode === 'strench')
8971
9015
  paint.mode = 'stretch';
8972
- const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
9016
+ const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
8973
9017
  const sameBox = box.width === width && box.height === height;
8974
9018
  const data = { mode };
8975
9019
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -9032,6 +9076,8 @@ var LeaferUI = (function (exports) {
9032
9076
  data.height = height;
9033
9077
  if (opacity)
9034
9078
  data.opacity = opacity;
9079
+ if (filters)
9080
+ data.filters = filters;
9035
9081
  if (repeat)
9036
9082
  data.repeat = typeof repeat === 'string' ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat';
9037
9083
  return data;
@@ -9134,7 +9180,7 @@ var LeaferUI = (function (exports) {
9134
9180
  scaleX = abs$1(scaleX);
9135
9181
  scaleY = abs$1(scaleY);
9136
9182
  const { image, data } = paint;
9137
- let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform, repeat } = data;
9183
+ let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
9138
9184
  if (sx) {
9139
9185
  imageMatrix = get$1();
9140
9186
  copy$1(imageMatrix, transform);
@@ -9177,7 +9223,7 @@ var LeaferUI = (function (exports) {
9177
9223
  }
9178
9224
  scale(imageMatrix, 1 / scaleX, 1 / scaleY);
9179
9225
  }
9180
- const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, opacity);
9226
+ const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, data.opacity, data.filters);
9181
9227
  const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || 'no-repeat'), imageMatrix, paint);
9182
9228
  paint.style = pattern;
9183
9229
  paint.patternId = id;
@@ -9221,7 +9267,7 @@ var LeaferUI = (function (exports) {
9221
9267
  canvas.opacity *= data.opacity;
9222
9268
  if (data.transform)
9223
9269
  canvas.transform(data.transform);
9224
- canvas.drawImage(paint.image.view, 0, 0, data.width, data.height);
9270
+ canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height);
9225
9271
  canvas.restore();
9226
9272
  return true;
9227
9273
  }
@@ -9231,7 +9277,7 @@ var LeaferUI = (function (exports) {
9231
9277
  }
9232
9278
  else {
9233
9279
  if (!paint.patternTask) {
9234
- paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, undefined, undefined, function* () {
9280
+ paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
9235
9281
  paint.patternTask = null;
9236
9282
  if (canvas.bounds.hit(ui.__nowWorld))
9237
9283
  createPattern(ui, paint, pixelRatio);
@@ -10122,6 +10168,7 @@ var LeaferUI = (function (exports) {
10122
10168
  exports.Eventer = Eventer;
10123
10169
  exports.Export = Export;
10124
10170
  exports.FileHelper = FileHelper;
10171
+ exports.Filter = Filter;
10125
10172
  exports.FrameData = FrameData;
10126
10173
  exports.GroupData = GroupData;
10127
10174
  exports.ImageData = ImageData;
@@ -10183,6 +10230,7 @@ var LeaferUI = (function (exports) {
10183
10230
  exports.RenderEvent = RenderEvent;
10184
10231
  exports.Renderer = Renderer;
10185
10232
  exports.ResizeEvent = ResizeEvent;
10233
+ exports.Resource = Resource;
10186
10234
  exports.Run = Run;
10187
10235
  exports.StarData = StarData;
10188
10236
  exports.State = State;