@leafer-ui/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$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$3, 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$8, 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,58 @@ 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
+ 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$1.tasker.isComplete; },
3635
3675
  get(config) {
3636
- let image = I$1.map[config.url];
3637
- if (!image) {
3638
- image = Creator.image(config);
3639
- I$1.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$1.recycledList;
3651
- if (list.length > 100) {
3652
- list.forEach(image => {
3653
- if (!image.use && image.url) {
3654
- delete I$1.map[image.url];
3655
- image.destroy();
3656
- }
3657
- });
3689
+ if (list.length > I$1.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$1.map = {};
3682
3714
  I$1.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;
@@ -6825,9 +6865,10 @@ var LeaferUI = (function (exports) {
6825
6865
  this.finder = Creator.finder && Creator.finder();
6826
6866
  }
6827
6867
  getByPoint(hitPoint, hitRadius, options) {
6828
- if (Platform.backgrounder && this.target)
6829
- this.target.updateLayout();
6830
- return this.picker.getByPoint(hitPoint, hitRadius, options);
6868
+ const { target, picker } = this;
6869
+ if (Platform.backgrounder)
6870
+ target && target.updateLayout();
6871
+ return picker.getByPoint(hitPoint, hitRadius, options);
6831
6872
  }
6832
6873
  getBy(condition, branch, one, options) {
6833
6874
  return this.finder ? this.finder.getBy(condition, branch, one, options) : Plugin.need('find');
@@ -6885,9 +6926,7 @@ var LeaferUI = (function (exports) {
6885
6926
  const ColorConvert = {};
6886
6927
  const UnitConvert = {
6887
6928
  number(value, percentRefer) {
6888
- if (typeof value === 'object')
6889
- return value.type === 'percent' ? value.value * percentRefer : value.value;
6890
- return value;
6929
+ return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
6891
6930
  }
6892
6931
  };
6893
6932
  const PathArrow = {};
@@ -6895,16 +6934,15 @@ var LeaferUI = (function (exports) {
6895
6934
  const PaintImage = {};
6896
6935
  const PaintGradient = {};
6897
6936
  const Effect = {};
6937
+ const Filter = {
6938
+ apply() { Plugin.need('filter'); }
6939
+ };
6898
6940
  const Export = {};
6899
6941
  const State = {
6900
- setStyleName(_leaf, _styleName, _value) { return Plugin.need('state'); },
6901
- set(_leaf, _stateName) { return Plugin.need('state'); }
6902
- };
6903
- const Transition = {
6904
- list: {},
6905
- register(attrName, fn) { Transition.list[attrName] = fn; },
6906
- get(attrName) { return Transition.list[attrName]; }
6942
+ setStyleName() { return Plugin.need('state'); },
6943
+ set() { return Plugin.need('state'); }
6907
6944
  };
6945
+ const Transition = {};
6908
6946
 
6909
6947
  const { parse, objectToCanvasData } = PathConvert;
6910
6948
  const emptyPaint = {};
@@ -7011,24 +7049,13 @@ var LeaferUI = (function (exports) {
7011
7049
  }
7012
7050
  }
7013
7051
  setShadow(value) {
7014
- this.__setInput('shadow', value);
7015
- if (value instanceof Array) {
7016
- if (value.some((item) => item.visible === false))
7017
- value = value.filter((item) => item.visible !== false);
7018
- this._shadow = value.length ? value : null;
7019
- }
7020
- else
7021
- this._shadow = value && value.visible !== false ? [value] : null;
7052
+ setArray(this, 'shadow', value);
7022
7053
  }
7023
7054
  setInnerShadow(value) {
7024
- this.__setInput('innerShadow', value);
7025
- if (value instanceof Array) {
7026
- if (value.some((item) => item.visible === false))
7027
- value = value.filter((item) => item.visible !== false);
7028
- this._innerShadow = value.length ? value : null;
7029
- }
7030
- else
7031
- this._innerShadow = value && value.visible !== false ? [value] : null;
7055
+ setArray(this, 'innerShadow', value);
7056
+ }
7057
+ setFilter(value) {
7058
+ setArray(this, 'filter', value);
7032
7059
  }
7033
7060
  __computePaint() {
7034
7061
  const { fill, stroke } = this.__input;
@@ -7039,6 +7066,17 @@ var LeaferUI = (function (exports) {
7039
7066
  this.__needComputePaint = false;
7040
7067
  }
7041
7068
  }
7069
+ function setArray(data, key, value) {
7070
+ data.__setInput(key, value);
7071
+ if (value instanceof Array) {
7072
+ if (value.some((item) => item.visible === false))
7073
+ value = value.filter((item) => item.visible !== false);
7074
+ value.length || (value = null);
7075
+ }
7076
+ else
7077
+ value = value && value.visible !== false ? [value] : null;
7078
+ data['_' + key] = value;
7079
+ }
7042
7080
 
7043
7081
  class GroupData extends UIData {
7044
7082
  }
@@ -7161,11 +7199,13 @@ var LeaferUI = (function (exports) {
7161
7199
  },
7162
7200
  __updateRenderSpread() {
7163
7201
  let width = 0;
7164
- const { shadow, innerShadow, blur, backgroundBlur } = this.__;
7202
+ const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
7165
7203
  if (shadow)
7166
7204
  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));
7167
7205
  if (blur)
7168
7206
  width = Math.max(width, blur);
7207
+ if (filter)
7208
+ width += Filter.getSpread(filter);
7169
7209
  let shapeWidth = width = Math.ceil(width);
7170
7210
  if (innerShadow)
7171
7211
  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));
@@ -7180,8 +7220,8 @@ var LeaferUI = (function (exports) {
7180
7220
  __updateChange() {
7181
7221
  const data = this.__;
7182
7222
  if (data.__useEffect) {
7183
- const { shadow, innerShadow, blur, backgroundBlur } = this.__;
7184
- data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur);
7223
+ const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
7224
+ data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur || filter);
7185
7225
  }
7186
7226
  data.__checkSingle();
7187
7227
  const complex = data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect;
@@ -7195,7 +7235,7 @@ var LeaferUI = (function (exports) {
7195
7235
  __drawFast(canvas, options) {
7196
7236
  drawFast(this, canvas, options);
7197
7237
  },
7198
- __draw(canvas, options) {
7238
+ __draw(canvas, options, originCanvas) {
7199
7239
  const data = this.__;
7200
7240
  if (data.__complex) {
7201
7241
  if (data.__needComputePaint)
@@ -7205,7 +7245,7 @@ var LeaferUI = (function (exports) {
7205
7245
  if (data.__useEffect) {
7206
7246
  const shape = Paint.shape(this, canvas, options);
7207
7247
  this.__nowWorld = this.__getNowWorld(options);
7208
- const { shadow, innerShadow } = data;
7248
+ const { shadow, innerShadow, filter } = data;
7209
7249
  if (shadow)
7210
7250
  Effect.shadow(this, canvas, shape);
7211
7251
  if (fill)
@@ -7216,6 +7256,8 @@ var LeaferUI = (function (exports) {
7216
7256
  Effect.innerShadow(this, canvas, shape);
7217
7257
  if (stroke)
7218
7258
  data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
7259
+ if (filter)
7260
+ Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
7219
7261
  if (shape.worldCanvas)
7220
7262
  shape.worldCanvas.recycle();
7221
7263
  shape.canvas.recycle();
@@ -7435,199 +7477,202 @@ var LeaferUI = (function (exports) {
7435
7477
  };
7436
7478
  __decorate([
7437
7479
  dataProcessor(UIData)
7438
- ], exports.UI.prototype, "__", undefined);
7480
+ ], exports.UI.prototype, "__", void 0);
7439
7481
  __decorate([
7440
7482
  zoomLayerType()
7441
- ], exports.UI.prototype, "zoomLayer", undefined);
7483
+ ], exports.UI.prototype, "zoomLayer", void 0);
7442
7484
  __decorate([
7443
7485
  dataType('')
7444
- ], exports.UI.prototype, "id", undefined);
7486
+ ], exports.UI.prototype, "id", void 0);
7445
7487
  __decorate([
7446
7488
  dataType('')
7447
- ], exports.UI.prototype, "name", undefined);
7489
+ ], exports.UI.prototype, "name", void 0);
7448
7490
  __decorate([
7449
7491
  dataType('')
7450
- ], exports.UI.prototype, "className", undefined);
7492
+ ], exports.UI.prototype, "className", void 0);
7451
7493
  __decorate([
7452
7494
  surfaceType('pass-through')
7453
- ], exports.UI.prototype, "blendMode", undefined);
7495
+ ], exports.UI.prototype, "blendMode", void 0);
7454
7496
  __decorate([
7455
7497
  opacityType(1)
7456
- ], exports.UI.prototype, "opacity", undefined);
7498
+ ], exports.UI.prototype, "opacity", void 0);
7457
7499
  __decorate([
7458
7500
  visibleType(true)
7459
- ], exports.UI.prototype, "visible", undefined);
7501
+ ], exports.UI.prototype, "visible", void 0);
7460
7502
  __decorate([
7461
7503
  surfaceType(false)
7462
- ], exports.UI.prototype, "locked", undefined);
7504
+ ], exports.UI.prototype, "locked", void 0);
7463
7505
  __decorate([
7464
7506
  sortType(0)
7465
- ], exports.UI.prototype, "zIndex", undefined);
7507
+ ], exports.UI.prototype, "zIndex", void 0);
7466
7508
  __decorate([
7467
7509
  maskType(false)
7468
- ], exports.UI.prototype, "mask", undefined);
7510
+ ], exports.UI.prototype, "mask", void 0);
7469
7511
  __decorate([
7470
7512
  eraserType(false)
7471
- ], exports.UI.prototype, "eraser", undefined);
7513
+ ], exports.UI.prototype, "eraser", void 0);
7472
7514
  __decorate([
7473
7515
  positionType(0, true)
7474
- ], exports.UI.prototype, "x", undefined);
7516
+ ], exports.UI.prototype, "x", void 0);
7475
7517
  __decorate([
7476
7518
  positionType(0, true)
7477
- ], exports.UI.prototype, "y", undefined);
7519
+ ], exports.UI.prototype, "y", void 0);
7478
7520
  __decorate([
7479
7521
  boundsType(100, true)
7480
- ], exports.UI.prototype, "width", undefined);
7522
+ ], exports.UI.prototype, "width", void 0);
7481
7523
  __decorate([
7482
7524
  boundsType(100, true)
7483
- ], exports.UI.prototype, "height", undefined);
7525
+ ], exports.UI.prototype, "height", void 0);
7484
7526
  __decorate([
7485
7527
  scaleType(1, true)
7486
- ], exports.UI.prototype, "scaleX", undefined);
7528
+ ], exports.UI.prototype, "scaleX", void 0);
7487
7529
  __decorate([
7488
7530
  scaleType(1, true)
7489
- ], exports.UI.prototype, "scaleY", undefined);
7531
+ ], exports.UI.prototype, "scaleY", void 0);
7490
7532
  __decorate([
7491
7533
  rotationType(0, true)
7492
- ], exports.UI.prototype, "rotation", undefined);
7534
+ ], exports.UI.prototype, "rotation", void 0);
7493
7535
  __decorate([
7494
7536
  rotationType(0, true)
7495
- ], exports.UI.prototype, "skewX", undefined);
7537
+ ], exports.UI.prototype, "skewX", void 0);
7496
7538
  __decorate([
7497
7539
  rotationType(0, true)
7498
- ], exports.UI.prototype, "skewY", undefined);
7540
+ ], exports.UI.prototype, "skewY", void 0);
7499
7541
  __decorate([
7500
7542
  positionType(0, true)
7501
- ], exports.UI.prototype, "offsetX", undefined);
7543
+ ], exports.UI.prototype, "offsetX", void 0);
7502
7544
  __decorate([
7503
7545
  positionType(0, true)
7504
- ], exports.UI.prototype, "offsetY", undefined);
7546
+ ], exports.UI.prototype, "offsetY", void 0);
7505
7547
  __decorate([
7506
7548
  positionType(0, true)
7507
- ], exports.UI.prototype, "scrollX", undefined);
7549
+ ], exports.UI.prototype, "scrollX", void 0);
7508
7550
  __decorate([
7509
7551
  positionType(0, true)
7510
- ], exports.UI.prototype, "scrollY", undefined);
7552
+ ], exports.UI.prototype, "scrollY", void 0);
7511
7553
  __decorate([
7512
7554
  autoLayoutType()
7513
- ], exports.UI.prototype, "origin", undefined);
7555
+ ], exports.UI.prototype, "origin", void 0);
7514
7556
  __decorate([
7515
7557
  autoLayoutType()
7516
- ], exports.UI.prototype, "around", undefined);
7558
+ ], exports.UI.prototype, "around", void 0);
7517
7559
  __decorate([
7518
7560
  dataType(false)
7519
- ], exports.UI.prototype, "lazy", undefined);
7561
+ ], exports.UI.prototype, "lazy", void 0);
7520
7562
  __decorate([
7521
7563
  naturalBoundsType(1)
7522
- ], exports.UI.prototype, "pixelRatio", undefined);
7564
+ ], exports.UI.prototype, "pixelRatio", void 0);
7523
7565
  __decorate([
7524
7566
  pathInputType()
7525
- ], exports.UI.prototype, "path", undefined);
7567
+ ], exports.UI.prototype, "path", void 0);
7526
7568
  __decorate([
7527
7569
  pathType()
7528
- ], exports.UI.prototype, "windingRule", undefined);
7570
+ ], exports.UI.prototype, "windingRule", void 0);
7529
7571
  __decorate([
7530
7572
  pathType(true)
7531
- ], exports.UI.prototype, "closed", undefined);
7573
+ ], exports.UI.prototype, "closed", void 0);
7532
7574
  __decorate([
7533
7575
  boundsType(0)
7534
- ], exports.UI.prototype, "padding", undefined);
7576
+ ], exports.UI.prototype, "padding", void 0);
7535
7577
  __decorate([
7536
7578
  boundsType(false)
7537
- ], exports.UI.prototype, "lockRatio", undefined);
7579
+ ], exports.UI.prototype, "lockRatio", void 0);
7538
7580
  __decorate([
7539
7581
  boundsType()
7540
- ], exports.UI.prototype, "widthRange", undefined);
7582
+ ], exports.UI.prototype, "widthRange", void 0);
7541
7583
  __decorate([
7542
7584
  boundsType()
7543
- ], exports.UI.prototype, "heightRange", undefined);
7585
+ ], exports.UI.prototype, "heightRange", void 0);
7544
7586
  __decorate([
7545
7587
  dataType(false)
7546
- ], exports.UI.prototype, "draggable", undefined);
7588
+ ], exports.UI.prototype, "draggable", void 0);
7547
7589
  __decorate([
7548
7590
  dataType()
7549
- ], exports.UI.prototype, "dragBounds", undefined);
7591
+ ], exports.UI.prototype, "dragBounds", void 0);
7550
7592
  __decorate([
7551
7593
  dataType(false)
7552
- ], exports.UI.prototype, "editable", undefined);
7594
+ ], exports.UI.prototype, "editable", void 0);
7553
7595
  __decorate([
7554
7596
  hitType(true)
7555
- ], exports.UI.prototype, "hittable", undefined);
7597
+ ], exports.UI.prototype, "hittable", void 0);
7556
7598
  __decorate([
7557
7599
  hitType('path')
7558
- ], exports.UI.prototype, "hitFill", undefined);
7600
+ ], exports.UI.prototype, "hitFill", void 0);
7559
7601
  __decorate([
7560
7602
  strokeType('path')
7561
- ], exports.UI.prototype, "hitStroke", undefined);
7603
+ ], exports.UI.prototype, "hitStroke", void 0);
7562
7604
  __decorate([
7563
7605
  hitType(false)
7564
- ], exports.UI.prototype, "hitBox", undefined);
7606
+ ], exports.UI.prototype, "hitBox", void 0);
7565
7607
  __decorate([
7566
7608
  hitType(true)
7567
- ], exports.UI.prototype, "hitChildren", undefined);
7609
+ ], exports.UI.prototype, "hitChildren", void 0);
7568
7610
  __decorate([
7569
7611
  hitType(true)
7570
- ], exports.UI.prototype, "hitSelf", undefined);
7612
+ ], exports.UI.prototype, "hitSelf", void 0);
7571
7613
  __decorate([
7572
7614
  hitType()
7573
- ], exports.UI.prototype, "hitRadius", undefined);
7615
+ ], exports.UI.prototype, "hitRadius", void 0);
7574
7616
  __decorate([
7575
7617
  cursorType('')
7576
- ], exports.UI.prototype, "cursor", undefined);
7618
+ ], exports.UI.prototype, "cursor", void 0);
7577
7619
  __decorate([
7578
7620
  surfaceType()
7579
- ], exports.UI.prototype, "fill", undefined);
7621
+ ], exports.UI.prototype, "fill", void 0);
7580
7622
  __decorate([
7581
7623
  strokeType()
7582
- ], exports.UI.prototype, "stroke", undefined);
7624
+ ], exports.UI.prototype, "stroke", void 0);
7583
7625
  __decorate([
7584
7626
  strokeType('inside')
7585
- ], exports.UI.prototype, "strokeAlign", undefined);
7627
+ ], exports.UI.prototype, "strokeAlign", void 0);
7586
7628
  __decorate([
7587
7629
  strokeType(1)
7588
- ], exports.UI.prototype, "strokeWidth", undefined);
7630
+ ], exports.UI.prototype, "strokeWidth", void 0);
7589
7631
  __decorate([
7590
7632
  strokeType(false)
7591
- ], exports.UI.prototype, "strokeWidthFixed", undefined);
7633
+ ], exports.UI.prototype, "strokeWidthFixed", void 0);
7592
7634
  __decorate([
7593
7635
  strokeType('none')
7594
- ], exports.UI.prototype, "strokeCap", undefined);
7636
+ ], exports.UI.prototype, "strokeCap", void 0);
7595
7637
  __decorate([
7596
7638
  strokeType('miter')
7597
- ], exports.UI.prototype, "strokeJoin", undefined);
7639
+ ], exports.UI.prototype, "strokeJoin", void 0);
7598
7640
  __decorate([
7599
7641
  strokeType()
7600
- ], exports.UI.prototype, "dashPattern", undefined);
7642
+ ], exports.UI.prototype, "dashPattern", void 0);
7601
7643
  __decorate([
7602
7644
  strokeType()
7603
- ], exports.UI.prototype, "dashOffset", undefined);
7645
+ ], exports.UI.prototype, "dashOffset", void 0);
7604
7646
  __decorate([
7605
7647
  strokeType(10)
7606
- ], exports.UI.prototype, "miterLimit", undefined);
7648
+ ], exports.UI.prototype, "miterLimit", void 0);
7607
7649
  __decorate([
7608
7650
  pathType(0)
7609
- ], exports.UI.prototype, "cornerRadius", undefined);
7651
+ ], exports.UI.prototype, "cornerRadius", void 0);
7610
7652
  __decorate([
7611
7653
  pathType()
7612
- ], exports.UI.prototype, "cornerSmoothing", undefined);
7654
+ ], exports.UI.prototype, "cornerSmoothing", void 0);
7655
+ __decorate([
7656
+ effectType()
7657
+ ], exports.UI.prototype, "shadow", void 0);
7613
7658
  __decorate([
7614
7659
  effectType()
7615
- ], exports.UI.prototype, "shadow", undefined);
7660
+ ], exports.UI.prototype, "innerShadow", void 0);
7616
7661
  __decorate([
7617
7662
  effectType()
7618
- ], exports.UI.prototype, "innerShadow", undefined);
7663
+ ], exports.UI.prototype, "blur", void 0);
7619
7664
  __decorate([
7620
7665
  effectType()
7621
- ], exports.UI.prototype, "blur", undefined);
7666
+ ], exports.UI.prototype, "backgroundBlur", void 0);
7622
7667
  __decorate([
7623
7668
  effectType()
7624
- ], exports.UI.prototype, "backgroundBlur", undefined);
7669
+ ], exports.UI.prototype, "grayscale", void 0);
7625
7670
  __decorate([
7626
7671
  effectType()
7627
- ], exports.UI.prototype, "grayscale", undefined);
7672
+ ], exports.UI.prototype, "filter", void 0);
7628
7673
  __decorate([
7629
7674
  dataType({})
7630
- ], exports.UI.prototype, "data", undefined);
7675
+ ], exports.UI.prototype, "data", void 0);
7631
7676
  __decorate([
7632
7677
  rewrite(exports.Leaf.prototype.reset)
7633
7678
  ], exports.UI.prototype, "reset", null);
