leafer-draw 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/web.js CHANGED
@@ -1377,7 +1377,7 @@ var LeaferUI = (function (exports) {
1377
1377
  }
1378
1378
  const D$4 = Debug;
1379
1379
 
1380
- const debug$e = Debug.get('RunTime');
1380
+ const debug$f = 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$e.log(name, duration, 'ms');
1397
+ R$1.idMap[id] = R$1.nameMap[id] = R$1.nameToIdMap[name] = undefined;
1398
+ debug$f.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$d = Debug.get('UICreator');
1427
+ const debug$e = 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$d.repeat(tag);
1433
+ debug$e.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$d.error('not register ' + tag);
1438
+ debug$e.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$c = Debug.get('EventCreator');
1454
+ const debug$d = 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$c.repeat(name), nameList[name] = Event;
1462
+ nameList[name] && debug$d.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$b = Debug.get('PathConvert');
2618
+ const debug$c = 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$b.error(`command: ${command} [index:${i}]`, old);
2859
+ debug$c.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$a = Debug.get('PathDrawer');
3082
+ const debug$b = 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$a.error(`command: ${command} [index:${i}]`, data);
3145
+ debug$b.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$9 = Debug.get('PathBounds');
3155
+ const debug$a = 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$9.error(`command: ${command} [index:${i}]`, data);
3263
+ debug$a.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$8 = Debug.get('TaskProcessor');
3379
+ const debug$9 = 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$8.error(error);
3394
+ debug$9.error(error);
3397
3395
  }
3398
3396
  });
3399
3397
  }
@@ -3626,18 +3624,52 @@ var LeaferUI = (function (exports) {
3626
3624
  }
3627
3625
  }
3628
3626
 
