leafer-ui 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$f = Debug.get('RunTime');
1380
+ const debug$g = 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$f.log(name, duration, 'ms');
1397
+ R$1.idMap[id] = R$1.nameMap[id] = R$1.nameToIdMap[name] = undefined;
1398
+ debug$g.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$e = Debug.get('UICreator');
1427
+ const debug$f = 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$e.repeat(tag);
1433
+ debug$f.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$e.error('not register ' + tag);
1438
+ debug$f.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$d = Debug.get('EventCreator');
1454
+ const debug$e = 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$d.repeat(name), nameList[name] = Event;
1462
+ nameList[name] && debug$e.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$c = Debug.get('PathConvert');
2618
+ const debug$d = 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$c.error(`command: ${command} [index:${i}]`, old);
2859
+ debug$d.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$b = Debug.get('PathDrawer');
3082
+ const debug$c = 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$b.error(`command: ${command} [index:${i}]`, data);
3145
+ debug$c.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$a = Debug.get('PathBounds');
3155
+ const debug$b = 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$a.error(`command: ${command} [index:${i}]`, data);
3263
+ debug$b.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$9 = Debug.get('TaskProcessor');
3379
+ const debug$a = 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$9.error(error);
3394
+ debug$a.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$9 = 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$9.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$1.tasker.isComplete; },
3635
3669
  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
- }
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$1.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$1.map = {};
3682
3713
  I$1.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$5 = 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;