@@ -7688,7 +7733,7 @@ var LeaferUI = (function (exports) {
7688
7733
  };
7689
7734
  __decorate([
7690
7735
  dataProcessor(GroupData)
7691
- ], exports.Group.prototype, "__", undefined);
7736
+ ], exports.Group.prototype, "__", void 0);
7692
7737
  exports.Group = __decorate([
7693
7738
  useModule(exports.Branch),
7694
7739
  registerUI()
@@ -7701,7 +7746,7 @@ var LeaferUI = (function (exports) {
7701
7746
  get isApp() { return false; }
7702
7747
  get app() { return this.parent || this; }
7703
7748
  get isLeafer() { return true; }
7704
- get imageReady() { return this.viewReady && ImageManager.isComplete; }
7749
+ get imageReady() { return this.viewReady && Resource.isComplete; }
7705
7750
  get layoutLocked() { return !this.layouter.running; }
7706
7751
  get FPS() { return this.renderer ? this.renderer.FPS : 60; }
7707
7752
  get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
@@ -7912,13 +7957,13 @@ var LeaferUI = (function (exports) {
7912
7957
  WaitHelper.run(this.__viewReadyWait);
7913
7958
  }
7914
7959
  __onLayoutEnd() {
7915
- const { grow, growWidth, growHeight } = this.config;
7960
+ const { grow, width: fixedWidth, height: fixedHeight } = this.config;
7916
7961
  if (grow) {
7917
7962
  let { width, height, pixelRatio } = this;
7918
7963
  const bounds = grow === 'box' ? this.worldBoxBounds : this.__world;
7919
- if (growWidth !== false)
7964
+ if (!fixedWidth)
7920
7965
  width = Math.max(1, bounds.x + bounds.width);
7921
- if (growHeight !== false)
7966
+ if (!fixedHeight)
7922
7967
  height = Math.max(1, bounds.y + bounds.height);
7923
7968
  this.__doResize({ width, height, pixelRatio });
7924
7969
  }
@@ -7996,7 +8041,7 @@ var LeaferUI = (function (exports) {
7996
8041
  list.push(item);
7997
8042
  this.requestRender();
7998
8043
  }
7999
- zoom(_zoomType, _padding, _fixedScale) {
8044
+ zoom(_zoomType, _padding, _fixedScale, _transition) {
8000
8045
  return Plugin.need('view');
8001
8046
  }
8002
8047
  getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
@@ -8061,10 +8106,10 @@ var LeaferUI = (function (exports) {
8061
8106
  exports.Leafer.list = new LeafList();
8062
8107
  __decorate([
8063
8108
  dataProcessor(LeaferData)
8064
- ], exports.Leafer.prototype, "__", undefined);
8109
+ ], exports.Leafer.prototype, "__", void 0);
8065
8110
  __decorate([
8066
8111
  boundsType()
8067
- ], exports.Leafer.prototype, "pixelRatio", undefined);
8112
+ ], exports.Leafer.prototype, "pixelRatio", void 0);
8068
8113
  exports.Leafer = Leafer_1 = __decorate([
8069
8114
  registerUI()
8070
8115
  ], exports.Leafer);
@@ -8077,7 +8122,7 @@ var LeaferUI = (function (exports) {
8077
8122
  };
8078
8123
  __decorate([
8079
8124
  dataProcessor(RectData)
8080
- ], exports.Rect.prototype, "__", undefined);
8125
+ ], exports.Rect.prototype, "__", void 0);
8081
8126
  exports.Rect = __decorate([
8082
8127
  useModule(RectRender),
8083
8128
  rewriteAble(),
@@ -8168,13 +8213,13 @@ var LeaferUI = (function (exports) {
8168
8213
  };
8169
8214
  __decorate([
8170
8215
  dataProcessor(BoxData)
8171
- ], exports.Box.prototype, "__", undefined);
8216
+ ], exports.Box.prototype, "__", void 0);
8172
8217
  __decorate([
8173
8218
  dataType(false)
8174
- ], exports.Box.prototype, "resizeChildren", undefined);
8219
+ ], exports.Box.prototype, "resizeChildren", void 0);
8175
8220
  __decorate([
8176
8221
  affectRenderBoundsType('show')
8177
- ], exports.Box.prototype, "overflow", undefined);
8222
+ ], exports.Box.prototype, "overflow", void 0);
8178
8223
  __decorate([
8179
8224
  rewrite(rect$1.__updateStrokeSpread)
8180
8225
  ], exports.Box.prototype, "__updateStrokeSpread", null);
@@ -8213,13 +8258,13 @@ var LeaferUI = (function (exports) {
8213
8258
  };
8214
8259
  __decorate([
8215
8260
  dataProcessor(FrameData)
8216
- ], exports.Frame.prototype, "__", undefined);
8261
+ ], exports.Frame.prototype, "__", void 0);
8217
8262
  __decorate([
8218
8263
  surfaceType('#FFFFFF')
8219
- ], exports.Frame.prototype, "fill", undefined);
8264
+ ], exports.Frame.prototype, "fill", void 0);
8220
8265
  __decorate([
8221
8266
  affectRenderBoundsType('hide')
8222
- ], exports.Frame.prototype, "overflow", undefined);
8267
+ ], exports.Frame.prototype, "overflow", void 0);
8223
8268
  exports.Frame = __decorate([
8224
8269
  registerUI()
8225
8270
  ], exports.Frame);