3629
- const ImageManager = {
3627
+ const debug$8 = 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$8.repeat(key);
3635
+ R.map[key] = value;
3636
+ },
3637
+ get(key) {
3638
+ return R.map[key];
3639
+ },
3640
+ remove(key) {
3641
+ delete R.map[key];
3642
+ },
3643
+ loadImage(key, format) {
3644
+ return new Promise((resolve, reject) => {
3645
+ const image = this.setImage(key, key, format);
3646
+ image.load(() => resolve(image), (e) => reject(e));
3647
+ });
3648
+ },
3649
+ setImage(key, value, format) {
3650
+ let config;
3651
+ if (typeof value === 'string')
3652
+ config = { url: value };
3653
+ else if (!value.url)
3654
+ config = { url: key, view: value };
3655
+ if (config)
3656
+ format && (config.format = format), value = Creator.image(config);
3657
+ R.set(key, value);
3658
+ return value;
3659
+ },
3660
+ destroy() {
3661
+ R.map = {};
3662
+ }
3663
+ };
3664
+ const R = Resource;
3665
+
3666
+ const ImageManager = {
3631
3667
  recycledList: [],
3632
- tasker: new TaskProcessor(),
3633
3668
  patternTasker: new TaskProcessor(),
3634
- get isComplete() { return I.tasker.isComplete; },
3635
3669
  get(config) {
3636
- let image = I.map[config.url];
3637
- if (!image) {
3638
- image = Creator.image(config);
3639
- I.map[config.url] = image;
3640
- }
3670
+ let image = Resource.get(config.url);
3671
+ if (!image)
3672
+ Resource.set(config.url, image = Creator.image(config));
3641
3673
  image.use++;
3642
3674
  return image;
3643
3675
  },
@@ -3651,7 +3683,7 @@ var LeaferUI = (function (exports) {
3651
3683
  if (list.length > 100) {
3652
3684
  list.forEach(image => {
3653
3685
  if (!image.use && image.url) {
3654
- delete I.map[image.url];
3686
+ Resource.remove(image.url);
3655
3687
  image.destroy();
3656
3688
  }
3657
3689
  });
@@ -3678,7 +3710,6 @@ var LeaferUI = (function (exports) {
3678
3710
  return false;
3679
3711
  },
3680
3712
  destroy() {
3681
- I.map = {};
3682
3713
  I.recycledList = [];
3683
3714
  }
3684
3715
  };
@@ -3692,21 +3723,19 @@ var LeaferUI = (function (exports) {
3692
3723
  this.use = 0;
3693
3724
  this.waitComplete = [];
3694
3725
  this.innerId = create$1(IMAGE);
3695
- this.config = config || { url: '' };
3696
- this.isSVG = ImageManager.isFormat('svg', config);
3697
- this.hasOpacityPixel = ImageManager.hasOpacityPixel(config);
3726
+ this.config = config || (config = { url: '' });
3727
+ if (config.view) {
3728
+ const { view } = config;
3729
+ this.setView(view.config ? view.view : view);
3730
+ }
3731
+ ImageManager.isFormat('svg', config) && (this.isSVG = true);
3732
+ ImageManager.hasOpacityPixel(config) && (this.hasOpacityPixel = true);
3698
3733
  }
3699
3734
  load(onSuccess, onError) {
3700
3735
  if (!this.loading) {
3701
3736
  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) => {
3737
+ Resource.tasker.add(() => __awaiter(this, void 0, void 0, function* () {
3738
+ return yield Platform.origin.loadImage(this.url).then(img => this.setView(img)).catch((e) => {
3710
3739
  this.error = e;
3711
3740
  this.onComplete(false);
3712
3741
  });
@@ -3724,6 +3753,13 @@ var LeaferUI = (function (exports) {
3724
3753
  }
3725
3754
  l[index] = l[index + 1] = undefined;
3726
3755
  }
3756
+ setView(img) {
3757
+ this.ready = true;
3758
+ this.width = img.naturalWidth || img.width;
3759
+ this.height = img.naturalHeight || img.height;
3760
+ this.view = img;
3761
+ this.onComplete(true);
3762
+ }
3727
3763
  onComplete(isSuccess) {
3728
3764
  let odd;
3729
3765
  this.waitComplete.forEach((item, index) => {
@@ -3742,6 +3778,9 @@ var LeaferUI = (function (exports) {
3742
3778
  this.waitComplete.length = 0;
3743
3779
  this.loading = false;
3744
3780
  }
3781
+ getFull(_filters) {
3782
+ return this.view;
3783
+ }
3745
3784
  getCanvas(width, height, opacity, _filters) {
3746
3785
  width || (width = this.width);
3747
3786
  height || (height = this.height);
@@ -5222,7 +5261,7 @@ var LeaferUI = (function (exports) {
5222
5261
  if (this.__.eraser === 'path')
5223
5262
  return this.__renderEraser(canvas, options);
5224
5263
  const tempCanvas = canvas.getSameCanvas(true, true);
5225
- this.__draw(tempCanvas, options);
5264
+ this.__draw(tempCanvas, options, canvas);
5226
5265
  if (this.__worldFlipped) {
5227
5266
  canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, this.__.__blendMode, true);
5228
5267
  }
@@ -6015,7 +6054,7 @@ var LeaferUI = (function (exports) {
6015
6054
  }
6016
6055
  }
6017
6056
 
6018
- const version = "1.4.0";
6057
+ const version = "1.4.1";
6019
6058
 
6020
6059
  const debug$4 = Debug.get('LeaferCanvas');
6021
6060
  class LeaferCanvas extends LeaferCanvasBase {
@@ -6272,7 +6311,7 @@ var LeaferUI = (function (exports) {
6272
6311
  Platform.intWheelDeltaY = true;
6273
6312
  Platform.syncDomFont = true;
6274
6313
  }
6275
- else if (userAgent.indexOf("Safari") > -1 && userAgent.indexOf("Chrome") === -1) {
6314
+ else if (userAgent.indexOf("AppleWebKit") > -1) {
6276
6315
  Platform.fullImageShadow = true;
6277
6316
  }
6278
6317
  if (userAgent.indexOf('Windows') > -1) {
@@ -6541,7 +6580,7 @@ var LeaferUI = (function (exports) {
6541
6580
  }
6542
6581
  partLayout() {
6543
6582
  var _a;
6544
- if (!((_a = this.__updatedList) === null || _a === undefined ? undefined : _a.length))
6583
+ if (!((_a = this.__updatedList) === null || _a === void 0 ? void 0 : _a.length))
6545
6584
  return;
6546
6585
  const t = Run.start('PartLayout');
6547
6586
  const { target, __updatedList: updateList } = this;
@@ -6910,9 +6949,7 @@ var LeaferUI = (function (exports) {
6910
6949
  const ColorConvert = {};
6911
6950
  const UnitConvert = {
6912
6951
  number(value, percentRefer) {
6913
- if (typeof value === 'object')
6914
- return value.type === 'percent' ? value.value * percentRefer : value.value;
6915
- return value;
6952
+ return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
6916
6953
  }
6917
6954
  };
6918
6955
  const PathArrow = {};
@@ -6920,16 +6957,15 @@ var LeaferUI = (function (exports) {
6920
6957
  const PaintImage = {};
6921
6958
  const PaintGradient = {};
6922
6959
  const Effect = {};
6960
+ const Filter = {
6961
+ apply() { Plugin.need('filter'); }
6962
+ };
6923
6963
  const Export = {};
6924
6964
  const State = {
6925
- setStyleName(_leaf, _styleName, _value) { return Plugin.need('state'); },
6926
- set(_leaf, _stateName) { return Plugin.need('state'); }
6927
- };
6928
- const Transition = {
6929
- list: {},
6930
- register(attrName, fn) { Transition.list[attrName] = fn; },
6931
- get(attrName) { return Transition.list[attrName]; }
6965
+ setStyleName() { return Plugin.need('state'); },
6966
+ set() { return Plugin.need('state'); }
6932
6967
  };
6968
+ const Transition = {};
6933
6969
 
6934
6970
  const { parse, objectToCanvasData } = PathConvert;
6935
6971
  const emptyPaint = {};
@@ -7036,24 +7072,13 @@ var LeaferUI = (function (exports) {
7036
7072
  }
7037
7073
  }
7038
7074
  setShadow(value) {
7039
- this.__setInput('shadow', value);
7040
- if (value instanceof Array) {
7041
- if (value.some((item) => item.visible === false))
7042
- value = value.filter((item) => item.visible !== false);
7043
- this._shadow = value.length ? value : null;
7044
- }
7045
- else
7046
- this._shadow = value && value.visible !== false ? [value] : null;
7075
+ setArray(this, 'shadow', value);
7047
7076
  }
7048
7077
  setInnerShadow(value) {
7049
- this.__setInput('innerShadow', value);
7050
- if (value instanceof Array) {
7051
- if (value.some((item) => item.visible === false))
7052
- value = value.filter((item) => item.visible !== false);
7053
- this._innerShadow = value.length ? value : null;
7054
- }
7055
- else
7056
- this._innerShadow = value && value.visible !== false ? [value] : null;
7078
+ setArray(this, 'innerShadow', value);
7079
+ }
7080
+ setFilter(value) {
7081
+ setArray(this, 'filter', value);
7057
7082
  }
7058
7083
  __computePaint() {
7059
7084
  const { fill, stroke } = this.__input;
@@ -7064,6 +7089,17 @@ var LeaferUI = (function (exports) {
7064
7089
  this.__needComputePaint = false;
7065
7090
  }
7066
7091
  }
7092
+ function setArray(data, key, value) {
7093
+ data.__setInput(key, value);
7094
+ if (value instanceof Array) {
7095
+ if (value.some((item) => item.visible === false))
7096
+ value = value.filter((item) => item.visible !== false);
7097
+ value.length || (value = null);
7098
+ }
7099
+ else
7100
+ value = value && value.visible !== false ? [value] : null;
7101
+ data['_' + key] = value;
7102
+ }
7067
7103
 
7068
7104
  class GroupData extends UIData {
7069
7105
  }
@@ -7186,11 +7222,13 @@ var LeaferUI = (function (exports) {
7186
7222
  },
7187
7223
  __updateRenderSpread() {
7188
7224
  let width = 0;
7189
- const { shadow, innerShadow, blur, backgroundBlur } = this.__;
7225
+ const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
7190
7226
  if (shadow)
7191
7227
  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));
7192
7228
  if (blur)
7193
7229
  width = Math.max(width, blur);
7230
+ if (filter)
7231
+ width += Filter.getSpread(filter);
7194
7232
  let shapeWidth = width = Math.ceil(width);
7195
7233
  if (innerShadow)
7196
7234
  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));
@@ -7205,8 +7243,8 @@ var LeaferUI = (function (exports) {
7205
7243
  __updateChange() {
7206
7244
  const data = this.__;
7207
7245
  if (data.__useEffect) {
7208
- const { shadow, innerShadow, blur, backgroundBlur } = this.__;
7209
- data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur);
7246
+ const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
7247
+ data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur || filter);
7210
7248
  }
7211
7249
  data.__checkSingle();
7212
7250
  const complex = data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect;
@@ -7220,7 +7258,7 @@ var LeaferUI = (function (exports) {
7220
7258
  __drawFast(canvas, options) {
7221
7259
  drawFast(this, canvas, options);
7222
7260
  },
7223
- __draw(canvas, options) {
7261
+ __draw(canvas, options, originCanvas) {
7224
7262
  const data = this.__;
7225
7263
  if (data.__complex) {
7226
7264
  if (data.__needComputePaint)
@@ -7230,7 +7268,7 @@ var LeaferUI = (function (exports) {
7230
7268
  if (data.__useEffect) {
7231
7269
  const shape = Paint.shape(this, canvas, options);
7232
7270
  this.__nowWorld = this.__getNowWorld(options);
7233
- const { shadow, innerShadow } = data;
7271
+ const { shadow, innerShadow, filter } = data;
7234
7272
  if (shadow)
7235
7273
  Effect.shadow(this, canvas, shape);
7236
7274
  if (fill)
@@ -7241,6 +7279,8 @@ var LeaferUI = (function (exports) {
7241
7279
  Effect.innerShadow(this, canvas, shape);
7242
7280
  if (stroke)
7243
7281
  data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
7282
+ if (filter)
7283
+ Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
7244
7284
  if (shape.worldCanvas)
7245
7285
  shape.worldCanvas.recycle();
7246
7286
  shape.canvas.recycle();
@@ -7460,199 +7500,202 @@ var LeaferUI = (function (exports) {
7460
7500
  };
7461
7501
  __decorate([
7462
7502
  dataProcessor(UIData)
7463
- ], exports.UI.prototype, "__", undefined);
7503
+ ], exports.UI.prototype, "__", void 0);
7464
7504
  __decorate([
7465
7505
  zoomLayerType()
7466
- ], exports.UI.prototype, "zoomLayer", undefined);
7506
+ ], exports.UI.prototype, "zoomLayer", void 0);
7467
7507
  __decorate([
7468
7508
  dataType('')
7469
- ], exports.UI.prototype, "id", undefined);
7509
+ ], exports.UI.prototype, "id", void 0);
7470
7510
  __decorate([
7471
7511
  dataType('')
7472
- ], exports.UI.prototype, "name", undefined);
7512
+ ], exports.UI.prototype, "name", void 0);
7473
7513
  __decorate([
7474
7514
  dataType('')
7475
- ], exports.UI.prototype, "className", undefined);
7515
+ ], exports.UI.prototype, "className", void 0);
7476
7516
  __decorate([
7477
7517
  surfaceType('pass-through')
7478
- ], exports.UI.prototype, "blendMode", undefined);
7518
+ ], exports.UI.prototype, "blendMode", void 0);
7479
7519
  __decorate([
7480
7520
  opacityType(1)
7481
- ], exports.UI.prototype, "opacity", undefined);
7521
+ ], exports.UI.prototype, "opacity", void 0);
7482
7522
  __decorate([
7483
7523
  visibleType(true)
7484
- ], exports.UI.prototype, "visible", undefined);
7524
+ ], exports.UI.prototype, "visible", void 0);
7485
7525
  __decorate([
7486
7526
  surfaceType(false)
7487
- ], exports.UI.prototype, "locked", undefined);
7527
+ ], exports.UI.prototype, "locked", void 0);
7488
7528
  __decorate([
7489
7529
  sortType(0)
7490
- ], exports.UI.prototype, "zIndex", undefined);
7530
+ ], exports.UI.prototype, "zIndex", void 0);
7491
7531
  __decorate([
7492
7532
  maskType(false)
7493
- ], exports.UI.prototype, "mask", undefined);
7533
+ ], exports.UI.prototype, "mask", void 0);
7494
7534
  __decorate([
7495
7535
  eraserType(false)
7496
- ], exports.UI.prototype, "eraser", undefined);
7536
+ ], exports.UI.prototype, "eraser", void 0);
7497
7537
  __decorate([
7498
7538
  positionType(0, true)
7499
- ], exports.UI.prototype, "x", undefined);
7539
+ ], exports.UI.prototype, "x", void 0);
7500
7540
  __decorate([
7501
7541
  positionType(0, true)
7502
- ], exports.UI.prototype, "y", undefined);
7542
+ ], exports.UI.prototype, "y", void 0);
7503
7543
  __decorate([
7504
7544
  boundsType(100, true)
7505
- ], exports.UI.prototype, "width", undefined);
7545
+ ], exports.UI.prototype, "width", void 0);
7506
7546
  __decorate([
7507
7547
  boundsType(100, true)
7508
- ], exports.UI.prototype, "height", undefined);
7548
+ ], exports.UI.prototype, "height", void 0);
7509
7549
  __decorate([
7510
7550
  scaleType(1, true)
7511
- ], exports.UI.prototype, "scaleX", undefined);
7551
+ ], exports.UI.prototype, "scaleX", void 0);
7512
7552
  __decorate([
7513
7553
  scaleType(1, true)
7514
- ], exports.UI.prototype, "scaleY", undefined);
7554
+ ], exports.UI.prototype, "scaleY", void 0);
7515
7555
  __decorate([
7516
7556
  rotationType(0, true)
7517
- ], exports.UI.prototype, "rotation", undefined);
7557
+ ], exports.UI.prototype, "rotation", void 0);
7518
7558
  __decorate([
7519
7559
  rotationType(0, true)
7520
- ], exports.UI.prototype, "skewX", undefined);
7560
+ ], exports.UI.prototype, "skewX", void 0);
7521
7561
  __decorate([
7522
7562
  rotationType(0, true)
7523
- ], exports.UI.prototype, "skewY", undefined);
7563
+ ], exports.UI.prototype, "skewY", void 0);
7524
7564
  __decorate([
7525
7565
  positionType(0, true)
7526
- ], exports.UI.prototype, "offsetX", undefined);
7566
+ ], exports.UI.prototype, "offsetX", void 0);
7527
7567
  __decorate([
7528
7568
  positionType(0, true)
7529
- ], exports.UI.prototype, "offsetY", undefined);
7569
+ ], exports.UI.prototype, "offsetY", void 0);
7530
7570
  __decorate([
7531
7571
  positionType(0, true)
7532
- ], exports.UI.prototype, "scrollX", undefined);
7572
+ ], exports.UI.prototype, "scrollX", void 0);
7533
7573
  __decorate([
7534
7574
  positionType(0, true)
7535
- ], exports.UI.prototype, "scrollY", undefined);
7575
+ ], exports.UI.prototype, "scrollY", void 0);
7536
7576
  __decorate([
7537
7577
  autoLayoutType()
7538
- ], exports.UI.prototype, "origin", undefined);
7578
+ ], exports.UI.prototype, "origin", void 0);
7539
7579
  __decorate([
7540
7580
  autoLayoutType()
7541
- ], exports.UI.prototype, "around", undefined);
7581
+ ], exports.UI.prototype, "around", void 0);
7542
7582
  __decorate([
7543
7583
  dataType(false)
7544
- ], exports.UI.prototype, "lazy", undefined);
7584
+ ], exports.UI.prototype, "lazy", void 0);
7545
7585
  __decorate([
7546
7586
  naturalBoundsType(1)
7547
- ], exports.UI.prototype, "pixelRatio", undefined);
7587
+ ], exports.UI.prototype, "pixelRatio", void 0);
7548
7588
  __decorate([
7549
7589
  pathInputType()
7550
- ], exports.UI.prototype, "path", undefined);
7590
+ ], exports.UI.prototype, "path", void 0);
7551
7591
  __decorate([
7552
7592
  pathType()
7553
- ], exports.UI.prototype, "windingRule", undefined);
7593
+ ], exports.UI.prototype, "windingRule", void 0);
7554
7594
  __decorate([
7555
7595
  pathType(true)
7556
- ], exports.UI.prototype, "closed", undefined);
7596
+ ], exports.UI.prototype, "closed", void 0);
7557
7597
  __decorate([
7558
7598
  boundsType(0)
7559
- ], exports.UI.prototype, "padding", undefined);
7599
+ ], exports.UI.prototype, "padding", void 0);
7560
7600
  __decorate([
7561
7601
  boundsType(false)
7562
- ], exports.UI.prototype, "lockRatio", undefined);
7602
+ ], exports.UI.prototype, "lockRatio", void 0);
7563
7603
  __decorate([
7564
7604
  boundsType()
7565
- ], exports.UI.prototype, "widthRange", undefined);
7605
+ ], exports.UI.prototype, "widthRange", void 0);
7566
7606
  __decorate([
7567
7607
  boundsType()
7568
- ], exports.UI.prototype, "heightRange", undefined);
7608
+ ], exports.UI.prototype, "heightRange", void 0);
7569
7609
  __decorate([
7570
7610
  dataType(false)
7571
- ], exports.UI.prototype, "draggable", undefined);
7611
+ ], exports.UI.prototype, "draggable", void 0);
7572
7612
  __decorate([
7573
7613
  dataType()
7574
- ], exports.UI.prototype, "dragBounds", undefined);
7614
+ ], exports.UI.prototype, "dragBounds", void 0);
7575
7615
  __decorate([
7576
7616
  dataType(false)
7577
- ], exports.UI.prototype, "editable", undefined);
7617
+ ], exports.UI.prototype, "editable", void 0);
7578
7618
  __decorate([
7579
7619
  hitType(true)
7580
- ], exports.UI.prototype, "hittable", undefined);
7620
+ ], exports.UI.prototype, "hittable", void 0);
7581
7621
  __decorate([
7582
7622
  hitType('path')
7583
- ], exports.UI.prototype, "hitFill", undefined);
7623
+ ], exports.UI.prototype, "hitFill", void 0);
7584
7624
  __decorate([
7585
7625
  strokeType('path')
7586
- ], exports.UI.prototype, "hitStroke", undefined);
7626
+ ], exports.UI.prototype, "hitStroke", void 0);
7587
7627
  __decorate([
7588
7628
  hitType(false)
7589
- ], exports.UI.prototype, "hitBox", undefined);
7629
+ ], exports.UI.prototype, "hitBox", void 0);
7590
7630
  __decorate([
7591
7631
  hitType(true)
7592
- ], exports.UI.prototype, "hitChildren", undefined);
7632
+ ], exports.UI.prototype, "hitChildren", void 0);
7593
7633
  __decorate([
7594
7634
  hitType(true)
7595
- ], exports.UI.prototype, "hitSelf", undefined);
7635
+ ], exports.UI.prototype, "hitSelf", void 0);
7596
7636
  __decorate([
7597
7637
  hitType()
7598
- ], exports.UI.prototype, "hitRadius", undefined);
7638
+ ], exports.UI.prototype, "hitRadius", void 0);
7599
7639
  __decorate([
7600
7640
  cursorType('')
7601
- ], exports.UI.prototype, "cursor", undefined);
7641
+ ], exports.UI.prototype, "cursor", void 0);
7602
7642
  __decorate([
7603
7643
  surfaceType()
7604
- ], exports.UI.prototype, "fill", undefined);
7644
+ ], exports.UI.prototype, "fill", void 0);
7605
7645
  __decorate([
7606
7646
  strokeType()
7607
- ], exports.UI.prototype, "stroke", undefined);
7647
+ ], exports.UI.prototype, "stroke", void 0);
7608
7648
  __decorate([
7609
7649
  strokeType('inside')
7610
- ], exports.UI.prototype, "strokeAlign", undefined);
7650
+ ], exports.UI.prototype, "strokeAlign", void 0);
7611
7651
  __decorate([
7612
7652
  strokeType(1)
7613
- ], exports.UI.prototype, "strokeWidth", undefined);
7653
+ ], exports.UI.prototype, "strokeWidth", void 0);
7614
7654
  __decorate([
7615
7655
  strokeType(false)
7616
- ], exports.UI.prototype, "strokeWidthFixed", undefined);
7656
+ ], exports.UI.prototype, "strokeWidthFixed", void 0);
7617
7657
  __decorate([
7618
7658
  strokeType('none')
7619
- ], exports.UI.prototype, "strokeCap", undefined);
7659
+ ], exports.UI.prototype, "strokeCap", void 0);
7620
7660
  __decorate([
7621
7661
  strokeType('miter')
7622
- ], exports.UI.prototype, "strokeJoin", undefined);
7662
+ ], exports.UI.prototype, "strokeJoin", void 0);
7623
7663
  __decorate([
7624
7664
  strokeType()
7625
- ], exports.UI.prototype, "dashPattern", undefined);
7665
+ ], exports.UI.prototype, "dashPattern", void 0);
7626
7666
  __decorate([
7627
7667
  strokeType()
7628
- ], exports.UI.prototype, "dashOffset", undefined);
7668
+ ], exports.UI.prototype, "dashOffset", void 0);
7629
7669
  __decorate([
7630
7670
  strokeType(10)
7631
- ], exports.UI.prototype, "miterLimit", undefined);
7671
+ ], exports.UI.prototype, "miterLimit", void 0);
7632
7672
  __decorate([
7633
7673
  pathType(0)
7634
- ], exports.UI.prototype, "cornerRadius", undefined);
7674
+ ], exports.UI.prototype, "cornerRadius", void 0);
7635
7675
  __decorate([
7636
7676
  pathType()
7637
- ], exports.UI.prototype, "cornerSmoothing", undefined);
7677
+ ], exports.UI.prototype, "cornerSmoothing", void 0);
7678
+ __decorate([
7679
+ effectType()
7680
+ ], exports.UI.prototype, "shadow", void 0);
7638
7681
  __decorate([
7639
7682
  effectType()
7640
- ], exports.UI.prototype, "shadow", undefined);
7683
+ ], exports.UI.prototype, "innerShadow", void 0);
7641
7684
  __decorate([
7642
7685
  effectType()
7643
- ], exports.UI.prototype, "innerShadow", undefined);
7686
+ ], exports.UI.prototype, "blur", void 0);
7644
7687
  __decorate([
7645
7688
  effectType()
7646
- ], exports.UI.prototype, "blur", undefined);
7689
+ ], exports.UI.prototype, "backgroundBlur", void 0);
7647
7690
  __decorate([
7648
7691
  effectType()
7649
- ], exports.UI.prototype, "backgroundBlur", undefined);
7692
+ ], exports.UI.prototype, "grayscale", void 0);
7650
7693
  __decorate([
7651
7694
  effectType()
7652
- ], exports.UI.prototype, "grayscale", undefined);
7695
+ ], exports.UI.prototype, "filter", void 0);
7653
7696
  __decorate([
7654
7697
  dataType({})
7655
- ], exports.UI.prototype, "data", undefined);
7698
+ ], exports.UI.prototype, "data", void 0);
7656
7699
  __decorate([
7657
7700
  rewrite(exports.Leaf.prototype.reset)
7658
7701
  ], exports.UI.prototype, "reset", null);