@@ -7006,9 +7045,10 @@ var LeaferUI = (function (exports) {
7006
7045
  this.finder = Creator.finder && Creator.finder();
7007
7046
  }
7008
7047
  getByPoint(hitPoint, hitRadius, options) {
7009
- if (Platform.backgrounder && this.target)
7010
- this.target.updateLayout();
7011
- return this.picker.getByPoint(hitPoint, hitRadius, options);
7048
+ const { target, picker } = this;
7049
+ if (Platform.backgrounder)
7050
+ target && target.updateLayout();
7051
+ return picker.getByPoint(hitPoint, hitRadius, options);
7012
7052
  }
7013
7053
  getBy(condition, branch, one, options) {
7014
7054
  return this.finder ? this.finder.getBy(condition, branch, one, options) : Plugin.need('find');
@@ -7066,9 +7106,7 @@ var LeaferUI = (function (exports) {
7066
7106
  const ColorConvert = {};
7067
7107
  const UnitConvert = {
7068
7108
  number(value, percentRefer) {
7069
- if (typeof value === 'object')
7070
- return value.type === 'percent' ? value.value * percentRefer : value.value;
7071
- return value;
7109
+ return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
7072
7110
  }
7073
7111
  };
7074
7112
  const PathArrow = {};
@@ -7076,16 +7114,15 @@ var LeaferUI = (function (exports) {
7076
7114
  const PaintImage = {};
7077
7115
  const PaintGradient = {};
7078
7116
  const Effect = {};
7117
+ const Filter = {
7118
+ apply() { Plugin.need('filter'); }
7119
+ };
7079
7120
  const Export = {};
7080
7121
  const State = {
7081
- setStyleName(_leaf, _styleName, _value) { return Plugin.need('state'); },
7082
- set(_leaf, _stateName) { return Plugin.need('state'); }
7083
- };
7084
- const Transition = {
7085
- list: {},
7086
- register(attrName, fn) { Transition.list[attrName] = fn; },
7087
- get(attrName) { return Transition.list[attrName]; }
7122
+ setStyleName() { return Plugin.need('state'); },
7123
+ set() { return Plugin.need('state'); }
7088
7124
  };
7125
+ const Transition = {};
7089
7126
 
7090
7127
  const { parse, objectToCanvasData } = PathConvert;
7091
7128
  const emptyPaint = {};
@@ -7192,24 +7229,13 @@ var LeaferUI = (function (exports) {
7192
7229
  }
7193
7230
  }
7194
7231
  setShadow(value) {
7195
- this.__setInput('shadow', value);
7196
- if (value instanceof Array) {
7197
- if (value.some((item) => item.visible === false))
7198
- value = value.filter((item) => item.visible !== false);
7199
- this._shadow = value.length ? value : null;
7200
- }
7201
- else
7202
- this._shadow = value && value.visible !== false ? [value] : null;
7232
+ setArray(this, 'shadow', value);
7203
7233
  }
7204
7234
  setInnerShadow(value) {
7205
- this.__setInput('innerShadow', value);
7206
- if (value instanceof Array) {
7207
- if (value.some((item) => item.visible === false))
7208
- value = value.filter((item) => item.visible !== false);
7209
- this._innerShadow = value.length ? value : null;
7210
- }
7211
- else
7212
- this._innerShadow = value && value.visible !== false ? [value] : null;
7235
+ setArray(this, 'innerShadow', value);
7236
+ }
7237
+ setFilter(value) {
7238
+ setArray(this, 'filter', value);
7213
7239
  }
7214
7240
  __computePaint() {
7215
7241
  const { fill, stroke } = this.__input;
@@ -7220,6 +7246,17 @@ var LeaferUI = (function (exports) {
7220
7246
  this.__needComputePaint = false;
7221
7247
  }
7222
7248
  }
7249
+ function setArray(data, key, value) {
7250
+ data.__setInput(key, value);
7251
+ if (value instanceof Array) {
7252
+ if (value.some((item) => item.visible === false))
7253
+ value = value.filter((item) => item.visible !== false);
7254
+ value.length || (value = null);
7255
+ }
7256
+ else
7257
+ value = value && value.visible !== false ? [value] : null;
7258
+ data['_' + key] = value;
7259
+ }
7223
7260
 
7224
7261
  class GroupData extends UIData {
7225
7262
  }
@@ -7342,11 +7379,13 @@ var LeaferUI = (function (exports) {
7342
7379
  },
7343
7380
  __updateRenderSpread() {
7344
7381
  let width = 0;
7345
- const { shadow, innerShadow, blur, backgroundBlur } = this.__;
7382
+ const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
7346
7383
  if (shadow)
7347
7384
  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));
7348
7385
  if (blur)
7349
7386
  width = Math.max(width, blur);
7387
+ if (filter)
7388
+ width += Filter.getSpread(filter);
7350
7389
  let shapeWidth = width = Math.ceil(width);
7351
7390
  if (innerShadow)
7352
7391
  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));
@@ -7361,8 +7400,8 @@ var LeaferUI = (function (exports) {
7361
7400
  __updateChange() {
7362
7401
  const data = this.__;
7363
7402
  if (data.__useEffect) {
7364
- const { shadow, innerShadow, blur, backgroundBlur } = this.__;
7365
- data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur);
7403
+ const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
7404
+ data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur || filter);
7366
7405
  }
7367
7406
  data.__checkSingle();
7368
7407
  const complex = data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect;
@@ -7376,7 +7415,7 @@ var LeaferUI = (function (exports) {
7376
7415
  __drawFast(canvas, options) {
7377
7416
  drawFast(this, canvas, options);
7378
7417
  },
7379
- __draw(canvas, options) {
7418
+ __draw(canvas, options, originCanvas) {
7380
7419
  const data = this.__;
7381
7420
  if (data.__complex) {
7382
7421
  if (data.__needComputePaint)
@@ -7386,7 +7425,7 @@ var LeaferUI = (function (exports) {
7386
7425
  if (data.__useEffect) {
7387
7426
  const shape = Paint.shape(this, canvas, options);
7388
7427
  this.__nowWorld = this.__getNowWorld(options);
7389
- const { shadow, innerShadow } = data;
7428
+ const { shadow, innerShadow, filter } = data;
7390
7429
  if (shadow)
7391
7430
  Effect.shadow(this, canvas, shape);
7392
7431
  if (fill)
@@ -7397,6 +7436,8 @@ var LeaferUI = (function (exports) {
7397
7436
  Effect.innerShadow(this, canvas, shape);
7398
7437
  if (stroke)
7399
7438
  data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
7439
+ if (filter)
7440
+ Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
7400
7441
  if (shape.worldCanvas)
7401
7442
  shape.worldCanvas.recycle();
7402
7443
  shape.canvas.recycle();
@@ -7616,199 +7657,202 @@ var LeaferUI = (function (exports) {
7616
7657
  };
7617
7658
  __decorate([
7618
7659
  dataProcessor(UIData)
7619
- ], exports.UI.prototype, "__", undefined);
7660
+ ], exports.UI.prototype, "__", void 0);
7620
7661
  __decorate([
7621
7662
  zoomLayerType()
7622
- ], exports.UI.prototype, "zoomLayer", undefined);
7663
+ ], exports.UI.prototype, "zoomLayer", void 0);
7623
7664
  __decorate([
7624
7665
  dataType('')
7625
- ], exports.UI.prototype, "id", undefined);
7666
+ ], exports.UI.prototype, "id", void 0);
7626
7667
  __decorate([
7627
7668
  dataType('')
7628
- ], exports.UI.prototype, "name", undefined);
7669
+ ], exports.UI.prototype, "name", void 0);
7629
7670
  __decorate([
7630
7671
  dataType('')
7631
- ], exports.UI.prototype, "className", undefined);
7672
+ ], exports.UI.prototype, "className", void 0);
7632
7673
  __decorate([
7633
7674
  surfaceType('pass-through')
7634
- ], exports.UI.prototype, "blendMode", undefined);
7675
+ ], exports.UI.prototype, "blendMode", void 0);
7635
7676
  __decorate([
7636
7677
  opacityType(1)
7637
- ], exports.UI.prototype, "opacity", undefined);
7678
+ ], exports.UI.prototype, "opacity", void 0);
7638
7679
  __decorate([
7639
7680
  visibleType(true)
7640
- ], exports.UI.prototype, "visible", undefined);
7681
+ ], exports.UI.prototype, "visible", void 0);
7641
7682
  __decorate([
7642
7683
  surfaceType(false)
7643
- ], exports.UI.prototype, "locked", undefined);
7684
+ ], exports.UI.prototype, "locked", void 0);
7644
7685
  __decorate([
7645
7686
  sortType(0)
7646
- ], exports.UI.prototype, "zIndex", undefined);
7687
+ ], exports.UI.prototype, "zIndex", void 0);
7647
7688
  __decorate([
7648
7689
  maskType(false)
7649
- ], exports.UI.prototype, "mask", undefined);
7690
+ ], exports.UI.prototype, "mask", void 0);
7650
7691
  __decorate([
7651
7692
  eraserType(false)
7652
- ], exports.UI.prototype, "eraser", undefined);
7693
+ ], exports.UI.prototype, "eraser", void 0);
7653
7694
  __decorate([
7654
7695
  positionType(0, true)
7655
- ], exports.UI.prototype, "x", undefined);
7696
+ ], exports.UI.prototype, "x", void 0);
7656
7697
  __decorate([
7657
7698
  positionType(0, true)
7658
- ], exports.UI.prototype, "y", undefined);
7699
+ ], exports.UI.prototype, "y", void 0);
7659
7700
  __decorate([
7660
7701
  boundsType(100, true)
7661
- ], exports.UI.prototype, "width", undefined);
7702
+ ], exports.UI.prototype, "width", void 0);
7662
7703
  __decorate([
7663
7704
  boundsType(100, true)
7664
- ], exports.UI.prototype, "height", undefined);
7705
+ ], exports.UI.prototype, "height", void 0);
7665
7706
  __decorate([
7666
7707
  scaleType(1, true)
7667
- ], exports.UI.prototype, "scaleX", undefined);
7708
+ ], exports.UI.prototype, "scaleX", void 0);
7668
7709
  __decorate([
7669
7710
  scaleType(1, true)
7670
- ], exports.UI.prototype, "scaleY", undefined);
7711
+ ], exports.UI.prototype, "scaleY", void 0);
7671
7712
  __decorate([
7672
7713
  rotationType(0, true)
7673
- ], exports.UI.prototype, "rotation", undefined);
7714
+ ], exports.UI.prototype, "rotation", void 0);
7674
7715
  __decorate([
7675
7716
  rotationType(0, true)
7676
- ], exports.UI.prototype, "skewX", undefined);
7717
+ ], exports.UI.prototype, "skewX", void 0);
7677
7718
  __decorate([
7678
7719
  rotationType(0, true)
7679
- ], exports.UI.prototype, "skewY", undefined);
7720
+ ], exports.UI.prototype, "skewY", void 0);
7680
7721
  __decorate([
7681
7722
  positionType(0, true)
7682
- ], exports.UI.prototype, "offsetX", undefined);
7723
+ ], exports.UI.prototype, "offsetX", void 0);
7683
7724
  __decorate([
7684
7725
  positionType(0, true)
7685
- ], exports.UI.prototype, "offsetY", undefined);
7726
+ ], exports.UI.prototype, "offsetY", void 0);
7686
7727
  __decorate([
7687
7728
  positionType(0, true)
7688
- ], exports.UI.prototype, "scrollX", undefined);
7729
+ ], exports.UI.prototype, "scrollX", void 0);
7689
7730
  __decorate([
7690
7731
  positionType(0, true)
7691
- ], exports.UI.prototype, "scrollY", undefined);
7732
+ ], exports.UI.prototype, "scrollY", void 0);
7692
7733
  __decorate([
7693
7734
  autoLayoutType()
7694
- ], exports.UI.prototype, "origin", undefined);
7735
+ ], exports.UI.prototype, "origin", void 0);
7695
7736
  __decorate([
7696
7737
  autoLayoutType()
7697
- ], exports.UI.prototype, "around", undefined);
7738
+ ], exports.UI.prototype, "around", void 0);
7698
7739
  __decorate([
7699
7740
  dataType(false)
7700
- ], exports.UI.prototype, "lazy", undefined);
7741
+ ], exports.UI.prototype, "lazy", void 0);
7701
7742
  __decorate([
7702
7743
  naturalBoundsType(1)
7703
- ], exports.UI.prototype, "pixelRatio", undefined);
7744
+ ], exports.UI.prototype, "pixelRatio", void 0);
7704
7745
  __decorate([
7705
7746
  pathInputType()
7706
- ], exports.UI.prototype, "path", undefined);
7747
+ ], exports.UI.prototype, "path", void 0);
7707
7748
  __decorate([
7708
7749
  pathType()
7709
- ], exports.UI.prototype, "windingRule", undefined);
7750
+ ], exports.UI.prototype, "windingRule", void 0);
7710
7751
  __decorate([
7711
7752
  pathType(true)
7712
- ], exports.UI.prototype, "closed", undefined);
7753
+ ], exports.UI.prototype, "closed", void 0);
7713
7754
  __decorate([
7714
7755
  boundsType(0)
7715
- ], exports.UI.prototype, "padding", undefined);
7756
+ ], exports.UI.prototype, "padding", void 0);
7716
7757
  __decorate([
7717
7758
  boundsType(false)
7718
- ], exports.UI.prototype, "lockRatio", undefined);
7759
+ ], exports.UI.prototype, "lockRatio", void 0);
7719
7760
  __decorate([
7720
7761
  boundsType()
7721
- ], exports.UI.prototype, "widthRange", undefined);
7762
+ ], exports.UI.prototype, "widthRange", void 0);
7722
7763
  __decorate([
7723
7764
  boundsType()
7724
- ], exports.UI.prototype, "heightRange", undefined);
7765
+ ], exports.UI.prototype, "heightRange", void 0);
7725
7766
  __decorate([
7726
7767
  dataType(false)
7727
- ], exports.UI.prototype, "draggable", undefined);
7768
+ ], exports.UI.prototype, "draggable", void 0);
7728
7769
  __decorate([
7729
7770
  dataType()
7730
- ], exports.UI.prototype, "dragBounds", undefined);
7771
+ ], exports.UI.prototype, "dragBounds", void 0);
7731
7772
  __decorate([
7732
7773
  dataType(false)
7733
- ], exports.UI.prototype, "editable", undefined);
7774
+ ], exports.UI.prototype, "editable", void 0);
7734
7775
  __decorate([
7735
7776
  hitType(true)
7736
- ], exports.UI.prototype, "hittable", undefined);
7777
+ ], exports.UI.prototype, "hittable", void 0);
7737
7778
  __decorate([
7738
7779
  hitType('path')
7739
- ], exports.UI.prototype, "hitFill", undefined);
7780
+ ], exports.UI.prototype, "hitFill", void 0);
7740
7781
  __decorate([
7741
7782
  strokeType('path')
7742
- ], exports.UI.prototype, "hitStroke", undefined);
7783
+ ], exports.UI.prototype, "hitStroke", void 0);
7743
7784
  __decorate([
7744
7785
  hitType(false)
7745
- ], exports.UI.prototype, "hitBox", undefined);
7786
+ ], exports.UI.prototype, "hitBox", void 0);
7746
7787
  __decorate([
7747
7788
  hitType(true)
7748
- ], exports.UI.prototype, "hitChildren", undefined);
7789
+ ], exports.UI.prototype, "hitChildren", void 0);
7749
7790
  __decorate([
7750
7791
  hitType(true)
7751
- ], exports.UI.prototype, "hitSelf", undefined);
7792
+ ], exports.UI.prototype, "hitSelf", void 0);
7752
7793
  __decorate([
7753
7794
  hitType()
7754
- ], exports.UI.prototype, "hitRadius", undefined);
7795
+ ], exports.UI.prototype, "hitRadius", void 0);
7755
7796
  __decorate([
7756
7797
  cursorType('')
7757
- ], exports.UI.prototype, "cursor", undefined);
7798
+ ], exports.UI.prototype, "cursor", void 0);
7758
7799
  __decorate([
7759
7800
  surfaceType()
7760
- ], exports.UI.prototype, "fill", undefined);
7801
+ ], exports.UI.prototype, "fill", void 0);
7761
7802
  __decorate([
7762
7803
  strokeType()
7763
- ], exports.UI.prototype, "stroke", undefined);
7804
+ ], exports.UI.prototype, "stroke", void 0);
7764
7805
  __decorate([
7765
7806
  strokeType('inside')
7766
- ], exports.UI.prototype, "strokeAlign", undefined);
7807
+ ], exports.UI.prototype, "strokeAlign", void 0);
7767
7808
  __decorate([
7768
7809
  strokeType(1)
7769
- ], exports.UI.prototype, "strokeWidth", undefined);
7810
+ ], exports.UI.prototype, "strokeWidth", void 0);
7770
7811
  __decorate([
7771
7812
  strokeType(false)
7772
- ], exports.UI.prototype, "strokeWidthFixed", undefined);
7813
+ ], exports.UI.prototype, "strokeWidthFixed", void 0);
7773
7814
  __decorate([
7774
7815
  strokeType('none')
7775
- ], exports.UI.prototype, "strokeCap", undefined);
7816
+ ], exports.UI.prototype, "strokeCap", void 0);
7776
7817
  __decorate([
7777
7818
  strokeType('miter')
7778
- ], exports.UI.prototype, "strokeJoin", undefined);
7819
+ ], exports.UI.prototype, "strokeJoin", void 0);
7779
7820
  __decorate([
7780
7821
  strokeType()
7781
- ], exports.UI.prototype, "dashPattern", undefined);
7822
+ ], exports.UI.prototype, "dashPattern", void 0);
7782
7823
  __decorate([
7783
7824
  strokeType()
7784
- ], exports.UI.prototype, "dashOffset", undefined);
7825
+ ], exports.UI.prototype, "dashOffset", void 0);
7785
7826
  __decorate([
7786
7827
  strokeType(10)
7787
- ], exports.UI.prototype, "miterLimit", undefined);
7828
+ ], exports.UI.prototype, "miterLimit", void 0);
7788
7829
  __decorate([
7789
7830
  pathType(0)
7790
- ], exports.UI.prototype, "cornerRadius", undefined);
7831
+ ], exports.UI.prototype, "cornerRadius", void 0);
7791
7832
  __decorate([
7792
7833
  pathType()
7793
- ], exports.UI.prototype, "cornerSmoothing", undefined);
7834
+ ], exports.UI.prototype, "cornerSmoothing", void 0);
7835
+ __decorate([
7836
+ effectType()
7837
+ ], exports.UI.prototype, "shadow", void 0);
7794
7838
  __decorate([
7795
7839
  effectType()
7796
- ], exports.UI.prototype, "shadow", undefined);
7840
+ ], exports.UI.prototype, "innerShadow", void 0);
7797
7841
  __decorate([
7798
7842
  effectType()
7799
- ], exports.UI.prototype, "innerShadow", undefined);
7843
+ ], exports.UI.prototype, "blur", void 0);
7800
7844
  __decorate([
7801
7845
  effectType()
7802
- ], exports.UI.prototype, "blur", undefined);
7846
+ ], exports.UI.prototype, "backgroundBlur", void 0);
7803
7847
  __decorate([
7804
7848
  effectType()
7805
- ], exports.UI.prototype, "backgroundBlur", undefined);
7849
+ ], exports.UI.prototype, "grayscale", void 0);
7806
7850
  __decorate([
7807
7851
  effectType()
7808
- ], exports.UI.prototype, "grayscale", undefined);
7852
+ ], exports.UI.prototype, "filter", void 0);
7809
7853
  __decorate([
7810
7854
  dataType({})
7811
- ], exports.UI.prototype, "data", undefined);
7855
+ ], exports.UI.prototype, "data", void 0);
7812
7856
  __decorate([
7813
7857
  rewrite(exports.Leaf.prototype.reset)
7814
7858
  ], exports.UI.prototype, "reset", null);