@@ -8266,16 +8311,16 @@ var LeaferUI = (function (exports) {
8266
8311
  };
8267
8312
  __decorate([
8268
8313
  dataProcessor(EllipseData)
8269
- ], exports.Ellipse.prototype, "__", undefined);
8314
+ ], exports.Ellipse.prototype, "__", void 0);
8270
8315
  __decorate([
8271
8316
  pathType(0)
8272
- ], exports.Ellipse.prototype, "innerRadius", undefined);
8317
+ ], exports.Ellipse.prototype, "innerRadius", void 0);
8273
8318
  __decorate([
8274
8319
  pathType(0)
8275
- ], exports.Ellipse.prototype, "startAngle", undefined);
8320
+ ], exports.Ellipse.prototype, "startAngle", void 0);
8276
8321
  __decorate([
8277
8322
  pathType(0)
8278
- ], exports.Ellipse.prototype, "endAngle", undefined);
8323
+ ], exports.Ellipse.prototype, "endAngle", void 0);
8279
8324
  exports.Ellipse = __decorate([
8280
8325
  registerUI()
8281
8326
  ], exports.Ellipse);
@@ -8334,22 +8379,22 @@ var LeaferUI = (function (exports) {
8334
8379
  };
8335
8380
  __decorate([
8336
8381
  dataProcessor(LineData)
8337
- ], exports.Line.prototype, "__", undefined);
8382
+ ], exports.Line.prototype, "__", void 0);
8338
8383
  __decorate([
8339
8384
  affectStrokeBoundsType('center')
8340
- ], exports.Line.prototype, "strokeAlign", undefined);
8385
+ ], exports.Line.prototype, "strokeAlign", void 0);
8341
8386
  __decorate([
8342
8387
  boundsType(0)
8343
- ], exports.Line.prototype, "height", undefined);
8388
+ ], exports.Line.prototype, "height", void 0);
8344
8389
  __decorate([
8345
8390
  pathType()
8346
- ], exports.Line.prototype, "points", undefined);
8391
+ ], exports.Line.prototype, "points", void 0);
8347
8392
  __decorate([
8348
8393
  pathType(0)
8349
- ], exports.Line.prototype, "curve", undefined);
8394
+ ], exports.Line.prototype, "curve", void 0);
8350
8395
  __decorate([
8351
8396
  pathType(false)
8352
- ], exports.Line.prototype, "closed", undefined);
8397
+ ], exports.Line.prototype, "closed", void 0);
8353
8398
  exports.Line = __decorate([
8354
8399
  registerUI()
8355
8400
  ], exports.Line);