@@ -7713,7 +7756,7 @@ var LeaferUI = (function (exports) {
7713
7756
  };
7714
7757
  __decorate([
7715
7758
  dataProcessor(GroupData)
7716
- ], exports.Group.prototype, "__", undefined);
7759
+ ], exports.Group.prototype, "__", void 0);
7717
7760
  exports.Group = __decorate([
7718
7761
  useModule(exports.Branch),
7719
7762
  registerUI()
@@ -7726,7 +7769,7 @@ var LeaferUI = (function (exports) {
7726
7769
  get isApp() { return false; }
7727
7770
  get app() { return this.parent || this; }
7728
7771
  get isLeafer() { return true; }
7729
- get imageReady() { return this.viewReady && ImageManager.isComplete; }
7772
+ get imageReady() { return this.viewReady && Resource.isComplete; }
7730
7773
  get layoutLocked() { return !this.layouter.running; }
7731
7774
  get FPS() { return this.renderer ? this.renderer.FPS : 60; }
7732
7775
  get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
@@ -7937,13 +7980,13 @@ var LeaferUI = (function (exports) {
7937
7980
  WaitHelper.run(this.__viewReadyWait);
7938
7981
  }
7939
7982
  __onLayoutEnd() {
7940
- const { grow, growWidth, growHeight } = this.config;
7983
+ const { grow, width: fixedWidth, height: fixedHeight } = this.config;
7941
7984
  if (grow) {
7942
7985
  let { width, height, pixelRatio } = this;
7943
7986
  const bounds = grow === 'box' ? this.worldBoxBounds : this.__world;
7944
- if (growWidth !== false)
7987
+ if (!fixedWidth)
7945
7988
  width = Math.max(1, bounds.x + bounds.width);
7946
- if (growHeight !== false)
7989
+ if (!fixedHeight)
7947
7990
  height = Math.max(1, bounds.y + bounds.height);
7948
7991
  this.__doResize({ width, height, pixelRatio });
7949
7992
  }
@@ -8021,7 +8064,7 @@ var LeaferUI = (function (exports) {
8021
8064
  list.push(item);
8022
8065
  this.requestRender();
8023
8066
  }
8024
- zoom(_zoomType, _padding, _fixedScale) {
8067
+ zoom(_zoomType, _padding, _fixedScale, _transition) {
8025
8068
  return Plugin.need('view');
8026
8069
  }
8027
8070
  getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
@@ -8086,10 +8129,10 @@ var LeaferUI = (function (exports) {
8086
8129
  exports.Leafer.list = new LeafList();
8087
8130
  __decorate([
8088
8131
  dataProcessor(LeaferData)
8089
- ], exports.Leafer.prototype, "__", undefined);
8132
+ ], exports.Leafer.prototype, "__", void 0);
8090
8133
  __decorate([
8091
8134
  boundsType()
8092
- ], exports.Leafer.prototype, "pixelRatio", undefined);
8135
+ ], exports.Leafer.prototype, "pixelRatio", void 0);
8093
8136
  exports.Leafer = Leafer_1 = __decorate([
8094
8137
  registerUI()
8095
8138
  ], exports.Leafer);
@@ -8102,7 +8145,7 @@ var LeaferUI = (function (exports) {
8102
8145
  };
8103
8146
  __decorate([
8104
8147
  dataProcessor(RectData)
8105
- ], exports.Rect.prototype, "__", undefined);
8148
+ ], exports.Rect.prototype, "__", void 0);
8106
8149
  exports.Rect = __decorate([
8107
8150
  useModule(RectRender),
8108
8151
  rewriteAble(),
@@ -8193,13 +8236,13 @@ var LeaferUI = (function (exports) {
8193
8236
  };
8194
8237
  __decorate([
8195
8238
  dataProcessor(BoxData)
8196
- ], exports.Box.prototype, "__", undefined);
8239
+ ], exports.Box.prototype, "__", void 0);
8197
8240
  __decorate([
8198
8241
  dataType(false)
8199
- ], exports.Box.prototype, "resizeChildren", undefined);
8242
+ ], exports.Box.prototype, "resizeChildren", void 0);
8200
8243
  __decorate([
8201
8244
  affectRenderBoundsType('show')
8202
- ], exports.Box.prototype, "overflow", undefined);
8245
+ ], exports.Box.prototype, "overflow", void 0);
8203
8246
  __decorate([
8204
8247
  rewrite(rect.__updateStrokeSpread)
8205
8248
  ], exports.Box.prototype, "__updateStrokeSpread", null);
@@ -8238,13 +8281,13 @@ var LeaferUI = (function (exports) {
8238
8281
  };
8239
8282
  __decorate([
8240
8283
  dataProcessor(FrameData)
8241
- ], exports.Frame.prototype, "__", undefined);
8284
+ ], exports.Frame.prototype, "__", void 0);
8242
8285
  __decorate([
8243
8286
  surfaceType('#FFFFFF')
8244
- ], exports.Frame.prototype, "fill", undefined);
8287
+ ], exports.Frame.prototype, "fill", void 0);
8245
8288
  __decorate([
8246
8289
  affectRenderBoundsType('hide')
8247
- ], exports.Frame.prototype, "overflow", undefined);
8290
+ ], exports.Frame.prototype, "overflow", void 0);
8248
8291
  exports.Frame = __decorate([
8249
8292
  registerUI()
8250
8293
  ], exports.Frame);