@@ -7869,7 +7913,7 @@ var LeaferUI = (function (exports) {
7869
7913
  };
7870
7914
  __decorate([
7871
7915
  dataProcessor(GroupData)
7872
- ], exports.Group.prototype, "__", undefined);
7916
+ ], exports.Group.prototype, "__", void 0);
7873
7917
  exports.Group = __decorate([
7874
7918
  useModule(exports.Branch),
7875
7919
  registerUI()
@@ -7882,7 +7926,7 @@ var LeaferUI = (function (exports) {
7882
7926
  get isApp() { return false; }
7883
7927
  get app() { return this.parent || this; }
7884
7928
  get isLeafer() { return true; }
7885
- get imageReady() { return this.viewReady && ImageManager.isComplete; }
7929
+ get imageReady() { return this.viewReady && Resource.isComplete; }
7886
7930
  get layoutLocked() { return !this.layouter.running; }
7887
7931
  get FPS() { return this.renderer ? this.renderer.FPS : 60; }
7888
7932
  get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
@@ -8093,13 +8137,13 @@ var LeaferUI = (function (exports) {
8093
8137
  WaitHelper.run(this.__viewReadyWait);
8094
8138
  }
8095
8139
  __onLayoutEnd() {
8096
- const { grow, growWidth, growHeight } = this.config;
8140
+ const { grow, width: fixedWidth, height: fixedHeight } = this.config;
8097
8141
  if (grow) {
8098
8142
  let { width, height, pixelRatio } = this;
8099
8143
  const bounds = grow === 'box' ? this.worldBoxBounds : this.__world;
8100
- if (growWidth !== false)
8144
+ if (!fixedWidth)
8101
8145
  width = Math.max(1, bounds.x + bounds.width);
8102
- if (growHeight !== false)
8146
+ if (!fixedHeight)
8103
8147
  height = Math.max(1, bounds.y + bounds.height);
8104
8148
  this.__doResize({ width, height, pixelRatio });
8105
8149
  }
@@ -8177,7 +8221,7 @@ var LeaferUI = (function (exports) {
8177
8221
  list.push(item);
8178
8222
  this.requestRender();
8179
8223
  }
8180
- zoom(_zoomType, _padding, _fixedScale) {
8224
+ zoom(_zoomType, _padding, _fixedScale, _transition) {
8181
8225
  return Plugin.need('view');
8182
8226
  }
8183
8227
  getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
@@ -8242,10 +8286,10 @@ var LeaferUI = (function (exports) {
8242
8286
  exports.Leafer.list = new LeafList();
8243
8287
  __decorate([
8244
8288
  dataProcessor(LeaferData)
8245
- ], exports.Leafer.prototype, "__", undefined);
8289
+ ], exports.Leafer.prototype, "__", void 0);
8246
8290
  __decorate([
8247
8291
  boundsType()
8248
- ], exports.Leafer.prototype, "pixelRatio", undefined);
8292
+ ], exports.Leafer.prototype, "pixelRatio", void 0);
8249
8293
  exports.Leafer = Leafer_1 = __decorate([
8250
8294
  registerUI()
8251
8295
  ], exports.Leafer);
@@ -8258,7 +8302,7 @@ var LeaferUI = (function (exports) {
8258
8302
  };
8259
8303
  __decorate([
8260
8304
  dataProcessor(RectData)
8261
- ], exports.Rect.prototype, "__", undefined);
8305
+ ], exports.Rect.prototype, "__", void 0);
8262
8306
  exports.Rect = __decorate([
8263
8307
  useModule(RectRender),
8264
8308
  rewriteAble(),
@@ -8349,13 +8393,13 @@ var LeaferUI = (function (exports) {
8349
8393
  };
8350
8394
  __decorate([
8351
8395
  dataProcessor(BoxData)
8352
- ], exports.Box.prototype, "__", undefined);
8396
+ ], exports.Box.prototype, "__", void 0);
8353
8397
  __decorate([
8354
8398
  dataType(false)
8355
- ], exports.Box.prototype, "resizeChildren", undefined);
8399
+ ], exports.Box.prototype, "resizeChildren", void 0);
8356
8400
  __decorate([
8357
8401
  affectRenderBoundsType('show')
8358
- ], exports.Box.prototype, "overflow", undefined);
8402
+ ], exports.Box.prototype, "overflow", void 0);
8359
8403
  __decorate([
8360
8404
  rewrite(rect$1.__updateStrokeSpread)
8361
8405
  ], exports.Box.prototype, "__updateStrokeSpread", null);
@@ -8394,13 +8438,13 @@ var LeaferUI = (function (exports) {
8394
8438
  };
8395
8439
  __decorate([
8396
8440
  dataProcessor(FrameData)
8397
- ], exports.Frame.prototype, "__", undefined);
8441
+ ], exports.Frame.prototype, "__", void 0);
8398
8442
  __decorate([
8399
8443
  surfaceType('#FFFFFF')
8400
- ], exports.Frame.prototype, "fill", undefined);
8444
+ ], exports.Frame.prototype, "fill", void 0);
8401
8445
  __decorate([
8402
8446
  affectRenderBoundsType('hide')
8403
- ], exports.Frame.prototype, "overflow", undefined);
8447
+ ], exports.Frame.prototype, "overflow", void 0);
8404
8448
  exports.Frame = __decorate([
8405
8449
  registerUI()
8406
8450
  ], exports.Frame);