@@ -8382,16 +8427,16 @@ var LeaferUI = (function (exports) {
8382
8427
  };
8383
8428
  __decorate([
8384
8429
  dataProcessor(PolygonData)
8385
- ], exports.Polygon.prototype, "__", undefined);
8430
+ ], exports.Polygon.prototype, "__", void 0);
8386
8431
  __decorate([
8387
8432
  pathType(3)
8388
- ], exports.Polygon.prototype, "sides", undefined);
8433
+ ], exports.Polygon.prototype, "sides", void 0);
8389
8434
  __decorate([
8390
8435
  pathType()
8391
- ], exports.Polygon.prototype, "points", undefined);
8436
+ ], exports.Polygon.prototype, "points", void 0);
8392
8437
  __decorate([
8393
8438
  pathType(0)
8394
- ], exports.Polygon.prototype, "curve", undefined);
8439
+ ], exports.Polygon.prototype, "curve", void 0);
8395
8440
  __decorate([
8396
8441
  rewrite(line.__updateRenderPath)
8397
8442
  ], exports.Polygon.prototype, "__updateRenderPath", null);
@@ -8423,13 +8468,13 @@ var LeaferUI = (function (exports) {
8423
8468
  };
8424
8469
  __decorate([
8425
8470
  dataProcessor(StarData)
8426
- ], exports.Star.prototype, "__", undefined);
8471
+ ], exports.Star.prototype, "__", void 0);
8427
8472
  __decorate([
8428
8473
  pathType(5)
8429
- ], exports.Star.prototype, "corners", undefined);
8474
+ ], exports.Star.prototype, "corners", void 0);
8430
8475
  __decorate([
8431
8476
  pathType(0.382)
8432
- ], exports.Star.prototype, "innerRadius", undefined);
8477
+ ], exports.Star.prototype, "innerRadius", void 0);
8433
8478
  exports.Star = __decorate([
8434
8479
  registerUI()
8435
8480
  ], exports.Star);