@@ -8291,16 +8334,16 @@ var LeaferUI = (function (exports) {
8291
8334
  };
8292
8335
  __decorate([
8293
8336
  dataProcessor(EllipseData)
8294
- ], exports.Ellipse.prototype, "__", undefined);
8337
+ ], exports.Ellipse.prototype, "__", void 0);
8295
8338
  __decorate([
8296
8339
  pathType(0)
8297
- ], exports.Ellipse.prototype, "innerRadius", undefined);
8340
+ ], exports.Ellipse.prototype, "innerRadius", void 0);
8298
8341
  __decorate([
8299
8342
  pathType(0)
8300
- ], exports.Ellipse.prototype, "startAngle", undefined);
8343
+ ], exports.Ellipse.prototype, "startAngle", void 0);
8301
8344
  __decorate([
8302
8345
  pathType(0)
8303
- ], exports.Ellipse.prototype, "endAngle", undefined);
8346
+ ], exports.Ellipse.prototype, "endAngle", void 0);
8304
8347
  exports.Ellipse = __decorate([
8305
8348
  registerUI()
8306
8349
  ], exports.Ellipse);
@@ -8359,22 +8402,22 @@ var LeaferUI = (function (exports) {
8359
8402
  };
8360
8403
  __decorate([
8361
8404
  dataProcessor(LineData)
8362
- ], exports.Line.prototype, "__", undefined);
8405
+ ], exports.Line.prototype, "__", void 0);
8363
8406
  __decorate([
8364
8407
  affectStrokeBoundsType('center')
8365
- ], exports.Line.prototype, "strokeAlign", undefined);
8408
+ ], exports.Line.prototype, "strokeAlign", void 0);
8366
8409
  __decorate([
8367
8410
  boundsType(0)
8368
- ], exports.Line.prototype, "height", undefined);
8411
+ ], exports.Line.prototype, "height", void 0);
8369
8412
  __decorate([
8370
8413
  pathType()
8371
- ], exports.Line.prototype, "points", undefined);
8414
+ ], exports.Line.prototype, "points", void 0);
8372
8415
  __decorate([
8373
8416
  pathType(0)
8374
- ], exports.Line.prototype, "curve", undefined);
8417
+ ], exports.Line.prototype, "curve", void 0);
8375
8418
  __decorate([
8376
8419
  pathType(false)
8377
- ], exports.Line.prototype, "closed", undefined);
8420
+ ], exports.Line.prototype, "closed", void 0);
8378
8421
  exports.Line = __decorate([
8379
8422
  registerUI()
8380
8423
  ], exports.Line);