@@ -8447,16 +8491,16 @@ var LeaferUI = (function (exports) {
8447
8491
  };
8448
8492
  __decorate([
8449
8493
  dataProcessor(EllipseData)
8450
- ], exports.Ellipse.prototype, "__", undefined);
8494
+ ], exports.Ellipse.prototype, "__", void 0);
8451
8495
  __decorate([
8452
8496
  pathType(0)
8453
- ], exports.Ellipse.prototype, "innerRadius", undefined);
8497
+ ], exports.Ellipse.prototype, "innerRadius", void 0);
8454
8498
  __decorate([
8455
8499
  pathType(0)
8456
- ], exports.Ellipse.prototype, "startAngle", undefined);
8500
+ ], exports.Ellipse.prototype, "startAngle", void 0);
8457
8501
  __decorate([
8458
8502
  pathType(0)
8459
- ], exports.Ellipse.prototype, "endAngle", undefined);
8503
+ ], exports.Ellipse.prototype, "endAngle", void 0);
8460
8504
  exports.Ellipse = __decorate([
8461
8505
  registerUI()
8462
8506
  ], exports.Ellipse);
@@ -8515,22 +8559,22 @@ var LeaferUI = (function (exports) {
8515
8559
  };
8516
8560
  __decorate([
8517
8561
  dataProcessor(LineData)
8518
- ], exports.Line.prototype, "__", undefined);
8562
+ ], exports.Line.prototype, "__", void 0);
8519
8563
  __decorate([
8520
8564
  affectStrokeBoundsType('center')
8521
- ], exports.Line.prototype, "strokeAlign", undefined);
8565
+ ], exports.Line.prototype, "strokeAlign", void 0);
8522
8566
  __decorate([
8523
8567
  boundsType(0)
8524
- ], exports.Line.prototype, "height", undefined);
8568
+ ], exports.Line.prototype, "height", void 0);
8525
8569
  __decorate([
8526
8570
  pathType()
8527
- ], exports.Line.prototype, "points", undefined);
8571
+ ], exports.Line.prototype, "points", void 0);
8528
8572
  __decorate([
8529
8573
  pathType(0)
8530
- ], exports.Line.prototype, "curve", undefined);
8574
+ ], exports.Line.prototype, "curve", void 0);
8531
8575
  __decorate([
8532
8576
  pathType(false)
8533
- ], exports.Line.prototype, "closed", undefined);
8577
+ ], exports.Line.prototype, "closed", void 0);
8534
8578
  exports.Line = __decorate([
8535
8579
  registerUI()
8536
8580
  ], exports.Line);