@@ -8451,10 +8496,10 @@ var LeaferUI = (function (exports) {
8451
8496
  };
8452
8497
  __decorate([
8453
8498
  dataProcessor(ImageData)
8454
- ], exports.Image.prototype, "__", undefined);
8499
+ ], exports.Image.prototype, "__", void 0);
8455
8500
  __decorate([
8456
8501
  boundsType('')
8457
- ], exports.Image.prototype, "url", undefined);
8502
+ ], exports.Image.prototype, "url", void 0);
8458
8503
  exports.Image = __decorate([
8459
8504
  registerUI()
8460
8505
  ], exports.Image);
@@ -8517,25 +8562,25 @@ var LeaferUI = (function (exports) {
8517
8562
  };
8518
8563
  __decorate([
8519
8564
  dataProcessor(CanvasData)
8520
- ], exports.Canvas.prototype, "__", undefined);
8565
+ ], exports.Canvas.prototype, "__", void 0);
8521
8566
  __decorate([
8522
8567
  resizeType(100)
8523
- ], exports.Canvas.prototype, "width", undefined);
8568
+ ], exports.Canvas.prototype, "width", void 0);
8524
8569
  __decorate([
8525
8570
  resizeType(100)
8526
- ], exports.Canvas.prototype, "height", undefined);
8571
+ ], exports.Canvas.prototype, "height", void 0);
8527
8572
  __decorate([
8528
8573
  resizeType(1)
8529
- ], exports.Canvas.prototype, "pixelRatio", undefined);
8574
+ ], exports.Canvas.prototype, "pixelRatio", void 0);
8530
8575
  __decorate([
8531
8576
  resizeType(true)
8532
- ], exports.Canvas.prototype, "smooth", undefined);
8577
+ ], exports.Canvas.prototype, "smooth", void 0);
8533
8578
  __decorate([
8534
8579
  dataType(false)
8535
- ], exports.Canvas.prototype, "safeResize", undefined);
8580
+ ], exports.Canvas.prototype, "safeResize", void 0);
8536
8581
  __decorate([
8537
8582
  resizeType()
8538
- ], exports.Canvas.prototype, "contextSettings", undefined);
8583
+ ], exports.Canvas.prototype, "contextSettings", void 0);
8539
8584
  exports.Canvas = __decorate([
8540
8585
  registerUI()
8541
8586
  ], exports.Canvas);