@@ -8407,16 +8450,16 @@ var LeaferUI = (function (exports) {
8407
8450
  };
8408
8451
  __decorate([
8409
8452
  dataProcessor(PolygonData)
8410
- ], exports.Polygon.prototype, "__", undefined);
8453
+ ], exports.Polygon.prototype, "__", void 0);
8411
8454
  __decorate([
8412
8455
  pathType(3)
8413
- ], exports.Polygon.prototype, "sides", undefined);
8456
+ ], exports.Polygon.prototype, "sides", void 0);
8414
8457
  __decorate([
8415
8458
  pathType()
8416
- ], exports.Polygon.prototype, "points", undefined);
8459
+ ], exports.Polygon.prototype, "points", void 0);
8417
8460
  __decorate([
8418
8461
  pathType(0)
8419
- ], exports.Polygon.prototype, "curve", undefined);
8462
+ ], exports.Polygon.prototype, "curve", void 0);
8420
8463
  __decorate([
8421
8464
  rewrite(line.__updateRenderPath)
8422
8465
  ], exports.Polygon.prototype, "__updateRenderPath", null);
@@ -8448,13 +8491,13 @@ var LeaferUI = (function (exports) {
8448
8491
  };
8449
8492
  __decorate([
8450
8493
  dataProcessor(StarData)
8451
- ], exports.Star.prototype, "__", undefined);
8494
+ ], exports.Star.prototype, "__", void 0);
8452
8495
  __decorate([
8453
8496
  pathType(5)
8454
- ], exports.Star.prototype, "corners", undefined);
8497
+ ], exports.Star.prototype, "corners", void 0);
8455
8498
  __decorate([
8456
8499
  pathType(0.382)
8457
- ], exports.Star.prototype, "innerRadius", undefined);
8500
+ ], exports.Star.prototype, "innerRadius", void 0);
8458
8501
  exports.Star = __decorate([
8459
8502
  registerUI()
8460
8503
  ], exports.Star);