@@ -8563,16 +8607,16 @@ var LeaferUI = (function (exports) {
8563
8607
  };
8564
8608
  __decorate([
8565
8609
  dataProcessor(PolygonData)
8566
- ], exports.Polygon.prototype, "__", undefined);
8610
+ ], exports.Polygon.prototype, "__", void 0);
8567
8611
  __decorate([
8568
8612
  pathType(3)
8569
- ], exports.Polygon.prototype, "sides", undefined);
8613
+ ], exports.Polygon.prototype, "sides", void 0);
8570
8614
  __decorate([
8571
8615
  pathType()
8572
- ], exports.Polygon.prototype, "points", undefined);
8616
+ ], exports.Polygon.prototype, "points", void 0);
8573
8617
  __decorate([
8574
8618
  pathType(0)
8575
- ], exports.Polygon.prototype, "curve", undefined);
8619
+ ], exports.Polygon.prototype, "curve", void 0);
8576
8620
  __decorate([
8577
8621
  rewrite(line.__updateRenderPath)
8578
8622
  ], exports.Polygon.prototype, "__updateRenderPath", null);
@@ -8604,13 +8648,13 @@ var LeaferUI = (function (exports) {
8604
8648
  };
8605
8649
  __decorate([
8606
8650
  dataProcessor(StarData)
8607
- ], exports.Star.prototype, "__", undefined);
8651
+ ], exports.Star.prototype, "__", void 0);
8608
8652
  __decorate([
8609
8653
  pathType(5)
8610
- ], exports.Star.prototype, "corners", undefined);
8654
+ ], exports.Star.prototype, "corners", void 0);
8611
8655
  __decorate([
8612
8656
  pathType(0.382)
8613
- ], exports.Star.prototype, "innerRadius", undefined);
8657
+ ], exports.Star.prototype, "innerRadius", void 0);
8614
8658
  exports.Star = __decorate([
8615
8659
  registerUI()
8616
8660
  ], exports.Star);