@@ -8626,76 +8671,76 @@ var LeaferUI = (function (exports) {
8626
8671
  };
8627
8672
  __decorate([
8628
8673
  dataProcessor(TextData)
8629
- ], exports.Text.prototype, "__", undefined);
8674
+ ], exports.Text.prototype, "__", void 0);
8630
8675
  __decorate([
8631
8676
  boundsType(0)
8632
- ], exports.Text.prototype, "width", undefined);
8677
+ ], exports.Text.prototype, "width", void 0);
8633
8678
  __decorate([
8634
8679
  boundsType(0)
8635
- ], exports.Text.prototype, "height", undefined);
8680
+ ], exports.Text.prototype, "height", void 0);
8636
8681
  __decorate([
8637
8682
  dataType(false)
8638
- ], exports.Text.prototype, "resizeFontSize", undefined);
8683
+ ], exports.Text.prototype, "resizeFontSize", void 0);
8639
8684
  __decorate([
8640
8685
  surfaceType('#000000')
8641
- ], exports.Text.prototype, "fill", undefined);
8686
+ ], exports.Text.prototype, "fill", void 0);
8642
8687
  __decorate([
8643
8688
  affectStrokeBoundsType('outside')
8644
- ], exports.Text.prototype, "strokeAlign", undefined);
8689
+ ], exports.Text.prototype, "strokeAlign", void 0);
8645
8690
  __decorate([
8646
8691
  hitType('all')
8647
- ], exports.Text.prototype, "hitFill", undefined);
8692
+ ], exports.Text.prototype, "hitFill", void 0);
8648
8693
  __decorate([
8649
8694
  boundsType('')
8650
- ], exports.Text.prototype, "text", undefined);
8695
+ ], exports.Text.prototype, "text", void 0);
8651
8696
  __decorate([
8652
8697
  boundsType('caption')
8653
- ], exports.Text.prototype, "fontFamily", undefined);
8698
+ ], exports.Text.prototype, "fontFamily", void 0);
8654
8699
  __decorate([
8655
8700
  boundsType(12)
8656
- ], exports.Text.prototype, "fontSize", undefined);
8701
+ ], exports.Text.prototype, "fontSize", void 0);
8657
8702
  __decorate([
8658
8703
  boundsType('normal')
8659
- ], exports.Text.prototype, "fontWeight", undefined);
8704
+ ], exports.Text.prototype, "fontWeight", void 0);
8660
8705
  __decorate([
8661
8706
  boundsType(false)
8662
- ], exports.Text.prototype, "italic", undefined);
8707
+ ], exports.Text.prototype, "italic", void 0);
8663
8708
  __decorate([
8664
8709
  boundsType('none')
8665
- ], exports.Text.prototype, "textCase", undefined);
8710
+ ], exports.Text.prototype, "textCase", void 0);
8666
8711
  __decorate([
8667
8712
  boundsType('none')
8668
- ], exports.Text.prototype, "textDecoration", undefined);
8713
+ ], exports.Text.prototype, "textDecoration", void 0);
8669
8714
  __decorate([
8670
8715
  boundsType(0)
8671
- ], exports.Text.prototype, "letterSpacing", undefined);
8716
+ ], exports.Text.prototype, "letterSpacing", void 0);
8672
8717
  __decorate([
8673
8718
  boundsType({ type: 'percent', value: 1.5 })
8674
- ], exports.Text.prototype, "lineHeight", undefined);
8719
+ ], exports.Text.prototype, "lineHeight", void 0);
8675
8720
  __decorate([
8676
8721
  boundsType(0)
8677
- ], exports.Text.prototype, "paraIndent", undefined);
8722
+ ], exports.Text.prototype, "paraIndent", void 0);
8678
8723
  __decorate([
8679
8724
  boundsType(0)
8680
- ], exports.Text.prototype, "paraSpacing", undefined);
8725
+ ], exports.Text.prototype, "paraSpacing", void 0);
8681
8726
  __decorate([
8682
8727
  boundsType('x')
8683
- ], exports.Text.prototype, "writingMode", undefined);
8728
+ ], exports.Text.prototype, "writingMode", void 0);
8684
8729
  __decorate([
8685
8730
  boundsType('left')
8686
- ], exports.Text.prototype, "textAlign", undefined);
8731
+ ], exports.Text.prototype, "textAlign", void 0);
8687
8732
  __decorate([
8688
8733
  boundsType('top')
8689
- ], exports.Text.prototype, "verticalAlign", undefined);
8734
+ ], exports.Text.prototype, "verticalAlign", void 0);
8690
8735
  __decorate([
8691
8736
  boundsType(true)
8692
- ], exports.Text.prototype, "autoSizeAlign", undefined);
8737
+ ], exports.Text.prototype, "autoSizeAlign", void 0);
8693
8738
  __decorate([
8694
8739
  boundsType('normal')
8695
- ], exports.Text.prototype, "textWrap", undefined);
8740
+ ], exports.Text.prototype, "textWrap", void 0);
8696
8741
  __decorate([
8697
8742
  boundsType('show')
8698
- ], exports.Text.prototype, "textOverflow", undefined);
8743
+ ], exports.Text.prototype, "textOverflow", void 0);
8699
8744
  exports.Text = __decorate([
8700
8745
  registerUI()
8701
8746
  ], exports.Text);