@@ -8476,10 +8519,10 @@ var LeaferUI = (function (exports) {
8476
8519
  };
8477
8520
  __decorate([
8478
8521
  dataProcessor(ImageData)
8479
- ], exports.Image.prototype, "__", undefined);
8522
+ ], exports.Image.prototype, "__", void 0);
8480
8523
  __decorate([
8481
8524
  boundsType('')
8482
- ], exports.Image.prototype, "url", undefined);
8525
+ ], exports.Image.prototype, "url", void 0);
8483
8526
  exports.Image = __decorate([
8484
8527
  registerUI()
8485
8528
  ], exports.Image);
@@ -8542,25 +8585,25 @@ var LeaferUI = (function (exports) {
8542
8585
  };
8543
8586
  __decorate([
8544
8587
  dataProcessor(CanvasData)
8545
- ], exports.Canvas.prototype, "__", undefined);
8588
+ ], exports.Canvas.prototype, "__", void 0);
8546
8589
  __decorate([
8547
8590
  resizeType(100)
8548
- ], exports.Canvas.prototype, "width", undefined);
8591
+ ], exports.Canvas.prototype, "width", void 0);
8549
8592
  __decorate([
8550
8593
  resizeType(100)
8551
- ], exports.Canvas.prototype, "height", undefined);
8594
+ ], exports.Canvas.prototype, "height", void 0);
8552
8595
  __decorate([
8553
8596
  resizeType(1)
8554
- ], exports.Canvas.prototype, "pixelRatio", undefined);
8597
+ ], exports.Canvas.prototype, "pixelRatio", void 0);
8555
8598
  __decorate([
8556
8599
  resizeType(true)
8557
- ], exports.Canvas.prototype, "smooth", undefined);
8600
+ ], exports.Canvas.prototype, "smooth", void 0);
8558
8601
  __decorate([
8559
8602
  dataType(false)
8560
- ], exports.Canvas.prototype, "safeResize", undefined);
8603
+ ], exports.Canvas.prototype, "safeResize", void 0);
8561
8604
  __decorate([
8562
8605
  resizeType()
8563
- ], exports.Canvas.prototype, "contextSettings", undefined);
8606
+ ], exports.Canvas.prototype, "contextSettings", void 0);
8564
8607
  exports.Canvas = __decorate([
8565
8608
  registerUI()
8566
8609
  ], exports.Canvas);