@@ -8632,10 +8676,10 @@ var LeaferUI = (function (exports) {
8632
8676
  };
8633
8677
  __decorate([
8634
8678
  dataProcessor(ImageData)
8635
- ], exports.Image.prototype, "__", undefined);
8679
+ ], exports.Image.prototype, "__", void 0);
8636
8680
  __decorate([
8637
8681
  boundsType('')
8638
- ], exports.Image.prototype, "url", undefined);
8682
+ ], exports.Image.prototype, "url", void 0);
8639
8683
  exports.Image = __decorate([
8640
8684
  registerUI()
8641
8685
  ], exports.Image);
@@ -8698,25 +8742,25 @@ var LeaferUI = (function (exports) {
8698
8742
  };
8699
8743
  __decorate([
8700
8744
  dataProcessor(CanvasData)
8701
- ], exports.Canvas.prototype, "__", undefined);
8745
+ ], exports.Canvas.prototype, "__", void 0);
8702
8746
  __decorate([
8703
8747
  resizeType(100)
8704
- ], exports.Canvas.prototype, "width", undefined);
8748
+ ], exports.Canvas.prototype, "width", void 0);
8705
8749
  __decorate([
8706
8750
  resizeType(100)
8707
- ], exports.Canvas.prototype, "height", undefined);
8751
+ ], exports.Canvas.prototype, "height", void 0);
8708
8752
  __decorate([
8709
8753
  resizeType(1)
8710
- ], exports.Canvas.prototype, "pixelRatio", undefined);
8754
+ ], exports.Canvas.prototype, "pixelRatio", void 0);
8711
8755
  __decorate([
8712
8756
  resizeType(true)
8713
- ], exports.Canvas.prototype, "smooth", undefined);
8757
+ ], exports.Canvas.prototype, "smooth", void 0);
8714
8758
  __decorate([
8715
8759
  dataType(false)
8716
- ], exports.Canvas.prototype, "safeResize", undefined);
8760
+ ], exports.Canvas.prototype, "safeResize", void 0);
8717
8761
  __decorate([
8718
8762
  resizeType()
8719
- ], exports.Canvas.prototype, "contextSettings", undefined);
8763
+ ], exports.Canvas.prototype, "contextSettings", void 0);
8720
8764
  exports.Canvas = __decorate([
8721
8765
  registerUI()
8722
8766
  ], exports.Canvas);