@@ -8708,10 +8753,10 @@ var LeaferUI = (function (exports) {
8708
8753
  };
8709
8754
  __decorate([
8710
8755
  dataProcessor(PathData)
8711
- ], exports.Path.prototype, "__", undefined);
8756
+ ], exports.Path.prototype, "__", void 0);
8712
8757
  __decorate([
8713
8758
  affectStrokeBoundsType('center')
8714
- ], exports.Path.prototype, "strokeAlign", undefined);
8759
+ ], exports.Path.prototype, "strokeAlign", void 0);
8715
8760
  exports.Path = __decorate([
8716
8761
  registerUI()
8717
8762
  ], exports.Path);
@@ -8750,10 +8795,10 @@ var LeaferUI = (function (exports) {
8750
8795
  };
8751
8796
  __decorate([
8752
8797
  dataProcessor(PenData)
8753
- ], exports.Pen.prototype, "__", undefined);
8798
+ ], exports.Pen.prototype, "__", void 0);
8754
8799
  __decorate([
8755
8800
  penPathType()
8756
- ], exports.Pen.prototype, "path", undefined);
8801
+ ], exports.Pen.prototype, "path", void 0);
8757
8802
  exports.Pen = __decorate([
8758
8803
  useModule(PathCreator, ['set', 'path', 'paint']),
8759
8804
  registerUI()
@@ -8989,7 +9034,7 @@ var LeaferUI = (function (exports) {
8989
9034
  const { draggable, dragBounds } = leaf, move = leaf.getLocalPoint(total, null, true);
8990
9035
  PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
8991
9036
  if (dragBounds)
8992
- this.getMoveInDragBounds(leaf.__local, dragBounds === 'parent' ? leaf.parent.boxBounds : dragBounds, move, true);
9037
+ this.getMoveInDragBounds(leaf.__localBoxBounds, dragBounds === 'parent' ? leaf.parent.boxBounds : dragBounds, move, true);
8993
9038
  if (draggable === 'x')
8994
9039
  move.y = 0;
8995
9040
  if (draggable === 'y')
@@ -9692,7 +9737,9 @@ var LeaferUI = (function (exports) {
9692
9737
  }
9693
9738
  findPath(data, options) {
9694
9739
  const { hitRadius, through } = this.p;
9695
- const { bottomList } = this;
9740
+ const { bottomList, target } = this;
9741
+ if (!Platform.backgrounder && !data.origin)
9742
+ target && target.updateLayout();
9696
9743
  const find = this.selector.getByPoint(data, hitRadius, Object.assign({ bottomList, name: data.type }, (options || { through })));
9697
9744
  if (find.throughPath)
9698
9745
  data.throughPath = find.throughPath;
@@ -9937,9 +9984,9 @@ var LeaferUI = (function (exports) {
9937
9984
  }
9938
9985
  return this.__hit(inner);
9939
9986
  };
9940
- leaf.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === undefined ? undefined : _a.hitFill(inner, this.__.windingRule); };
9941
- leaf.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === undefined ? undefined : _a.hitStroke(inner, strokeWidth); };
9942
- leaf.__hitPixel = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === undefined ? undefined : _a.hitPixel(inner, this.__layout.renderBounds, this.__hitCanvas.hitScale); };
9987
+ leaf.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitFill(inner, this.__.windingRule); };
9988
+ leaf.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitStroke(inner, strokeWidth); };
9989
+ leaf.__hitPixel = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitPixel(inner, this.__layout.renderBounds, this.__hitCanvas.hitScale); };
9943
9990
  leaf.__drawHitPath = function (canvas) { if (canvas)
9944
9991
  this.__drawRenderPath(canvas); };