@@ -8651,76 +8694,76 @@ var LeaferUI = (function (exports) {
8651
8694
  };
8652
8695
  __decorate([
8653
8696
  dataProcessor(TextData)
8654
- ], exports.Text.prototype, "__", undefined);
8697
+ ], exports.Text.prototype, "__", void 0);
8655
8698
  __decorate([
8656
8699
  boundsType(0)
8657
- ], exports.Text.prototype, "width", undefined);
8700
+ ], exports.Text.prototype, "width", void 0);
8658
8701
  __decorate([
8659
8702
  boundsType(0)
8660
- ], exports.Text.prototype, "height", undefined);
8703
+ ], exports.Text.prototype, "height", void 0);
8661
8704
  __decorate([
8662
8705
  dataType(false)
8663
- ], exports.Text.prototype, "resizeFontSize", undefined);
8706
+ ], exports.Text.prototype, "resizeFontSize", void 0);
8664
8707
  __decorate([
8665
8708
  surfaceType('#000000')
8666
- ], exports.Text.prototype, "fill", undefined);
8709
+ ], exports.Text.prototype, "fill", void 0);
8667
8710
  __decorate([
8668
8711
  affectStrokeBoundsType('outside')
8669
- ], exports.Text.prototype, "strokeAlign", undefined);
8712
+ ], exports.Text.prototype, "strokeAlign", void 0);
8670
8713
  __decorate([
8671
8714
  hitType('all')
8672
- ], exports.Text.prototype, "hitFill", undefined);
8715
+ ], exports.Text.prototype, "hitFill", void 0);
8673
8716
  __decorate([
8674
8717
  boundsType('')
8675
- ], exports.Text.prototype, "text", undefined);
8718
+ ], exports.Text.prototype, "text", void 0);
8676
8719
  __decorate([
8677
8720
  boundsType('caption')
8678
- ], exports.Text.prototype, "fontFamily", undefined);
8721
+ ], exports.Text.prototype, "fontFamily", void 0);
8679
8722
  __decorate([
8680
8723
  boundsType(12)
8681
- ], exports.Text.prototype, "fontSize", undefined);
8724
+ ], exports.Text.prototype, "fontSize", void 0);
8682
8725
  __decorate([
8683
8726
  boundsType('normal')
8684
- ], exports.Text.prototype, "fontWeight", undefined);
8727
+ ], exports.Text.prototype, "fontWeight", void 0);
8685
8728
  __decorate([
8686
8729
  boundsType(false)
8687
- ], exports.Text.prototype, "italic", undefined);
8730
+ ], exports.Text.prototype, "italic", void 0);
8688
8731
  __decorate([
8689
8732
  boundsType('none')
8690
- ], exports.Text.prototype, "textCase", undefined);
8733
+ ], exports.Text.prototype, "textCase", void 0);
8691
8734
  __decorate([
8692
8735
  boundsType('none')
8693
- ], exports.Text.prototype, "textDecoration", undefined);
8736
+ ], exports.Text.prototype, "textDecoration", void 0);
8694
8737
  __decorate([
8695
8738
  boundsType(0)
8696
- ], exports.Text.prototype, "letterSpacing", undefined);
8739
+ ], exports.Text.prototype, "letterSpacing", void 0);
8697
8740
  __decorate([
8698
8741
  boundsType({ type: 'percent', value: 1.5 })
8699
- ], exports.Text.prototype, "lineHeight", undefined);
8742
+ ], exports.Text.prototype, "lineHeight", void 0);
8700
8743
  __decorate([
8701
8744
  boundsType(0)
8702
- ], exports.Text.prototype, "paraIndent", undefined);
8745
+ ], exports.Text.prototype, "paraIndent", void 0);
8703
8746
  __decorate([
8704
8747
  boundsType(0)
8705
- ], exports.Text.prototype, "paraSpacing", undefined);
8748
+ ], exports.Text.prototype, "paraSpacing", void 0);
8706
8749
  __decorate([
8707
8750
  boundsType('x')
8708
- ], exports.Text.prototype, "writingMode", undefined);
8751
+ ], exports.Text.prototype, "writingMode", void 0);
8709
8752
  __decorate([
8710
8753
  boundsType('left')
8711
- ], exports.Text.prototype, "textAlign", undefined);
8754
+ ], exports.Text.prototype, "textAlign", void 0);
8712
8755
  __decorate([
8713
8756
  boundsType('top')
8714
- ], exports.Text.prototype, "verticalAlign", undefined);
8757
+ ], exports.Text.prototype, "verticalAlign", void 0);
8715
8758
  __decorate([
8716
8759
  boundsType(true)
8717
- ], exports.Text.prototype, "autoSizeAlign", undefined);
8760
+ ], exports.Text.prototype, "autoSizeAlign", void 0);
8718
8761
  __decorate([
8719
8762
  boundsType('normal')
8720
- ], exports.Text.prototype, "textWrap", undefined);
8763
+ ], exports.Text.prototype, "textWrap", void 0);
8721
8764
  __decorate([
8722
8765
  boundsType('show')
8723
- ], exports.Text.prototype, "textOverflow", undefined);
8766
+ ], exports.Text.prototype, "textOverflow", void 0);
8724
8767
  exports.Text = __decorate([
8725
8768
  registerUI()
8726
8769
  ], exports.Text);