@@ -8807,76 +8851,76 @@ var LeaferUI = (function (exports) {
8807
8851
  };
8808
8852
  __decorate([
8809
8853
  dataProcessor(TextData)
8810
- ], exports.Text.prototype, "__", undefined);
8854
+ ], exports.Text.prototype, "__", void 0);
8811
8855
  __decorate([
8812
8856
  boundsType(0)
8813
- ], exports.Text.prototype, "width", undefined);
8857
+ ], exports.Text.prototype, "width", void 0);
8814
8858
  __decorate([
8815
8859
  boundsType(0)
8816
- ], exports.Text.prototype, "height", undefined);
8860
+ ], exports.Text.prototype, "height", void 0);
8817
8861
  __decorate([
8818
8862
  dataType(false)
8819
- ], exports.Text.prototype, "resizeFontSize", undefined);
8863
+ ], exports.Text.prototype, "resizeFontSize", void 0);
8820
8864
  __decorate([
8821
8865
  surfaceType('#000000')
8822
- ], exports.Text.prototype, "fill", undefined);
8866
+ ], exports.Text.prototype, "fill", void 0);
8823
8867
  __decorate([
8824
8868
  affectStrokeBoundsType('outside')
8825
- ], exports.Text.prototype, "strokeAlign", undefined);
8869
+ ], exports.Text.prototype, "strokeAlign", void 0);
8826
8870
  __decorate([
8827
8871
  hitType('all')
8828
- ], exports.Text.prototype, "hitFill", undefined);
8872
+ ], exports.Text.prototype, "hitFill", void 0);
8829
8873
  __decorate([
8830
8874
  boundsType('')
8831
- ], exports.Text.prototype, "text", undefined);
8875
+ ], exports.Text.prototype, "text", void 0);
8832
8876
  __decorate([
8833
8877
  boundsType('caption')
8834
- ], exports.Text.prototype, "fontFamily", undefined);
8878
+ ], exports.Text.prototype, "fontFamily", void 0);
8835
8879
  __decorate([
8836
8880
  boundsType(12)
8837
- ], exports.Text.prototype, "fontSize", undefined);
8881
+ ], exports.Text.prototype, "fontSize", void 0);
8838
8882
  __decorate([
8839
8883
  boundsType('normal')
8840
- ], exports.Text.prototype, "fontWeight", undefined);
8884
+ ], exports.Text.prototype, "fontWeight", void 0);
8841
8885
  __decorate([
8842
8886
  boundsType(false)
8843
- ], exports.Text.prototype, "italic", undefined);
8887
+ ], exports.Text.prototype, "italic", void 0);
8844
8888
  __decorate([
8845
8889
  boundsType('none')
8846
- ], exports.Text.prototype, "textCase", undefined);
8890
+ ], exports.Text.prototype, "textCase", void 0);
8847
8891
  __decorate([
8848
8892
  boundsType('none')
8849
- ], exports.Text.prototype, "textDecoration", undefined);
8893
+ ], exports.Text.prototype, "textDecoration", void 0);
8850
8894
  __decorate([
8851
8895
  boundsType(0)
8852
- ], exports.Text.prototype, "letterSpacing", undefined);
8896
+ ], exports.Text.prototype, "letterSpacing", void 0);
8853
8897
  __decorate([
8854
8898
  boundsType({ type: 'percent', value: 1.5 })
8855
- ], exports.Text.prototype, "lineHeight", undefined);
8899
+ ], exports.Text.prototype, "lineHeight", void 0);
8856
8900
  __decorate([
8857
8901
  boundsType(0)
8858
- ], exports.Text.prototype, "paraIndent", undefined);
8902
+ ], exports.Text.prototype, "paraIndent", void 0);
8859
8903
  __decorate([
8860
8904
  boundsType(0)
8861
- ], exports.Text.prototype, "paraSpacing", undefined);
8905
+ ], exports.Text.prototype, "paraSpacing", void 0);
8862
8906
  __decorate([
8863
8907
  boundsType('x')
8864
- ], exports.Text.prototype, "writingMode", undefined);
8908
+ ], exports.Text.prototype, "writingMode", void 0);
8865
8909
  __decorate([
8866
8910
  boundsType('left')
8867
- ], exports.Text.prototype, "textAlign", undefined);
8911
+ ], exports.Text.prototype, "textAlign", void 0);
8868
8912
  __decorate([
8869
8913
  boundsType('top')
8870
- ], exports.Text.prototype, "verticalAlign", undefined);
8914
+ ], exports.Text.prototype, "verticalAlign", void 0);
8871
8915
  __decorate([
8872
8916
  boundsType(true)
8873
- ], exports.Text.prototype, "autoSizeAlign", undefined);
8917
+ ], exports.Text.prototype, "autoSizeAlign", void 0);
8874
8918
  __decorate([
8875
8919
  boundsType('normal')
8876
- ], exports.Text.prototype, "textWrap", undefined);
8920
+ ], exports.Text.prototype, "textWrap", void 0);
8877
8921
  __decorate([
8878
8922
  boundsType('show')
8879
- ], exports.Text.prototype, "textOverflow", undefined);
8923
+ ], exports.Text.prototype, "textOverflow", void 0);
8880
8924
  exports.Text = __decorate([
8881
8925
  registerUI()
8882
8926
  ], exports.Text);
@@ -8889,10 +8933,10 @@ var LeaferUI = (function (exports) {
8889
8933
  };
8890
8934
  __decorate([
8891
8935
  dataProcessor(PathData)
8892
- ], exports.Path.prototype, "__", undefined);
8936
+ ], exports.Path.prototype, "__", void 0);
8893
8937
  __decorate([
8894
8938
  affectStrokeBoundsType('center')
8895
- ], exports.Path.prototype, "strokeAlign", undefined);
8939
+ ], exports.Path.prototype, "strokeAlign", void 0);
8896
8940
  exports.Path = __decorate([
8897
8941
  registerUI()
8898
8942
  ], exports.Path);