9945
9992
 
@@ -10027,8 +10074,8 @@ var LeaferUI = (function (exports) {
10027
10074
  return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
10028
10075
  }
10029
10076
  exports.Group.prototype.pick = function (hitPoint, options) {
10030
- this.leafer || this.updateLayout();
10031
10077
  options || (options = emptyData);
10078
+ this.updateLayout();
10032
10079
  return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
10033
10080
  };
10034
10081
 
@@ -10412,7 +10459,7 @@ var LeaferUI = (function (exports) {
10412
10459
  box = tempBox.set(box).shrink(paint.padding);
10413
10460
  if (paint.mode === 'strench')
10414
10461
  paint.mode = 'stretch';
10415
- const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
10462
+ const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
10416
10463
  const sameBox = box.width === width && box.height === height;
10417
10464
  const data = { mode };
10418
10465
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -10475,6 +10522,8 @@ var LeaferUI = (function (exports) {
10475
10522
  data.height = height;
10476
10523
  if (opacity)
10477
10524
  data.opacity = opacity;
10525
+ if (filters)
10526
+ data.filters = filters;
10478
10527
  if (repeat)
10479
10528
  data.repeat = typeof repeat === 'string' ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat';
10480
10529
  return data;
@@ -10577,7 +10626,7 @@ var LeaferUI = (function (exports) {
10577
10626
  scaleX = abs$1(scaleX);
10578
10627
  scaleY = abs$1(scaleY);
10579
10628
  const { image, data } = paint;
10580
- let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform, repeat } = data;
10629
+ let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
10581
10630
  if (sx) {
10582
10631
  imageMatrix = get$1();
10583
10632
  copy$1(imageMatrix, transform);
@@ -10620,7 +10669,7 @@ var LeaferUI = (function (exports) {
10620
10669
  }
10621
10670
  scale(imageMatrix, 1 / scaleX, 1 / scaleY);
10622
10671
  }
10623
- const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, opacity);
10672
+ const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, data.opacity, data.filters);
10624
10673
  const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || 'no-repeat'), imageMatrix, paint);
10625
10674
  paint.style = pattern;
10626
10675
  paint.patternId = id;
@@ -10664,7 +10713,7 @@ var LeaferUI = (function (exports) {
10664
10713
  canvas.opacity *= data.opacity;
10665
10714
  if (data.transform)
10666
10715
  canvas.transform(data.transform);
10667
- canvas.drawImage(paint.image.view, 0, 0, data.width, data.height);
10716
+ canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height);
10668
10717
  canvas.restore();
10669
10718
  return true;
10670
10719
  }
@@ -10674,7 +10723,7 @@ var LeaferUI = (function (exports) {
10674
10723
  }
10675
10724
  else {
10676
10725
  if (!paint.patternTask) {
10677
- paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, undefined, undefined, function* () {
10726
+ paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
10678
10727
  paint.patternTask = null;
10679
10728
  if (canvas.bounds.hit(ui.__nowWorld))
10680
10729
  createPattern(ui, paint, pixelRatio);
@@ -11572,6 +11621,7 @@ var LeaferUI = (function (exports) {
11572
11621
  exports.Eventer = Eventer;
11573
11622
  exports.Export = Export;
11574
11623
  exports.FileHelper = FileHelper;
11624
+ exports.Filter = Filter;
11575
11625
  exports.FrameData = FrameData;
11576
11626
  exports.GroupData = GroupData;
11577
11627
  exports.HitCanvasManager = HitCanvasManager;
@@ -11641,6 +11691,7 @@ var LeaferUI = (function (exports) {
11641
11691
  exports.RenderEvent = RenderEvent;
11642
11692
  exports.Renderer = Renderer;
11643
11693
  exports.ResizeEvent = ResizeEvent;
11694
+ exports.Resource = Resource;
11644
11695
  exports.Run = Run;
11645
11696
  exports.Selector = Selector;
11646
11697
  exports.StarData = StarData;