@@ -8733,10 +8776,10 @@ var LeaferUI = (function (exports) {
8733
8776
  };
8734
8777
  __decorate([
8735
8778
  dataProcessor(PathData)
8736
- ], exports.Path.prototype, "__", undefined);
8779
+ ], exports.Path.prototype, "__", void 0);
8737
8780
  __decorate([
8738
8781
  affectStrokeBoundsType('center')
8739
- ], exports.Path.prototype, "strokeAlign", undefined);
8782
+ ], exports.Path.prototype, "strokeAlign", void 0);
8740
8783
  exports.Path = __decorate([
8741
8784
  registerUI()
8742
8785
  ], exports.Path);
@@ -8775,10 +8818,10 @@ var LeaferUI = (function (exports) {
8775
8818
  };
8776
8819
  __decorate([
8777
8820
  dataProcessor(PenData)
8778
- ], exports.Pen.prototype, "__", undefined);
8821
+ ], exports.Pen.prototype, "__", void 0);
8779
8822
  __decorate([
8780
8823
  penPathType()
8781
- ], exports.Pen.prototype, "path", undefined);
8824
+ ], exports.Pen.prototype, "path", void 0);
8782
8825
  exports.Pen = __decorate([
8783
8826
  useModule(PathCreator, ['set', 'path', 'paint']),
8784
8827
  registerUI()
@@ -9150,7 +9193,7 @@ var LeaferUI = (function (exports) {
9150
9193
  box = tempBox.set(box).shrink(paint.padding);
9151
9194
  if (paint.mode === 'strench')
9152
9195
  paint.mode = 'stretch';
9153
- const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
9196
+ const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
9154
9197
  const sameBox = box.width === width && box.height === height;
9155
9198
  const data = { mode };
9156
9199
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -9213,6 +9256,8 @@ var LeaferUI = (function (exports) {
9213
9256
  data.height = height;
9214
9257
  if (opacity)
9215
9258
  data.opacity = opacity;
9259
+ if (filters)
9260
+ data.filters = filters;
9216
9261
  if (repeat)
9217
9262
  data.repeat = typeof repeat === 'string' ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat';
9218
9263
  return data;
@@ -9315,7 +9360,7 @@ var LeaferUI = (function (exports) {
9315
9360
  scaleX = abs$1(scaleX);
9316
9361
  scaleY = abs$1(scaleY);
9317
9362
  const { image, data } = paint;
9318
- let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform, repeat } = data;
9363
+ let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
9319
9364
  if (sx) {
9320
9365
  imageMatrix = get$1();
9321
9366
  copy$1(imageMatrix, transform);
@@ -9358,7 +9403,7 @@ var LeaferUI = (function (exports) {
9358
9403
  }
9359
9404
  scale(imageMatrix, 1 / scaleX, 1 / scaleY);
9360
9405
  }
9361
- const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, opacity);
9406
+ const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, data.opacity, data.filters);
9362
9407
  const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || 'no-repeat'), imageMatrix, paint);
9363
9408
  paint.style = pattern;
9364
9409
  paint.patternId = id;
@@ -9402,7 +9447,7 @@ var LeaferUI = (function (exports) {
9402
9447
  canvas.opacity *= data.opacity;
9403
9448
  if (data.transform)
9404
9449
  canvas.transform(data.transform);
9405
- canvas.drawImage(paint.image.view, 0, 0, data.width, data.height);
9450
+ canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height);
9406
9451
  canvas.restore();
9407
9452
  return true;
9408
9453
  }
@@ -9412,7 +9457,7 @@ var LeaferUI = (function (exports) {
9412
9457
  }
9413
9458
  else {
9414
9459
  if (!paint.patternTask) {
9415
- paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, undefined, undefined, function* () {
9460
+ paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
9416
9461
  paint.patternTask = null;
9417
9462
  if (canvas.bounds.hit(ui.__nowWorld))
9418
9463
  createPattern(ui, paint, pixelRatio);
@@ -10303,6 +10348,7 @@ var LeaferUI = (function (exports) {
10303
10348
  exports.Eventer = Eventer;
10304
10349
  exports.Export = Export;
10305
10350
  exports.FileHelper = FileHelper;
10351
+ exports.Filter = Filter;
10306
10352
  exports.FrameData = FrameData;
10307
10353
  exports.GroupData = GroupData;
10308
10354
  exports.ImageData = ImageData;
@@ -10364,6 +10410,7 @@ var LeaferUI = (function (exports) {
10364
10410
  exports.RenderEvent = RenderEvent;
10365
10411
  exports.Renderer = Renderer;
10366
10412
  exports.ResizeEvent = ResizeEvent;
10413
+ exports.Resource = Resource;
10367
10414
  exports.Run = Run;
10368
10415
  exports.StarData = StarData;
10369
10416
  exports.State = State;