@@ -8931,10 +8975,10 @@ var LeaferUI = (function (exports) {
8931
8975
  };
8932
8976
  __decorate([
8933
8977
  dataProcessor(PenData)
8934
- ], exports.Pen.prototype, "__", undefined);
8978
+ ], exports.Pen.prototype, "__", void 0);
8935
8979
  __decorate([
8936
8980
  penPathType()
8937
- ], exports.Pen.prototype, "path", undefined);
8981
+ ], exports.Pen.prototype, "path", void 0);
8938
8982
  exports.Pen = __decorate([
8939
8983
  useModule(PathCreator, ['set', 'path', 'paint']),
8940
8984
  registerUI()
@@ -9170,7 +9214,7 @@ var LeaferUI = (function (exports) {
9170
9214
  const { draggable, dragBounds } = leaf, move = leaf.getLocalPoint(total, null, true);
9171
9215
  PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
9172
9216
  if (dragBounds)
9173
- this.getMoveInDragBounds(leaf.__local, dragBounds === 'parent' ? leaf.parent.boxBounds : dragBounds, move, true);
9217
+ this.getMoveInDragBounds(leaf.__localBoxBounds, dragBounds === 'parent' ? leaf.parent.boxBounds : dragBounds, move, true);
9174
9218
  if (draggable === 'x')
9175
9219
  move.y = 0;
9176
9220
  if (draggable === 'y')
@@ -9873,7 +9917,9 @@ var LeaferUI = (function (exports) {
9873
9917
  }
9874
9918
  findPath(data, options) {
9875
9919
  const { hitRadius, through } = this.p;
9876
- const { bottomList } = this;
9920
+ const { bottomList, target } = this;
9921
+ if (!Platform.backgrounder && !data.origin)
9922
+ target && target.updateLayout();
9877
9923
  const find = this.selector.getByPoint(data, hitRadius, Object.assign({ bottomList, name: data.type }, (options || { through })));
9878
9924
  if (find.throughPath)
9879
9925
  data.throughPath = find.throughPath;
@@ -10118,9 +10164,9 @@ var LeaferUI = (function (exports) {
10118
10164
  }
10119
10165
  return this.__hit(inner);
10120
10166
  };
10121
- leaf.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === undefined ? undefined : _a.hitFill(inner, this.__.windingRule); };
10122
- leaf.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === undefined ? undefined : _a.hitStroke(inner, strokeWidth); };
10123
- leaf.__hitPixel = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === undefined ? undefined : _a.hitPixel(inner, this.__layout.renderBounds, this.__hitCanvas.hitScale); };
10167
+ leaf.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitFill(inner, this.__.windingRule); };
10168
+ leaf.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitStroke(inner, strokeWidth); };
10169
+ 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); };
10124
10170
  leaf.__drawHitPath = function (canvas) { if (canvas)
10125
10171
  this.__drawRenderPath(canvas); };
10126
10172
 
@@ -10208,8 +10254,8 @@ var LeaferUI = (function (exports) {
10208
10254
  return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
10209
10255
  }
10210
10256
  exports.Group.prototype.pick = function (hitPoint, options) {
10211
- this.leafer || this.updateLayout();
10212
10257
  options || (options = emptyData);
10258
+ this.updateLayout();
10213
10259
  return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
10214
10260
  };
10215
10261
 
@@ -10902,7 +10948,7 @@ var LeaferUI = (function (exports) {
10902
10948
  box = tempBox.set(box).shrink(paint.padding);
10903
10949
  if (paint.mode === 'strench')
10904
10950
  paint.mode = 'stretch';
10905
- const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
10951
+ const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
10906
10952
  const sameBox = box.width === width && box.height === height;
10907
10953
  const data = { mode };
10908
10954
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -10965,6 +11011,8 @@ var LeaferUI = (function (exports) {
10965
11011
  data.height = height;
10966
11012
  if (opacity)
10967
11013
  data.opacity = opacity;
11014
+ if (filters)
11015
+ data.filters = filters;
10968
11016
  if (repeat)
10969
11017
  data.repeat = typeof repeat === 'string' ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat';
10970
11018
  return data;
@@ -11067,7 +11115,7 @@ var LeaferUI = (function (exports) {
11067
11115
  scaleX = abs$1(scaleX);
11068
11116
  scaleY = abs$1(scaleY);
11069
11117
  const { image, data } = paint;
11070
- let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform, repeat } = data;
11118
+ let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
11071
11119
  if (sx) {
11072
11120
  imageMatrix = get$1();
11073
11121
  copy$1(imageMatrix, transform);
@@ -11110,7 +11158,7 @@ var LeaferUI = (function (exports) {
11110
11158
  }
11111
11159
  scale(imageMatrix, 1 / scaleX, 1 / scaleY);
11112
11160
  }
11113
- const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, opacity);
11161
+ const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, data.opacity, data.filters);
11114
11162
  const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || 'no-repeat'), imageMatrix, paint);
11115
11163
  paint.style = pattern;
11116
11164
  paint.patternId = id;
@@ -11154,7 +11202,7 @@ var LeaferUI = (function (exports) {
11154
11202
  canvas.opacity *= data.opacity;
11155
11203
  if (data.transform)
11156
11204
  canvas.transform(data.transform);
11157
- canvas.drawImage(paint.image.view, 0, 0, data.width, data.height);
11205
+ canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height);
11158
11206
  canvas.restore();
11159
11207
  return true;
11160
11208
  }
@@ -11164,7 +11212,7 @@ var LeaferUI = (function (exports) {
11164
11212
  }
11165
11213
  else {
11166
11214
  if (!paint.patternTask) {
11167
- paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, undefined, undefined, function* () {
11215
+ paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
11168
11216
  paint.patternTask = null;
11169
11217
  if (canvas.bounds.hit(ui.__nowWorld))
11170
11218
  createPattern(ui, paint, pixelRatio);
@@ -12062,6 +12110,7 @@ var LeaferUI = (function (exports) {
12062
12110
  exports.Eventer = Eventer;
12063
12111
  exports.Export = Export;
12064
12112
  exports.FileHelper = FileHelper;
12113
+ exports.Filter = Filter;
12065
12114
  exports.FrameData = FrameData;
12066
12115
  exports.GroupData = GroupData;
12067
12116
  exports.HitCanvasManager = HitCanvasManager;
@@ -12132,6 +12181,7 @@ var LeaferUI = (function (exports) {
12132
12181
  exports.RenderEvent = RenderEvent;
12133
12182
  exports.Renderer = Renderer;
12134
12183
  exports.ResizeEvent = ResizeEvent;
12184
+ exports.Resource = Resource;
12135
12185
  exports.Run = Run;
12136
12186
  exports.Selector = Selector;
12137
12187
  exports.StarData = StarData;