leafer-draw 1.3.3 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/web.js CHANGED
@@ -1377,7 +1377,7 @@ var LeaferUI = (function (exports) {
1377
1377
  }
1378
1378
  const D$4 = Debug;
1379
1379
 
1380
- const debug$e = Debug.get('RunTime');
1380
+ const debug$f = Debug.get('RunTime');
1381
1381
  const Run = {
1382
1382
  currentId: 0,
1383
1383
  currentName: '',
@@ -1386,24 +1386,24 @@ var LeaferUI = (function (exports) {
1386
1386
  nameToIdMap: {},
1387
1387
  start(name, microsecond) {
1388
1388
  const id = IncrementId.create(IncrementId.RUNTIME);
1389
- R.currentId = R.idMap[id] = microsecond ? performance.now() : Date.now();
1390
- R.currentName = R.nameMap[id] = name;
1391
- R.nameToIdMap[name] = id;
1389
+ R$1.currentId = R$1.idMap[id] = microsecond ? performance.now() : Date.now();
1390
+ R$1.currentName = R$1.nameMap[id] = name;
1391
+ R$1.nameToIdMap[name] = id;
1392
1392
  return id;
1393
1393
  },
1394
1394
  end(id, microsecond) {
1395
- const time = R.idMap[id], name = R.nameMap[id];
1395
+ const time = R$1.idMap[id], name = R$1.nameMap[id];
1396
1396
  const duration = microsecond ? (performance.now() - time) / 1000 : Date.now() - time;
1397
- R.idMap[id] = R.nameMap[id] = R.nameToIdMap[name] = undefined;
1398
- debug$e.log(name, duration, 'ms');
1397
+ R$1.idMap[id] = R$1.nameMap[id] = R$1.nameToIdMap[name] = undefined;
1398
+ debug$f.log(name, duration, 'ms');
1399
1399
  },
1400
1400
  endOfName(name, microsecond) {
1401
- const id = R.nameToIdMap[name];
1401
+ const id = R$1.nameToIdMap[name];
1402
1402
  if (id !== undefined)
1403
- R.end(id, microsecond);
1403
+ R$1.end(id, microsecond);
1404
1404
  }
1405
1405
  };
1406
- const R = Run;
1406
+ const R$1 = Run;
1407
1407
 
1408
1408
  const check = [];
1409
1409
  const Plugin = {
@@ -1424,18 +1424,18 @@ var LeaferUI = (function (exports) {
1424
1424
  };
1425
1425
  setTimeout(() => check.forEach(name => Plugin.has(name, true)));
1426
1426
 
1427
- const debug$d = Debug.get('UICreator');
1427
+ const debug$e = Debug.get('UICreator');
1428
1428
  const UICreator = {
1429
1429
  list: {},
1430
1430
  register(UI) {
1431
1431
  const { __tag: tag } = UI.prototype;
1432
1432
  if (list$1[tag])
1433
- debug$d.repeat(tag);
1433
+ debug$e.repeat(tag);
1434
1434
  list$1[tag] = UI;
1435
1435
  },
1436
1436
  get(tag, data, x, y, width, height) {
1437
1437
  if (!list$1[tag])
1438
- debug$d.error('not register ' + tag);
1438
+ debug$e.error('not register ' + tag);
1439
1439
  const ui = new list$1[tag](data);
1440
1440
  if (x !== undefined) {
1441
1441
  ui.x = x;
@@ -1451,7 +1451,7 @@ var LeaferUI = (function (exports) {
1451
1451
  };
1452
1452
  const { list: list$1 } = UICreator;
1453
1453
 
1454
- const debug$c = Debug.get('EventCreator');
1454
+ const debug$d = Debug.get('EventCreator');
1455
1455
  const EventCreator = {
1456
1456
  nameList: {},
1457
1457
  register(Event) {
@@ -1459,7 +1459,7 @@ var LeaferUI = (function (exports) {
1459
1459
  Object.keys(Event).forEach(key => {
1460
1460
  name = Event[key];
1461
1461
  if (typeof name === 'string')
1462
- nameList[name] && debug$c.repeat(name), nameList[name] = Event;
1462
+ nameList[name] && debug$d.repeat(name), nameList[name] = Event;
1463
1463
  });
1464
1464
  },
1465
1465
  changeName(oldName, newName) {
@@ -1536,10 +1536,10 @@ var LeaferUI = (function (exports) {
1536
1536
  Object.keys(merge).forEach(key => {
1537
1537
  var _a, _b;
1538
1538
  value = merge[key];
1539
- if ((value === null || value === undefined ? undefined : value.constructor) === Object && ((_a = t[key]) === null || _a === undefined ? undefined : _a.constructor) === Object)
1539
+ if ((value === null || value === void 0 ? void 0 : value.constructor) === Object && ((_a = t[key]) === null || _a === void 0 ? void 0 : _a.constructor) === Object)
1540
1540
  return assign(t[key], merge[key], exclude && exclude[key]);
1541
1541
  if (exclude && (key in exclude)) {
1542
- if (((_b = exclude[key]) === null || _b === undefined ? undefined : _b.constructor) === Object)
1542
+ if (((_b = exclude[key]) === null || _b === void 0 ? void 0 : _b.constructor) === Object)
1543
1543
  assign(t[key] = {}, merge[key], exclude[key]);
1544
1544
  return;
1545
1545
  }
@@ -1663,7 +1663,7 @@ var LeaferUI = (function (exports) {
1663
1663
  const t = this;
1664
1664
  if (t.blendMode === 'pass-through') {
1665
1665
  const leaf = this.__leaf;
1666
- if ((t.opacity < 1 && (leaf.isBranch || t.__hasMultiPaint)) || leaf.__hasEraser || t.eraser) {
1666
+ if ((t.opacity < 1 && (leaf.isBranch || t.__hasMultiPaint)) || leaf.__hasEraser || t.eraser || t.filter) {
1667
1667
  t.__single = true;
1668
1668
  }
1669
1669
  else if (t.__single) {
@@ -1776,7 +1776,7 @@ var LeaferUI = (function (exports) {
1776
1776
  }
1777
1777
  setTransform(_a, _b, _c, _d, _e, _f) { }
1778
1778
  resetTransform() { }
1779
- getTransform() { return undefined; }
1779
+ getTransform() { return void 0; }
1780
1780
  save() { }
1781
1781
  restore() { }
1782
1782
  transform(a, b, c, d, e, f) {
@@ -1833,12 +1833,12 @@ var LeaferUI = (function (exports) {
1833
1833
  ellipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise) { }
1834
1834
  rect(_x, _y, _width, _height) { }
1835
1835
  roundRect(_x, _y, _width, _height, _radius) { }
1836
- createConicGradient(_startAngle, _x, _y) { return undefined; }
1837
- createLinearGradient(_x0, _y0, _x1, _y1) { return undefined; }
1838
- createPattern(_image, _repetition) { return undefined; }
1839
- createRadialGradient(_x0, _y0, _r0, _x1, _y1, _r1) { return undefined; }
1836
+ createConicGradient(_startAngle, _x, _y) { return void 0; }
1837
+ createLinearGradient(_x0, _y0, _x1, _y1) { return void 0; }
1838
+ createPattern(_image, _repetition) { return void 0; }
1839
+ createRadialGradient(_x0, _y0, _r0, _x1, _y1, _r1) { return void 0; }
1840
1840
  fillText(_text, _x, _y, _maxWidth) { }
1841
- measureText(_text) { return undefined; }
1841
+ measureText(_text) { return void 0; }
1842
1842
  strokeText(_text, _x, _y, _maxWidth) { }
1843
1843
  destroy() {
1844
1844
  this.context = null;
@@ -1846,79 +1846,79 @@ var LeaferUI = (function (exports) {
1846
1846
  }
1847
1847
  __decorate([
1848
1848
  contextAttr('imageSmoothingEnabled')
1849
- ], Canvas.prototype, "smooth", undefined);
1849
+ ], Canvas.prototype, "smooth", void 0);
1850
1850
  __decorate([
1851
1851
  contextAttr('imageSmoothingQuality')
1852
- ], Canvas.prototype, "smoothLevel", undefined);
1852
+ ], Canvas.prototype, "smoothLevel", void 0);
1853
1853
  __decorate([
1854
1854
  contextAttr('globalAlpha')
1855
- ], Canvas.prototype, "opacity", undefined);
1855
+ ], Canvas.prototype, "opacity", void 0);
1856
1856
  __decorate([
1857
1857
  contextAttr()
1858
- ], Canvas.prototype, "fillStyle", undefined);
1858
+ ], Canvas.prototype, "fillStyle", void 0);
1859
1859
  __decorate([
1860
1860
  contextAttr()
1861
- ], Canvas.prototype, "strokeStyle", undefined);
1861
+ ], Canvas.prototype, "strokeStyle", void 0);
1862
1862
  __decorate([
1863
1863
  contextAttr('lineWidth')
1864
- ], Canvas.prototype, "strokeWidth", undefined);
1864
+ ], Canvas.prototype, "strokeWidth", void 0);
1865
1865
  __decorate([
1866
1866
  contextAttr('lineCap')
1867
- ], Canvas.prototype, "strokeCap", undefined);
1867
+ ], Canvas.prototype, "strokeCap", void 0);
1868
1868
  __decorate([
1869
1869
  contextAttr('lineJoin')
1870
- ], Canvas.prototype, "strokeJoin", undefined);
1870
+ ], Canvas.prototype, "strokeJoin", void 0);
1871
1871
  __decorate([
1872
1872
  contextAttr('lineDashOffset')
1873
- ], Canvas.prototype, "dashOffset", undefined);
1873
+ ], Canvas.prototype, "dashOffset", void 0);
1874
1874
  __decorate([
1875
1875
  contextAttr()
1876
- ], Canvas.prototype, "miterLimit", undefined);
1876
+ ], Canvas.prototype, "miterLimit", void 0);
1877
1877
  __decorate([
1878
1878
  contextAttr()
1879
- ], Canvas.prototype, "shadowBlur", undefined);
1879
+ ], Canvas.prototype, "shadowBlur", void 0);
1880
1880
  __decorate([
1881
1881
  contextAttr()
1882
- ], Canvas.prototype, "shadowColor", undefined);
1882
+ ], Canvas.prototype, "shadowColor", void 0);
1883
1883
  __decorate([
1884
1884
  contextAttr()
1885
- ], Canvas.prototype, "shadowOffsetX", undefined);
1885
+ ], Canvas.prototype, "shadowOffsetX", void 0);
1886
1886
  __decorate([
1887
1887
  contextAttr()
1888
- ], Canvas.prototype, "shadowOffsetY", undefined);
1888
+ ], Canvas.prototype, "shadowOffsetY", void 0);
1889
1889
  __decorate([
1890
1890
  contextAttr()
1891
- ], Canvas.prototype, "filter", undefined);
1891
+ ], Canvas.prototype, "filter", void 0);
1892
1892
  __decorate([
1893
1893
  contextAttr()
1894
- ], Canvas.prototype, "font", undefined);
1894
+ ], Canvas.prototype, "font", void 0);
1895
1895
  __decorate([
1896
1896
  contextAttr()
1897
- ], Canvas.prototype, "fontKerning", undefined);
1897
+ ], Canvas.prototype, "fontKerning", void 0);
1898
1898
  __decorate([
1899
1899
  contextAttr()
1900
- ], Canvas.prototype, "fontStretch", undefined);
1900
+ ], Canvas.prototype, "fontStretch", void 0);
1901
1901
  __decorate([
1902
1902
  contextAttr()
1903
- ], Canvas.prototype, "fontVariantCaps", undefined);
1903
+ ], Canvas.prototype, "fontVariantCaps", void 0);
1904
1904
  __decorate([
1905
1905
  contextAttr()
1906
- ], Canvas.prototype, "textAlign", undefined);
1906
+ ], Canvas.prototype, "textAlign", void 0);
1907
1907
  __decorate([
1908
1908
  contextAttr()
1909
- ], Canvas.prototype, "textBaseline", undefined);
1909
+ ], Canvas.prototype, "textBaseline", void 0);
1910
1910
  __decorate([
1911
1911
  contextAttr()
1912
- ], Canvas.prototype, "textRendering", undefined);
1912
+ ], Canvas.prototype, "textRendering", void 0);
1913
1913
  __decorate([
1914
1914
  contextAttr()
1915
- ], Canvas.prototype, "wordSpacing", undefined);
1915
+ ], Canvas.prototype, "wordSpacing", void 0);
1916
1916
  __decorate([
1917
1917
  contextAttr()
1918
- ], Canvas.prototype, "letterSpacing", undefined);
1918
+ ], Canvas.prototype, "letterSpacing", void 0);
1919
1919
  __decorate([
1920
1920
  contextAttr()
1921
- ], Canvas.prototype, "direction", undefined);
1921
+ ], Canvas.prototype, "direction", void 0);
1922
1922
  __decorate([
1923
1923
  contextMethod()
1924
1924
  ], Canvas.prototype, "setTransform", null);
@@ -2615,7 +2615,7 @@ var LeaferUI = (function (exports) {
2615
2615
  const { M: M$4, m, L: L$5, l, H, h, V, v, C: C$4, c, S, s, Q: Q$3, q, T, t, A, a, Z: Z$4, z, N: N$3, D: D$3, X: X$3, G: G$3, F: F$4, O: O$3, P: P$3, U: U$3 } = PathCommandMap;
2616
2616
  const { rect: rect$2, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
2617
2617
  const { ellipticalArc } = EllipseHelper;
2618
- const debug$b = Debug.get('PathConvert');
2618
+ const debug$c = Debug.get('PathConvert');
2619
2619
  const setEndPoint$1 = {};
2620
2620
  const PathConvert = {
2621
2621
  current: { dot: 0 },
@@ -2856,7 +2856,7 @@ var LeaferUI = (function (exports) {
2856
2856
  i += 6;
2857
2857
  break;
2858
2858
  default:
2859
- debug$b.error(`command: ${command} [index:${i}]`, old);
2859
+ debug$c.error(`command: ${command} [index:${i}]`, old);
2860
2860
  return data;
2861
2861
  }
2862
2862
  lastCommand = command;
@@ -2965,12 +2965,10 @@ var LeaferUI = (function (exports) {
2965
2965
  },
2966
2966
  arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
2967
2967
  if (lastX !== undefined) {
2968
- const maxRadius = tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2) * (getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / 2);
2969
- data.push(U$2, x1, y1, x2, y2, min(radius, abs$2(maxRadius)));
2970
- }
2971
- else {
2972
- data.push(U$2, x1, y1, x2, y2, radius);
2968
+ const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
2969
+ radius = min(radius, min(d / 2, d / 2 * abs$2(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
2973
2970
  }
2971
+ data.push(U$2, x1, y1, x2, y2, radius);
2974
2972
  },
2975
2973
  drawEllipse(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
2976
2974
  BezierHelper.ellipse(null, x, y, radiusX, radiusY, rotation === undefined ? 0 : rotation, startAngle === undefined ? 0 : startAngle, endAngle === undefined ? 360 : endAngle, anticlockwise, null, null, startPoint);
@@ -3081,7 +3079,7 @@ var LeaferUI = (function (exports) {
3081
3079
  }
3082
3080
 
3083
3081
  const { M: M$2, L: L$3, C: C$2, Q: Q$1, Z: Z$2, N: N$1, D: D$1, X: X$1, G: G$1, F: F$2, O: O$1, P: P$1, U: U$1 } = PathCommandMap;
3084
- const debug$a = Debug.get('PathDrawer');
3082
+ const debug$b = Debug.get('PathDrawer');
3085
3083
  const PathDrawer = {
3086
3084
  drawPathByData(drawer, data) {
3087
3085
  if (!data)
@@ -3144,7 +3142,7 @@ var LeaferUI = (function (exports) {
3144
3142
  i += 6;
3145
3143
  break;
3146
3144
  default:
3147
- debug$a.error(`command: ${command} [index:${i}]`, data);
3145
+ debug$b.error(`command: ${command} [index:${i}]`, data);
3148
3146
  return;
3149
3147
  }
3150
3148
  }
@@ -3154,7 +3152,7 @@ var LeaferUI = (function (exports) {
3154
3152
  const { M: M$1, L: L$2, C: C$1, Q, Z: Z$1, N, D, X, G, F: F$1, O, P, U } = PathCommandMap;
3155
3153
  const { toTwoPointBounds, toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc, ellipse: ellipse$1 } = BezierHelper;
3156
3154
  const { addPointBounds, copy: copy$7, addPoint, setPoint, addBounds, toBounds: toBounds$2 } = TwoPointBoundsHelper;
3157
- const debug$9 = Debug.get('PathBounds');
3155
+ const debug$a = Debug.get('PathBounds');
3158
3156
  let radius, radiusX, radiusY;
3159
3157
  const tempPointBounds = {};
3160
3158
  const setPointBounds = {};
@@ -3262,7 +3260,7 @@ var LeaferUI = (function (exports) {
3262
3260
  i += 6;
3263
3261
  break;
3264
3262
  default:
3265
- debug$9.error(`command: ${command} [index:${i}]`, data);
3263
+ debug$a.error(`command: ${command} [index:${i}]`, data);
3266
3264
  return;
3267
3265
  }
3268
3266
  }
@@ -3378,7 +3376,7 @@ var LeaferUI = (function (exports) {
3378
3376
  const F = FileHelper;
3379
3377
  F.opacityTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
3380
3378
 
3381
- const debug$8 = Debug.get('TaskProcessor');
3379
+ const debug$9 = Debug.get('TaskProcessor');
3382
3380
  class TaskItem {
3383
3381
  constructor(task) {
3384
3382
  this.parallel = true;
@@ -3387,13 +3385,13 @@ var LeaferUI = (function (exports) {
3387
3385
  this.task = task;
3388
3386
  }
3389
3387
  run() {
3390
- return __awaiter(this, undefined, undefined, function* () {
3388
+ return __awaiter(this, void 0, void 0, function* () {
3391
3389
  try {
3392
3390
  if (this.task && !this.isComplete && this.parent.running)
3393
3391
  yield this.task();
3394
3392
  }
3395
3393
  catch (error) {
3396
- debug$8.error(error);
3394
+ debug$9.error(error);
3397
3395
  }
3398
3396
  });
3399
3397
  }
@@ -3626,18 +3624,52 @@ var LeaferUI = (function (exports) {
3626
3624
  }
3627
3625
  }
3628
3626
 
3629
- const ImageManager = {
3627
+ const debug$8 = Debug.get('Resource');
3628
+ const Resource = {
3629
+ tasker: new TaskProcessor(),
3630
3630
  map: {},
3631
+ get isComplete() { return R.tasker.isComplete; },
3632
+ set(key, value) {
3633
+ if (R.map[key])
3634
+ debug$8.repeat(key);
3635
+ R.map[key] = value;
3636
+ },
3637
+ get(key) {
3638
+ return R.map[key];
3639
+ },
3640
+ remove(key) {
3641
+ delete R.map[key];
3642
+ },
3643
+ loadImage(key, format) {
3644
+ return new Promise((resolve, reject) => {
3645
+ const image = this.setImage(key, key, format);
3646
+ image.load(() => resolve(image), (e) => reject(e));
3647
+ });
3648
+ },
3649
+ setImage(key, value, format) {
3650
+ let config;
3651
+ if (typeof value === 'string')
3652
+ config = { url: value };
3653
+ else if (!value.url)
3654
+ config = { url: key, view: value };
3655
+ if (config)
3656
+ format && (config.format = format), value = Creator.image(config);
3657
+ R.set(key, value);
3658
+ return value;
3659
+ },
3660
+ destroy() {
3661
+ R.map = {};
3662
+ }
3663
+ };
3664
+ const R = Resource;
3665
+
3666
+ const ImageManager = {
3631
3667
  recycledList: [],
3632
- tasker: new TaskProcessor(),
3633
3668
  patternTasker: new TaskProcessor(),
3634
- get isComplete() { return I.tasker.isComplete; },
3635
3669
  get(config) {
3636
- let image = I.map[config.url];
3637
- if (!image) {
3638
- image = Creator.image(config);
3639
- I.map[config.url] = image;
3640
- }
3670
+ let image = Resource.get(config.url);
3671
+ if (!image)
3672
+ Resource.set(config.url, image = Creator.image(config));
3641
3673
  image.use++;
3642
3674
  return image;
3643
3675
  },
@@ -3651,7 +3683,7 @@ var LeaferUI = (function (exports) {
3651
3683
  if (list.length > 100) {
3652
3684
  list.forEach(image => {
3653
3685
  if (!image.use && image.url) {
3654
- delete I.map[image.url];
3686
+ Resource.remove(image.url);
3655
3687
  image.destroy();
3656
3688
  }
3657
3689
  });
@@ -3678,7 +3710,6 @@ var LeaferUI = (function (exports) {
3678
3710
  return false;
3679
3711
  },
3680
3712
  destroy() {
3681
- I.map = {};
3682
3713
  I.recycledList = [];
3683
3714
  }
3684
3715
  };
@@ -3692,21 +3723,19 @@ var LeaferUI = (function (exports) {
3692
3723
  this.use = 0;
3693
3724
  this.waitComplete = [];
3694
3725
  this.innerId = create$1(IMAGE);
3695
- this.config = config || { url: '' };
3696
- this.isSVG = ImageManager.isFormat('svg', config);
3697
- this.hasOpacityPixel = ImageManager.hasOpacityPixel(config);
3726
+ this.config = config || (config = { url: '' });
3727
+ if (config.view) {
3728
+ const { view } = config;
3729
+ this.setView(view.config ? view.view : view);
3730
+ }
3731
+ ImageManager.isFormat('svg', config) && (this.isSVG = true);
3732
+ ImageManager.hasOpacityPixel(config) && (this.hasOpacityPixel = true);
3698
3733
  }
3699
3734
  load(onSuccess, onError) {
3700
3735
  if (!this.loading) {
3701
3736
  this.loading = true;
3702
- ImageManager.tasker.add(() => __awaiter(this, undefined, undefined, function* () {
3703
- return yield Platform.origin.loadImage(this.url).then((img) => {
3704
- this.ready = true;
3705
- this.width = img.naturalWidth || img.width;
3706
- this.height = img.naturalHeight || img.height;
3707
- this.view = img;
3708
- this.onComplete(true);
3709
- }).catch((e) => {
3737
+ Resource.tasker.add(() => __awaiter(this, void 0, void 0, function* () {
3738
+ return yield Platform.origin.loadImage(this.url).then(img => this.setView(img)).catch((e) => {
3710
3739
  this.error = e;
3711
3740
  this.onComplete(false);
3712
3741
  });
@@ -3724,6 +3753,13 @@ var LeaferUI = (function (exports) {
3724
3753
  }
3725
3754
  l[index] = l[index + 1] = undefined;
3726
3755
  }
3756
+ setView(img) {
3757
+ this.ready = true;
3758
+ this.width = img.naturalWidth || img.width;
3759
+ this.height = img.naturalHeight || img.height;
3760
+ this.view = img;
3761
+ this.onComplete(true);
3762
+ }
3727
3763
  onComplete(isSuccess) {
3728
3764
  let odd;
3729
3765
  this.waitComplete.forEach((item, index) => {
@@ -3742,6 +3778,9 @@ var LeaferUI = (function (exports) {
3742
3778
  this.waitComplete.length = 0;
3743
3779
  this.loading = false;
3744
3780
  }
3781
+ getFull(_filters) {
3782
+ return this.view;
3783
+ }
3745
3784
  getCanvas(width, height, opacity, _filters) {
3746
3785
  width || (width = this.width);
3747
3786
  height || (height = this.height);
@@ -3824,10 +3863,10 @@ var LeaferUI = (function (exports) {
3824
3863
  return decorateLeafAttr(defaultValue, (key) => attr({
3825
3864
  set(value) {
3826
3865
  if (this.__setAttr(key, value)) {
3827
- this.__layout.matrixChanged || this.__layout.matrixChange();
3828
3866
  this.__hasAutoLayout = !!(this.origin || this.around || this.flow);
3829
3867
  if (!this.__local)
3830
3868
  this.__layout.createLocal();
3869
+ doBoundsType(this);
3831
3870
  }
3832
3871
  }
3833
3872
  }));
@@ -4210,55 +4249,62 @@ var LeaferUI = (function (exports) {
4210
4249
  y += t.y;
4211
4250
  transition ? t.animate({ x, y }, transition) : (t.x = x, t.y = y);
4212
4251
  },
4213
- zoomOfWorld(t, origin, scaleX, scaleY, resize) {
4214
- L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
4252
+ zoomOfWorld(t, origin, scaleX, scaleY, resize, transition) {
4253
+ L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize, transition);
4215
4254
  },
4216
- zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize) {
4217
- copy$6(matrix, t.__localMatrix);
4255
+ zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize, transition) {
4256
+ const o = t.__localMatrix;
4257
+ if (typeof scaleY !== 'number') {
4258
+ if (scaleY)
4259
+ transition = scaleY;
4260
+ scaleY = scaleX;
4261
+ }
4262
+ copy$6(matrix, o);
4218
4263
  scaleOfOuter$2(matrix, origin, scaleX, scaleY);
4219
4264
  if (t.origin || t.around) {
4220
- L.setTransform(t, matrix, resize);
4265
+ L.setTransform(t, matrix, resize, transition);
4221
4266
  }
4222
4267
  else {
4223
- moveByMatrix(t, matrix);
4224
- t.scaleResize(scaleX, scaleY, resize !== true);
4268
+ const x = t.x + matrix.e - o.e, y = t.y + matrix.f - o.f;
4269
+ if (transition && !resize)
4270
+ t.animate({ x, y, scaleX: t.scaleX * scaleX, scaleY: t.scaleY * scaleY }, transition);
4271
+ else
4272
+ t.x = x, t.y = y, t.scaleResize(scaleX, scaleY, resize !== true);
4225
4273
  }
4226
4274
  },
4227
- rotateOfWorld(t, origin, angle) {
4228
- L.rotateOfLocal(t, getTempLocal(t, origin), angle);
4275
+ rotateOfWorld(t, origin, angle, transition) {
4276
+ L.rotateOfLocal(t, getTempLocal(t, origin), angle, transition);
4229
4277
  },
4230
- rotateOfLocal(t, origin, angle) {
4231
- copy$6(matrix, t.__localMatrix);
4278
+ rotateOfLocal(t, origin, angle, transition) {
4279
+ const o = t.__localMatrix;
4280
+ copy$6(matrix, o);
4232
4281
  rotateOfOuter$2(matrix, origin, angle);
4233
- if (t.origin || t.around) {
4234
- L.setTransform(t, matrix);
4235
- }
4236
- else {
4237
- moveByMatrix(t, matrix);
4238
- t.rotation = MathHelper.formatRotation(t.rotation + angle);
4239
- }
4282
+ if (t.origin || t.around)
4283
+ L.setTransform(t, matrix, false, transition);
4284
+ else
4285
+ t.set({ x: t.x + matrix.e - o.e, y: t.y + matrix.f - o.f, rotation: MathHelper.formatRotation(t.rotation + angle) }, transition);
4240
4286
  },
4241
- skewOfWorld(t, origin, skewX, skewY, resize) {
4242
- L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize);
4287
+ skewOfWorld(t, origin, skewX, skewY, resize, transition) {
4288
+ L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
4243
4289
  },
4244
- skewOfLocal(t, origin, skewX, skewY = 0, resize) {
4290
+ skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
4245
4291
  copy$6(matrix, t.__localMatrix);
4246
4292
  skewOfOuter(matrix, origin, skewX, skewY);
4247
- L.setTransform(t, matrix, resize);
4293
+ L.setTransform(t, matrix, resize, transition);
4248
4294
  },
4249
- transformWorld(t, transform, resize) {
4295
+ transformWorld(t, transform, resize, transition) {
4250
4296
  copy$6(matrix, t.worldTransform);
4251
4297
  multiplyParent$2(matrix, transform);
4252
4298
  if (t.parent)
4253
4299
  divideParent(matrix, t.parent.worldTransform);
4254
- L.setTransform(t, matrix, resize);
4300
+ L.setTransform(t, matrix, resize, transition);
4255
4301
  },
4256
- transform(t, transform, resize) {
4302
+ transform(t, transform, resize, transition) {
4257
4303
  copy$6(matrix, t.localTransform);
4258
4304
  multiplyParent$2(matrix, transform);
4259
- L.setTransform(t, matrix, resize);
4305
+ L.setTransform(t, matrix, resize, transition);
4260
4306
  },
4261
- setTransform(t, transform, resize) {
4307
+ setTransform(t, transform, resize, transition) {
4262
4308
  const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
4263
4309
  const layout = getLayout(transform, originPoint, data.around && L.getInnerOrigin(t, data.around));
4264
4310
  if (resize) {
@@ -4273,7 +4319,7 @@ var LeaferUI = (function (exports) {
4273
4319
  t.scaleResize(scaleX, scaleY, false);
4274
4320
  }
4275
4321
  else
4276
- t.set(layout);
4322
+ t.set(layout, transition);
4277
4323
  },
4278
4324
  getFlipTransform(t, axis) {
4279
4325
  const m = getMatrixData();
@@ -4310,11 +4356,6 @@ var LeaferUI = (function (exports) {
4310
4356
  };
4311
4357
  const L = LeafHelper;
4312
4358
  const { updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity$1, updateAllChange: updateAllChange$1 } = L;
4313
- function moveByMatrix(t, matrix) {
4314
- const { e, f } = t.__localMatrix;
4315
- t.x += matrix.e - e;
4316
- t.y += matrix.f - f;
4317
- }
4318
4359
  function getTempLocal(t, world) {
4319
4360
  t.__layout.update();
4320
4361
  return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
@@ -5220,7 +5261,7 @@ var LeaferUI = (function (exports) {
5220
5261
  if (this.__.eraser === 'path')
5221
5262
  return this.__renderEraser(canvas, options);
5222
5263
  const tempCanvas = canvas.getSameCanvas(true, true);
5223
- this.__draw(tempCanvas, options);
5264
+ this.__draw(tempCanvas, options, canvas);
5224
5265
  if (this.__worldFlipped) {
5225
5266
  canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, this.__.__blendMode, true);
5226
5267
  }
@@ -5588,11 +5629,11 @@ var LeaferUI = (function (exports) {
5588
5629
  const layer = this.leafer ? this.leafer.zoomLayer : this;
5589
5630
  return layer.getWorldPoint(page, relative, distance, change);
5590
5631
  }
5591
- setTransform(matrix, resize) {
5592
- setTransform(this, matrix, resize);
5632
+ setTransform(matrix, resize, transition) {
5633
+ setTransform(this, matrix, resize, transition);
5593
5634
  }
5594
- transform(matrix, resize) {
5595
- transform(this, matrix, resize);
5635
+ transform(matrix, resize, transition) {
5636
+ transform(this, matrix, resize, transition);
5596
5637
  }
5597
5638
  move(x, y, transition) {
5598
5639
  moveLocal(this, x, y, transition);
@@ -5600,32 +5641,32 @@ var LeaferUI = (function (exports) {
5600
5641
  moveInner(x, y, transition) {
5601
5642
  moveWorld(this, x, y, true, transition);
5602
5643
  }
5603
- scaleOf(origin, scaleX, scaleY, resize) {
5604
- zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize);
5644
+ scaleOf(origin, scaleX, scaleY, resize, transition) {
5645
+ zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize, transition);
5605
5646
  }
5606
- rotateOf(origin, rotation) {
5607
- rotateOfLocal(this, getLocalOrigin(this, origin), rotation);
5647
+ rotateOf(origin, rotation, transition) {
5648
+ rotateOfLocal(this, getLocalOrigin(this, origin), rotation, transition);
5608
5649
  }
5609
- skewOf(origin, skewX, skewY, resize) {
5610
- skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize);
5650
+ skewOf(origin, skewX, skewY, resize, transition) {
5651
+ skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize, transition);
5611
5652
  }
5612
- transformWorld(worldTransform, resize) {
5613
- transformWorld(this, worldTransform, resize);
5653
+ transformWorld(worldTransform, resize, transition) {
5654
+ transformWorld(this, worldTransform, resize, transition);
5614
5655
  }
5615
5656
  moveWorld(x, y, transition) {
5616
5657
  moveWorld(this, x, y, false, transition);
5617
5658
  }
5618
- scaleOfWorld(worldOrigin, scaleX, scaleY, resize) {
5619
- zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize);
5659
+ scaleOfWorld(worldOrigin, scaleX, scaleY, resize, transition) {
5660
+ zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize, transition);
5620
5661
  }
5621
5662
  rotateOfWorld(worldOrigin, rotation) {
5622
5663
  rotateOfWorld(this, worldOrigin, rotation);
5623
5664
  }
5624
- skewOfWorld(worldOrigin, skewX, skewY, resize) {
5625
- skewOfWorld(this, worldOrigin, skewX, skewY, resize);
5665
+ skewOfWorld(worldOrigin, skewX, skewY, resize, transition) {
5666
+ skewOfWorld(this, worldOrigin, skewX, skewY, resize, transition);
5626
5667
  }
5627
- flip(axis) {
5628
- transform(this, getFlipTransform(this, axis));
5668
+ flip(axis, transition) {
5669
+ transform(this, getFlipTransform(this, axis), false, transition);
5629
5670
  }
5630
5671
  scaleResize(scaleX, scaleY = scaleX, _noResize) {
5631
5672
  this.scaleX *= scaleX;
@@ -6013,7 +6054,7 @@ var LeaferUI = (function (exports) {
6013
6054
  }
6014
6055
  }
6015
6056
 
6016
- const version = "1.3.3";
6057
+ const version = "1.4.1";
6017
6058
 
6018
6059
  const debug$4 = Debug.get('LeaferCanvas');
6019
6060
  class LeaferCanvas extends LeaferCanvasBase {
@@ -6133,7 +6174,7 @@ var LeaferUI = (function (exports) {
6133
6174
  }
6134
6175
  }
6135
6176
  else {
6136
- window.addEventListener('resize', () => {
6177
+ window.addEventListener('resize', this.windowListener = () => {
6137
6178
  const pixelRatio = Platform.devicePixelRatio;
6138
6179
  if (this.pixelRatio !== pixelRatio) {
6139
6180
  const { width, height } = this;
@@ -6162,11 +6203,9 @@ var LeaferUI = (function (exports) {
6162
6203
  }
6163
6204
  stopAutoLayout() {
6164
6205
  this.autoLayout = false;
6165
- this.resizeListener = null;
6166
- if (this.resizeObserver) {
6206
+ if (this.resizeObserver)
6167
6207
  this.resizeObserver.disconnect();
6168
- this.resizeObserver = null;
6169
- }
6208
+ this.resizeListener = this.resizeObserver = null;
6170
6209
  }
6171
6210
  emitResize(size) {
6172
6211
  const oldSize = {};
@@ -6187,6 +6226,10 @@ var LeaferUI = (function (exports) {
6187
6226
  destroy() {
6188
6227
  if (this.view) {
6189
6228
  this.stopAutoLayout();
6229
+ if (this.windowListener) {
6230
+ window.removeEventListener('resize', this.windowListener);
6231
+ this.windowListener = null;
6232
+ }
6190
6233
  if (!this.unreal) {
6191
6234
  const view = this.view;
6192
6235
  if (view.parentElement)
@@ -6213,7 +6256,10 @@ var LeaferUI = (function (exports) {
6213
6256
  canvas.height = height;
6214
6257
  return canvas;
6215
6258
  },
6216
- canvasToDataURL: (canvas, type, quality) => canvas.toDataURL(mineType(type), quality),
6259
+ canvasToDataURL: (canvas, type, quality) => {
6260
+ const imageType = mineType(type), url = canvas.toDataURL(imageType, quality);
6261
+ return imageType === 'image/bmp' ? url.replace('image/png;', 'image/bmp;') : url;
6262
+ },
6217
6263
  canvasToBolb: (canvas, type, quality) => new Promise((resolve) => canvas.toBlob(resolve, mineType(type), quality)),
6218
6264
  canvasSaveAs: (canvas, filename, quality) => {
6219
6265
  const url = canvas.toDataURL(mineType(fileType(filename)), quality);
@@ -6258,14 +6304,14 @@ var LeaferUI = (function (exports) {
6258
6304
  Platform.name = 'web';
6259
6305
  Platform.isMobile = 'ontouchstart' in window;
6260
6306
  Platform.requestRender = function (render) { window.requestAnimationFrame(render); };
6261
- defineKey(Platform, 'devicePixelRatio', { get() { return Math.max(1, devicePixelRatio); } });
6307
+ defineKey(Platform, 'devicePixelRatio', { get() { return devicePixelRatio; } });
6262
6308
  const { userAgent } = navigator;
6263
6309
  if (userAgent.indexOf("Firefox") > -1) {
6264
6310
  Platform.conicGradientRotate90 = true;
6265
6311
  Platform.intWheelDeltaY = true;
6266
6312
  Platform.syncDomFont = true;
6267
6313
  }
6268
- else if (userAgent.indexOf("Safari") > -1 && userAgent.indexOf("Chrome") === -1) {
6314
+ else if (userAgent.indexOf("AppleWebKit") > -1) {
6269
6315
  Platform.fullImageShadow = true;
6270
6316
  }
6271
6317
  if (userAgent.indexOf('Windows') > -1) {
@@ -6534,7 +6580,7 @@ var LeaferUI = (function (exports) {
6534
6580
  }
6535
6581
  partLayout() {
6536
6582
  var _a;
6537
- if (!((_a = this.__updatedList) === null || _a === undefined ? undefined : _a.length))
6583
+ if (!((_a = this.__updatedList) === null || _a === void 0 ? void 0 : _a.length))
6538
6584
  return;
6539
6585
  const t = Run.start('PartLayout');
6540
6586
  const { target, __updatedList: updateList } = this;
@@ -6903,9 +6949,7 @@ var LeaferUI = (function (exports) {
6903
6949
  const ColorConvert = {};
6904
6950
  const UnitConvert = {
6905
6951
  number(value, percentRefer) {
6906
- if (typeof value === 'object')
6907
- return value.type === 'percent' ? value.value * percentRefer : value.value;
6908
- return value;
6952
+ return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
6909
6953
  }
6910
6954
  };
6911
6955
  const PathArrow = {};
@@ -6913,16 +6957,15 @@ var LeaferUI = (function (exports) {
6913
6957
  const PaintImage = {};
6914
6958
  const PaintGradient = {};
6915
6959
  const Effect = {};
6960
+ const Filter = {
6961
+ apply() { Plugin.need('filter'); }
6962
+ };
6916
6963
  const Export = {};
6917
6964
  const State = {
6918
- setStyleName(_leaf, _styleName, _value) { return Plugin.need('state'); },
6919
- set(_leaf, _stateName) { return Plugin.need('state'); }
6920
- };
6921
- const Transition = {
6922
- list: {},
6923
- register(attrName, fn) { Transition.list[attrName] = fn; },
6924
- get(attrName) { return Transition.list[attrName]; }
6965
+ setStyleName() { return Plugin.need('state'); },
6966
+ set() { return Plugin.need('state'); }
6925
6967
  };
6968
+ const Transition = {};
6926
6969
 
6927
6970
  const { parse, objectToCanvasData } = PathConvert;
6928
6971
  const emptyPaint = {};
@@ -7029,24 +7072,13 @@ var LeaferUI = (function (exports) {
7029
7072
  }
7030
7073
  }
7031
7074
  setShadow(value) {
7032
- this.__setInput('shadow', value);
7033
- if (value instanceof Array) {
7034
- if (value.some((item) => item.visible === false))
7035
- value = value.filter((item) => item.visible !== false);
7036
- this._shadow = value.length ? value : null;
7037
- }
7038
- else
7039
- this._shadow = value && value.visible !== false ? [value] : null;
7075
+ setArray(this, 'shadow', value);
7040
7076
  }
7041
7077
  setInnerShadow(value) {
7042
- this.__setInput('innerShadow', value);
7043
- if (value instanceof Array) {
7044
- if (value.some((item) => item.visible === false))
7045
- value = value.filter((item) => item.visible !== false);
7046
- this._innerShadow = value.length ? value : null;
7047
- }
7048
- else
7049
- this._innerShadow = value && value.visible !== false ? [value] : null;
7078
+ setArray(this, 'innerShadow', value);
7079
+ }
7080
+ setFilter(value) {
7081
+ setArray(this, 'filter', value);
7050
7082
  }
7051
7083
  __computePaint() {
7052
7084
  const { fill, stroke } = this.__input;
@@ -7057,6 +7089,17 @@ var LeaferUI = (function (exports) {
7057
7089
  this.__needComputePaint = false;
7058
7090
  }
7059
7091
  }
7092
+ function setArray(data, key, value) {
7093
+ data.__setInput(key, value);
7094
+ if (value instanceof Array) {
7095
+ if (value.some((item) => item.visible === false))
7096
+ value = value.filter((item) => item.visible !== false);
7097
+ value.length || (value = null);
7098
+ }
7099
+ else
7100
+ value = value && value.visible !== false ? [value] : null;
7101
+ data['_' + key] = value;
7102
+ }
7060
7103
 
7061
7104
  class GroupData extends UIData {
7062
7105
  }
@@ -7179,11 +7222,13 @@ var LeaferUI = (function (exports) {
7179
7222
  },
7180
7223
  __updateRenderSpread() {
7181
7224
  let width = 0;
7182
- const { shadow, innerShadow, blur, backgroundBlur } = this.__;
7225
+ const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
7183
7226
  if (shadow)
7184
7227
  shadow.forEach(item => width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5));
7185
7228
  if (blur)
7186
7229
  width = Math.max(width, blur);
7230
+ if (filter)
7231
+ width += Filter.getSpread(filter);
7187
7232
  let shapeWidth = width = Math.ceil(width);
7188
7233
  if (innerShadow)
7189
7234
  innerShadow.forEach(item => shapeWidth = Math.max(shapeWidth, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5));
@@ -7198,8 +7243,8 @@ var LeaferUI = (function (exports) {
7198
7243
  __updateChange() {
7199
7244
  const data = this.__;
7200
7245
  if (data.__useEffect) {
7201
- const { shadow, innerShadow, blur, backgroundBlur } = this.__;
7202
- data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur);
7246
+ const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
7247
+ data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur || filter);
7203
7248
  }
7204
7249
  data.__checkSingle();
7205
7250
  const complex = data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect;
@@ -7213,7 +7258,7 @@ var LeaferUI = (function (exports) {
7213
7258
  __drawFast(canvas, options) {
7214
7259
  drawFast(this, canvas, options);
7215
7260
  },
7216
- __draw(canvas, options) {
7261
+ __draw(canvas, options, originCanvas) {
7217
7262
  const data = this.__;
7218
7263
  if (data.__complex) {
7219
7264
  if (data.__needComputePaint)
@@ -7223,7 +7268,7 @@ var LeaferUI = (function (exports) {
7223
7268
  if (data.__useEffect) {
7224
7269
  const shape = Paint.shape(this, canvas, options);
7225
7270
  this.__nowWorld = this.__getNowWorld(options);
7226
- const { shadow, innerShadow } = data;
7271
+ const { shadow, innerShadow, filter } = data;
7227
7272
  if (shadow)
7228
7273
  Effect.shadow(this, canvas, shape);
7229
7274
  if (fill)
@@ -7234,6 +7279,8 @@ var LeaferUI = (function (exports) {
7234
7279
  Effect.innerShadow(this, canvas, shape);
7235
7280
  if (stroke)
7236
7281
  data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
7282
+ if (filter)
7283
+ Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
7237
7284
  if (shape.worldCanvas)
7238
7285
  shape.worldCanvas.recycle();
7239
7286
  shape.canvas.recycle();
@@ -7453,199 +7500,202 @@ var LeaferUI = (function (exports) {
7453
7500
  };
7454
7501
  __decorate([
7455
7502
  dataProcessor(UIData)
7456
- ], exports.UI.prototype, "__", undefined);
7503
+ ], exports.UI.prototype, "__", void 0);
7457
7504
  __decorate([
7458
7505
  zoomLayerType()
7459
- ], exports.UI.prototype, "zoomLayer", undefined);
7506
+ ], exports.UI.prototype, "zoomLayer", void 0);
7460
7507
  __decorate([
7461
7508
  dataType('')
7462
- ], exports.UI.prototype, "id", undefined);
7509
+ ], exports.UI.prototype, "id", void 0);
7463
7510
  __decorate([
7464
7511
  dataType('')
7465
- ], exports.UI.prototype, "name", undefined);
7512
+ ], exports.UI.prototype, "name", void 0);
7466
7513
  __decorate([
7467
7514
  dataType('')
7468
- ], exports.UI.prototype, "className", undefined);
7515
+ ], exports.UI.prototype, "className", void 0);
7469
7516
  __decorate([
7470
7517
  surfaceType('pass-through')
7471
- ], exports.UI.prototype, "blendMode", undefined);
7518
+ ], exports.UI.prototype, "blendMode", void 0);
7472
7519
  __decorate([
7473
7520
  opacityType(1)
7474
- ], exports.UI.prototype, "opacity", undefined);
7521
+ ], exports.UI.prototype, "opacity", void 0);
7475
7522
  __decorate([
7476
7523
  visibleType(true)
7477
- ], exports.UI.prototype, "visible", undefined);
7524
+ ], exports.UI.prototype, "visible", void 0);
7478
7525
  __decorate([
7479
7526
  surfaceType(false)
7480
- ], exports.UI.prototype, "locked", undefined);
7527
+ ], exports.UI.prototype, "locked", void 0);
7481
7528
  __decorate([
7482
7529
  sortType(0)
7483
- ], exports.UI.prototype, "zIndex", undefined);
7530
+ ], exports.UI.prototype, "zIndex", void 0);
7484
7531
  __decorate([
7485
7532
  maskType(false)
7486
- ], exports.UI.prototype, "mask", undefined);
7533
+ ], exports.UI.prototype, "mask", void 0);
7487
7534
  __decorate([
7488
7535
  eraserType(false)
7489
- ], exports.UI.prototype, "eraser", undefined);
7536
+ ], exports.UI.prototype, "eraser", void 0);
7490
7537
  __decorate([
7491
7538
  positionType(0, true)
7492
- ], exports.UI.prototype, "x", undefined);
7539
+ ], exports.UI.prototype, "x", void 0);
7493
7540
  __decorate([
7494
7541
  positionType(0, true)
7495
- ], exports.UI.prototype, "y", undefined);
7542
+ ], exports.UI.prototype, "y", void 0);
7496
7543
  __decorate([
7497
7544
  boundsType(100, true)
7498
- ], exports.UI.prototype, "width", undefined);
7545
+ ], exports.UI.prototype, "width", void 0);
7499
7546
  __decorate([
7500
7547
  boundsType(100, true)
7501
- ], exports.UI.prototype, "height", undefined);
7548
+ ], exports.UI.prototype, "height", void 0);
7502
7549
  __decorate([
7503
7550
  scaleType(1, true)
7504
- ], exports.UI.prototype, "scaleX", undefined);
7551
+ ], exports.UI.prototype, "scaleX", void 0);
7505
7552
  __decorate([
7506
7553
  scaleType(1, true)
7507
- ], exports.UI.prototype, "scaleY", undefined);
7554
+ ], exports.UI.prototype, "scaleY", void 0);
7508
7555
  __decorate([
7509
7556
  rotationType(0, true)
7510
- ], exports.UI.prototype, "rotation", undefined);
7557
+ ], exports.UI.prototype, "rotation", void 0);
7511
7558
  __decorate([
7512
7559
  rotationType(0, true)
7513
- ], exports.UI.prototype, "skewX", undefined);
7560
+ ], exports.UI.prototype, "skewX", void 0);
7514
7561
  __decorate([
7515
7562
  rotationType(0, true)
7516
- ], exports.UI.prototype, "skewY", undefined);
7563
+ ], exports.UI.prototype, "skewY", void 0);
7517
7564
  __decorate([
7518
7565
  positionType(0, true)
7519
- ], exports.UI.prototype, "offsetX", undefined);
7566
+ ], exports.UI.prototype, "offsetX", void 0);
7520
7567
  __decorate([
7521
7568
  positionType(0, true)
7522
- ], exports.UI.prototype, "offsetY", undefined);
7569
+ ], exports.UI.prototype, "offsetY", void 0);
7523
7570
  __decorate([
7524
7571
  positionType(0, true)
7525
- ], exports.UI.prototype, "scrollX", undefined);
7572
+ ], exports.UI.prototype, "scrollX", void 0);
7526
7573
  __decorate([
7527
7574
  positionType(0, true)
7528
- ], exports.UI.prototype, "scrollY", undefined);
7575
+ ], exports.UI.prototype, "scrollY", void 0);
7529
7576
  __decorate([
7530
7577
  autoLayoutType()
7531
- ], exports.UI.prototype, "origin", undefined);
7578
+ ], exports.UI.prototype, "origin", void 0);
7532
7579
  __decorate([
7533
7580
  autoLayoutType()
7534
- ], exports.UI.prototype, "around", undefined);
7581
+ ], exports.UI.prototype, "around", void 0);
7535
7582
  __decorate([
7536
7583
  dataType(false)
7537
- ], exports.UI.prototype, "lazy", undefined);
7584
+ ], exports.UI.prototype, "lazy", void 0);
7538
7585
  __decorate([
7539
7586
  naturalBoundsType(1)
7540
- ], exports.UI.prototype, "pixelRatio", undefined);
7587
+ ], exports.UI.prototype, "pixelRatio", void 0);
7541
7588
  __decorate([
7542
7589
  pathInputType()
7543
- ], exports.UI.prototype, "path", undefined);
7590
+ ], exports.UI.prototype, "path", void 0);
7544
7591
  __decorate([
7545
7592
  pathType()
7546
- ], exports.UI.prototype, "windingRule", undefined);
7593
+ ], exports.UI.prototype, "windingRule", void 0);
7547
7594
  __decorate([
7548
7595
  pathType(true)
7549
- ], exports.UI.prototype, "closed", undefined);
7596
+ ], exports.UI.prototype, "closed", void 0);
7550
7597
  __decorate([
7551
7598
  boundsType(0)
7552
- ], exports.UI.prototype, "padding", undefined);
7599
+ ], exports.UI.prototype, "padding", void 0);
7553
7600
  __decorate([
7554
7601
  boundsType(false)
7555
- ], exports.UI.prototype, "lockRatio", undefined);
7602
+ ], exports.UI.prototype, "lockRatio", void 0);
7556
7603
  __decorate([
7557
7604
  boundsType()
7558
- ], exports.UI.prototype, "widthRange", undefined);
7605
+ ], exports.UI.prototype, "widthRange", void 0);
7559
7606
  __decorate([
7560
7607
  boundsType()
7561
- ], exports.UI.prototype, "heightRange", undefined);
7608
+ ], exports.UI.prototype, "heightRange", void 0);
7562
7609
  __decorate([
7563
7610
  dataType(false)
7564
- ], exports.UI.prototype, "draggable", undefined);
7611
+ ], exports.UI.prototype, "draggable", void 0);
7565
7612
  __decorate([
7566
7613
  dataType()
7567
- ], exports.UI.prototype, "dragBounds", undefined);
7614
+ ], exports.UI.prototype, "dragBounds", void 0);
7568
7615
  __decorate([
7569
7616
  dataType(false)
7570
- ], exports.UI.prototype, "editable", undefined);
7617
+ ], exports.UI.prototype, "editable", void 0);
7571
7618
  __decorate([
7572
7619
  hitType(true)
7573
- ], exports.UI.prototype, "hittable", undefined);
7620
+ ], exports.UI.prototype, "hittable", void 0);
7574
7621
  __decorate([
7575
7622
  hitType('path')
7576
- ], exports.UI.prototype, "hitFill", undefined);
7623
+ ], exports.UI.prototype, "hitFill", void 0);
7577
7624
  __decorate([
7578
7625
  strokeType('path')
7579
- ], exports.UI.prototype, "hitStroke", undefined);
7626
+ ], exports.UI.prototype, "hitStroke", void 0);
7580
7627
  __decorate([
7581
7628
  hitType(false)
7582
- ], exports.UI.prototype, "hitBox", undefined);
7629
+ ], exports.UI.prototype, "hitBox", void 0);
7583
7630
  __decorate([
7584
7631
  hitType(true)
7585
- ], exports.UI.prototype, "hitChildren", undefined);
7632
+ ], exports.UI.prototype, "hitChildren", void 0);
7586
7633
  __decorate([
7587
7634
  hitType(true)
7588
- ], exports.UI.prototype, "hitSelf", undefined);
7635
+ ], exports.UI.prototype, "hitSelf", void 0);
7589
7636
  __decorate([
7590
7637
  hitType()
7591
- ], exports.UI.prototype, "hitRadius", undefined);
7638
+ ], exports.UI.prototype, "hitRadius", void 0);
7592
7639
  __decorate([
7593
7640
  cursorType('')
7594
- ], exports.UI.prototype, "cursor", undefined);
7641
+ ], exports.UI.prototype, "cursor", void 0);
7595
7642
  __decorate([
7596
7643
  surfaceType()
7597
- ], exports.UI.prototype, "fill", undefined);
7644
+ ], exports.UI.prototype, "fill", void 0);
7598
7645
  __decorate([
7599
7646
  strokeType()
7600
- ], exports.UI.prototype, "stroke", undefined);
7647
+ ], exports.UI.prototype, "stroke", void 0);
7601
7648
  __decorate([
7602
7649
  strokeType('inside')
7603
- ], exports.UI.prototype, "strokeAlign", undefined);
7650
+ ], exports.UI.prototype, "strokeAlign", void 0);
7604
7651
  __decorate([
7605
7652
  strokeType(1)
7606
- ], exports.UI.prototype, "strokeWidth", undefined);
7653
+ ], exports.UI.prototype, "strokeWidth", void 0);
7607
7654
  __decorate([
7608
7655
  strokeType(false)
7609
- ], exports.UI.prototype, "strokeWidthFixed", undefined);
7656
+ ], exports.UI.prototype, "strokeWidthFixed", void 0);
7610
7657
  __decorate([
7611
7658
  strokeType('none')
7612
- ], exports.UI.prototype, "strokeCap", undefined);
7659
+ ], exports.UI.prototype, "strokeCap", void 0);
7613
7660
  __decorate([
7614
7661
  strokeType('miter')
7615
- ], exports.UI.prototype, "strokeJoin", undefined);
7662
+ ], exports.UI.prototype, "strokeJoin", void 0);
7616
7663
  __decorate([
7617
7664
  strokeType()
7618
- ], exports.UI.prototype, "dashPattern", undefined);
7665
+ ], exports.UI.prototype, "dashPattern", void 0);
7619
7666
  __decorate([
7620
7667
  strokeType()
7621
- ], exports.UI.prototype, "dashOffset", undefined);
7668
+ ], exports.UI.prototype, "dashOffset", void 0);
7622
7669
  __decorate([
7623
7670
  strokeType(10)
7624
- ], exports.UI.prototype, "miterLimit", undefined);
7671
+ ], exports.UI.prototype, "miterLimit", void 0);
7625
7672
  __decorate([
7626
7673
  pathType(0)
7627
- ], exports.UI.prototype, "cornerRadius", undefined);
7674
+ ], exports.UI.prototype, "cornerRadius", void 0);
7628
7675
  __decorate([
7629
7676
  pathType()
7630
- ], exports.UI.prototype, "cornerSmoothing", undefined);
7677
+ ], exports.UI.prototype, "cornerSmoothing", void 0);
7678
+ __decorate([
7679
+ effectType()
7680
+ ], exports.UI.prototype, "shadow", void 0);
7631
7681
  __decorate([
7632
7682
  effectType()
7633
- ], exports.UI.prototype, "shadow", undefined);
7683
+ ], exports.UI.prototype, "innerShadow", void 0);
7634
7684
  __decorate([
7635
7685
  effectType()
7636
- ], exports.UI.prototype, "innerShadow", undefined);
7686
+ ], exports.UI.prototype, "blur", void 0);
7637
7687
  __decorate([
7638
7688
  effectType()
7639
- ], exports.UI.prototype, "blur", undefined);
7689
+ ], exports.UI.prototype, "backgroundBlur", void 0);
7640
7690
  __decorate([
7641
7691
  effectType()
7642
- ], exports.UI.prototype, "backgroundBlur", undefined);
7692
+ ], exports.UI.prototype, "grayscale", void 0);
7643
7693
  __decorate([
7644
7694
  effectType()
7645
- ], exports.UI.prototype, "grayscale", undefined);
7695
+ ], exports.UI.prototype, "filter", void 0);
7646
7696
  __decorate([
7647
7697
  dataType({})
7648
- ], exports.UI.prototype, "data", undefined);
7698
+ ], exports.UI.prototype, "data", void 0);
7649
7699
  __decorate([
7650
7700
  rewrite(exports.Leaf.prototype.reset)
7651
7701
  ], exports.UI.prototype, "reset", null);
@@ -7706,7 +7756,7 @@ var LeaferUI = (function (exports) {
7706
7756
  };
7707
7757
  __decorate([
7708
7758
  dataProcessor(GroupData)
7709
- ], exports.Group.prototype, "__", undefined);
7759
+ ], exports.Group.prototype, "__", void 0);
7710
7760
  exports.Group = __decorate([
7711
7761
  useModule(exports.Branch),
7712
7762
  registerUI()
@@ -7719,7 +7769,7 @@ var LeaferUI = (function (exports) {
7719
7769
  get isApp() { return false; }
7720
7770
  get app() { return this.parent || this; }
7721
7771
  get isLeafer() { return true; }
7722
- get imageReady() { return this.viewReady && ImageManager.isComplete; }
7772
+ get imageReady() { return this.viewReady && Resource.isComplete; }
7723
7773
  get layoutLocked() { return !this.layouter.running; }
7724
7774
  get FPS() { return this.renderer ? this.renderer.FPS : 60; }
7725
7775
  get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
@@ -7930,13 +7980,13 @@ var LeaferUI = (function (exports) {
7930
7980
  WaitHelper.run(this.__viewReadyWait);
7931
7981
  }
7932
7982
  __onLayoutEnd() {
7933
- const { grow, growWidth, growHeight } = this.config;
7983
+ const { grow, width: fixedWidth, height: fixedHeight } = this.config;
7934
7984
  if (grow) {
7935
7985
  let { width, height, pixelRatio } = this;
7936
7986
  const bounds = grow === 'box' ? this.worldBoxBounds : this.__world;
7937
- if (growWidth !== false)
7987
+ if (!fixedWidth)
7938
7988
  width = Math.max(1, bounds.x + bounds.width);
7939
- if (growHeight !== false)
7989
+ if (!fixedHeight)
7940
7990
  height = Math.max(1, bounds.y + bounds.height);
7941
7991
  this.__doResize({ width, height, pixelRatio });
7942
7992
  }
@@ -8014,7 +8064,7 @@ var LeaferUI = (function (exports) {
8014
8064
  list.push(item);
8015
8065
  this.requestRender();
8016
8066
  }
8017
- zoom(_zoomType, _padding, _fixedScale) {
8067
+ zoom(_zoomType, _padding, _fixedScale, _transition) {
8018
8068
  return Plugin.need('view');
8019
8069
  }
8020
8070
  getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
@@ -8079,10 +8129,10 @@ var LeaferUI = (function (exports) {
8079
8129
  exports.Leafer.list = new LeafList();
8080
8130
  __decorate([
8081
8131
  dataProcessor(LeaferData)
8082
- ], exports.Leafer.prototype, "__", undefined);
8132
+ ], exports.Leafer.prototype, "__", void 0);
8083
8133
  __decorate([
8084
8134
  boundsType()
8085
- ], exports.Leafer.prototype, "pixelRatio", undefined);
8135
+ ], exports.Leafer.prototype, "pixelRatio", void 0);
8086
8136
  exports.Leafer = Leafer_1 = __decorate([
8087
8137
  registerUI()
8088
8138
  ], exports.Leafer);
@@ -8095,7 +8145,7 @@ var LeaferUI = (function (exports) {
8095
8145
  };
8096
8146
  __decorate([
8097
8147
  dataProcessor(RectData)
8098
- ], exports.Rect.prototype, "__", undefined);
8148
+ ], exports.Rect.prototype, "__", void 0);
8099
8149
  exports.Rect = __decorate([
8100
8150
  useModule(RectRender),
8101
8151
  rewriteAble(),
@@ -8186,13 +8236,13 @@ var LeaferUI = (function (exports) {
8186
8236
  };
8187
8237
  __decorate([
8188
8238
  dataProcessor(BoxData)
8189
- ], exports.Box.prototype, "__", undefined);
8239
+ ], exports.Box.prototype, "__", void 0);
8190
8240
  __decorate([
8191
8241
  dataType(false)
8192
- ], exports.Box.prototype, "resizeChildren", undefined);
8242
+ ], exports.Box.prototype, "resizeChildren", void 0);
8193
8243
  __decorate([
8194
8244
  affectRenderBoundsType('show')
8195
- ], exports.Box.prototype, "overflow", undefined);
8245
+ ], exports.Box.prototype, "overflow", void 0);
8196
8246
  __decorate([
8197
8247
  rewrite(rect.__updateStrokeSpread)
8198
8248
  ], exports.Box.prototype, "__updateStrokeSpread", null);
@@ -8231,13 +8281,13 @@ var LeaferUI = (function (exports) {
8231
8281
  };
8232
8282
  __decorate([
8233
8283
  dataProcessor(FrameData)
8234
- ], exports.Frame.prototype, "__", undefined);
8284
+ ], exports.Frame.prototype, "__", void 0);
8235
8285
  __decorate([
8236
8286
  surfaceType('#FFFFFF')
8237
- ], exports.Frame.prototype, "fill", undefined);
8287
+ ], exports.Frame.prototype, "fill", void 0);
8238
8288
  __decorate([
8239
8289
  affectRenderBoundsType('hide')
8240
- ], exports.Frame.prototype, "overflow", undefined);
8290
+ ], exports.Frame.prototype, "overflow", void 0);
8241
8291
  exports.Frame = __decorate([
8242
8292
  registerUI()
8243
8293
  ], exports.Frame);
@@ -8284,16 +8334,16 @@ var LeaferUI = (function (exports) {
8284
8334
  };
8285
8335
  __decorate([
8286
8336
  dataProcessor(EllipseData)
8287
- ], exports.Ellipse.prototype, "__", undefined);
8337
+ ], exports.Ellipse.prototype, "__", void 0);
8288
8338
  __decorate([
8289
8339
  pathType(0)
8290
- ], exports.Ellipse.prototype, "innerRadius", undefined);
8340
+ ], exports.Ellipse.prototype, "innerRadius", void 0);
8291
8341
  __decorate([
8292
8342
  pathType(0)
8293
- ], exports.Ellipse.prototype, "startAngle", undefined);
8343
+ ], exports.Ellipse.prototype, "startAngle", void 0);
8294
8344
  __decorate([
8295
8345
  pathType(0)
8296
- ], exports.Ellipse.prototype, "endAngle", undefined);
8346
+ ], exports.Ellipse.prototype, "endAngle", void 0);
8297
8347
  exports.Ellipse = __decorate([
8298
8348
  registerUI()
8299
8349
  ], exports.Ellipse);
@@ -8352,22 +8402,22 @@ var LeaferUI = (function (exports) {
8352
8402
  };
8353
8403
  __decorate([
8354
8404
  dataProcessor(LineData)
8355
- ], exports.Line.prototype, "__", undefined);
8405
+ ], exports.Line.prototype, "__", void 0);
8356
8406
  __decorate([
8357
8407
  affectStrokeBoundsType('center')
8358
- ], exports.Line.prototype, "strokeAlign", undefined);
8408
+ ], exports.Line.prototype, "strokeAlign", void 0);
8359
8409
  __decorate([
8360
8410
  boundsType(0)
8361
- ], exports.Line.prototype, "height", undefined);
8411
+ ], exports.Line.prototype, "height", void 0);
8362
8412
  __decorate([
8363
8413
  pathType()
8364
- ], exports.Line.prototype, "points", undefined);
8414
+ ], exports.Line.prototype, "points", void 0);
8365
8415
  __decorate([
8366
8416
  pathType(0)
8367
- ], exports.Line.prototype, "curve", undefined);
8417
+ ], exports.Line.prototype, "curve", void 0);
8368
8418
  __decorate([
8369
8419
  pathType(false)
8370
- ], exports.Line.prototype, "closed", undefined);
8420
+ ], exports.Line.prototype, "closed", void 0);
8371
8421
  exports.Line = __decorate([
8372
8422
  registerUI()
8373
8423
  ], exports.Line);
@@ -8400,16 +8450,16 @@ var LeaferUI = (function (exports) {
8400
8450
  };
8401
8451
  __decorate([
8402
8452
  dataProcessor(PolygonData)
8403
- ], exports.Polygon.prototype, "__", undefined);
8453
+ ], exports.Polygon.prototype, "__", void 0);
8404
8454
  __decorate([
8405
8455
  pathType(3)
8406
- ], exports.Polygon.prototype, "sides", undefined);
8456
+ ], exports.Polygon.prototype, "sides", void 0);
8407
8457
  __decorate([
8408
8458
  pathType()
8409
- ], exports.Polygon.prototype, "points", undefined);
8459
+ ], exports.Polygon.prototype, "points", void 0);
8410
8460
  __decorate([
8411
8461
  pathType(0)
8412
- ], exports.Polygon.prototype, "curve", undefined);
8462
+ ], exports.Polygon.prototype, "curve", void 0);
8413
8463
  __decorate([
8414
8464
  rewrite(line.__updateRenderPath)
8415
8465
  ], exports.Polygon.prototype, "__updateRenderPath", null);
@@ -8441,13 +8491,13 @@ var LeaferUI = (function (exports) {
8441
8491
  };
8442
8492
  __decorate([
8443
8493
  dataProcessor(StarData)
8444
- ], exports.Star.prototype, "__", undefined);
8494
+ ], exports.Star.prototype, "__", void 0);
8445
8495
  __decorate([
8446
8496
  pathType(5)
8447
- ], exports.Star.prototype, "corners", undefined);
8497
+ ], exports.Star.prototype, "corners", void 0);
8448
8498
  __decorate([
8449
8499
  pathType(0.382)
8450
- ], exports.Star.prototype, "innerRadius", undefined);
8500
+ ], exports.Star.prototype, "innerRadius", void 0);
8451
8501
  exports.Star = __decorate([
8452
8502
  registerUI()
8453
8503
  ], exports.Star);
@@ -8469,10 +8519,10 @@ var LeaferUI = (function (exports) {
8469
8519
  };
8470
8520
  __decorate([
8471
8521
  dataProcessor(ImageData)
8472
- ], exports.Image.prototype, "__", undefined);
8522
+ ], exports.Image.prototype, "__", void 0);
8473
8523
  __decorate([
8474
8524
  boundsType('')
8475
- ], exports.Image.prototype, "url", undefined);
8525
+ ], exports.Image.prototype, "url", void 0);
8476
8526
  exports.Image = __decorate([
8477
8527
  registerUI()
8478
8528
  ], exports.Image);
@@ -8535,25 +8585,25 @@ var LeaferUI = (function (exports) {
8535
8585
  };
8536
8586
  __decorate([
8537
8587
  dataProcessor(CanvasData)
8538
- ], exports.Canvas.prototype, "__", undefined);
8588
+ ], exports.Canvas.prototype, "__", void 0);
8539
8589
  __decorate([
8540
8590
  resizeType(100)
8541
- ], exports.Canvas.prototype, "width", undefined);
8591
+ ], exports.Canvas.prototype, "width", void 0);
8542
8592
  __decorate([
8543
8593
  resizeType(100)
8544
- ], exports.Canvas.prototype, "height", undefined);
8594
+ ], exports.Canvas.prototype, "height", void 0);
8545
8595
  __decorate([
8546
8596
  resizeType(1)
8547
- ], exports.Canvas.prototype, "pixelRatio", undefined);
8597
+ ], exports.Canvas.prototype, "pixelRatio", void 0);
8548
8598
  __decorate([
8549
8599
  resizeType(true)
8550
- ], exports.Canvas.prototype, "smooth", undefined);
8600
+ ], exports.Canvas.prototype, "smooth", void 0);
8551
8601
  __decorate([
8552
8602
  dataType(false)
8553
- ], exports.Canvas.prototype, "safeResize", undefined);
8603
+ ], exports.Canvas.prototype, "safeResize", void 0);
8554
8604
  __decorate([
8555
8605
  resizeType()
8556
- ], exports.Canvas.prototype, "contextSettings", undefined);
8606
+ ], exports.Canvas.prototype, "contextSettings", void 0);
8557
8607
  exports.Canvas = __decorate([
8558
8608
  registerUI()
8559
8609
  ], exports.Canvas);
@@ -8644,76 +8694,76 @@ var LeaferUI = (function (exports) {
8644
8694
  };
8645
8695
  __decorate([
8646
8696
  dataProcessor(TextData)
8647
- ], exports.Text.prototype, "__", undefined);
8697
+ ], exports.Text.prototype, "__", void 0);
8648
8698
  __decorate([
8649
8699
  boundsType(0)
8650
- ], exports.Text.prototype, "width", undefined);
8700
+ ], exports.Text.prototype, "width", void 0);
8651
8701
  __decorate([
8652
8702
  boundsType(0)
8653
- ], exports.Text.prototype, "height", undefined);
8703
+ ], exports.Text.prototype, "height", void 0);
8654
8704
  __decorate([
8655
8705
  dataType(false)
8656
- ], exports.Text.prototype, "resizeFontSize", undefined);
8706
+ ], exports.Text.prototype, "resizeFontSize", void 0);
8657
8707
  __decorate([
8658
8708
  surfaceType('#000000')
8659
- ], exports.Text.prototype, "fill", undefined);
8709
+ ], exports.Text.prototype, "fill", void 0);
8660
8710
  __decorate([
8661
8711
  affectStrokeBoundsType('outside')
8662
- ], exports.Text.prototype, "strokeAlign", undefined);
8712
+ ], exports.Text.prototype, "strokeAlign", void 0);
8663
8713
  __decorate([
8664
8714
  hitType('all')
8665
- ], exports.Text.prototype, "hitFill", undefined);
8715
+ ], exports.Text.prototype, "hitFill", void 0);
8666
8716
  __decorate([
8667
8717
  boundsType('')
8668
- ], exports.Text.prototype, "text", undefined);
8718
+ ], exports.Text.prototype, "text", void 0);
8669
8719
  __decorate([
8670
8720
  boundsType('caption')
8671
- ], exports.Text.prototype, "fontFamily", undefined);
8721
+ ], exports.Text.prototype, "fontFamily", void 0);
8672
8722
  __decorate([
8673
8723
  boundsType(12)
8674
- ], exports.Text.prototype, "fontSize", undefined);
8724
+ ], exports.Text.prototype, "fontSize", void 0);
8675
8725
  __decorate([
8676
8726
  boundsType('normal')
8677
- ], exports.Text.prototype, "fontWeight", undefined);
8727
+ ], exports.Text.prototype, "fontWeight", void 0);
8678
8728
  __decorate([
8679
8729
  boundsType(false)
8680
- ], exports.Text.prototype, "italic", undefined);
8730
+ ], exports.Text.prototype, "italic", void 0);
8681
8731
  __decorate([
8682
8732
  boundsType('none')
8683
- ], exports.Text.prototype, "textCase", undefined);
8733
+ ], exports.Text.prototype, "textCase", void 0);
8684
8734
  __decorate([
8685
8735
  boundsType('none')
8686
- ], exports.Text.prototype, "textDecoration", undefined);
8736
+ ], exports.Text.prototype, "textDecoration", void 0);
8687
8737
  __decorate([
8688
8738
  boundsType(0)
8689
- ], exports.Text.prototype, "letterSpacing", undefined);
8739
+ ], exports.Text.prototype, "letterSpacing", void 0);
8690
8740
  __decorate([
8691
8741
  boundsType({ type: 'percent', value: 1.5 })
8692
- ], exports.Text.prototype, "lineHeight", undefined);
8742
+ ], exports.Text.prototype, "lineHeight", void 0);
8693
8743
  __decorate([
8694
8744
  boundsType(0)
8695
- ], exports.Text.prototype, "paraIndent", undefined);
8745
+ ], exports.Text.prototype, "paraIndent", void 0);
8696
8746
  __decorate([
8697
8747
  boundsType(0)
8698
- ], exports.Text.prototype, "paraSpacing", undefined);
8748
+ ], exports.Text.prototype, "paraSpacing", void 0);
8699
8749
  __decorate([
8700
8750
  boundsType('x')
8701
- ], exports.Text.prototype, "writingMode", undefined);
8751
+ ], exports.Text.prototype, "writingMode", void 0);
8702
8752
  __decorate([
8703
8753
  boundsType('left')
8704
- ], exports.Text.prototype, "textAlign", undefined);
8754
+ ], exports.Text.prototype, "textAlign", void 0);
8705
8755
  __decorate([
8706
8756
  boundsType('top')
8707
- ], exports.Text.prototype, "verticalAlign", undefined);
8757
+ ], exports.Text.prototype, "verticalAlign", void 0);
8708
8758
  __decorate([
8709
8759
  boundsType(true)
8710
- ], exports.Text.prototype, "autoSizeAlign", undefined);
8760
+ ], exports.Text.prototype, "autoSizeAlign", void 0);
8711
8761
  __decorate([
8712
8762
  boundsType('normal')
8713
- ], exports.Text.prototype, "textWrap", undefined);
8763
+ ], exports.Text.prototype, "textWrap", void 0);
8714
8764
  __decorate([
8715
8765
  boundsType('show')
8716
- ], exports.Text.prototype, "textOverflow", undefined);
8766
+ ], exports.Text.prototype, "textOverflow", void 0);
8717
8767
  exports.Text = __decorate([
8718
8768
  registerUI()
8719
8769
  ], exports.Text);
@@ -8726,10 +8776,10 @@ var LeaferUI = (function (exports) {
8726
8776
  };
8727
8777
  __decorate([
8728
8778
  dataProcessor(PathData)
8729
- ], exports.Path.prototype, "__", undefined);
8779
+ ], exports.Path.prototype, "__", void 0);
8730
8780
  __decorate([
8731
8781
  affectStrokeBoundsType('center')
8732
- ], exports.Path.prototype, "strokeAlign", undefined);
8782
+ ], exports.Path.prototype, "strokeAlign", void 0);
8733
8783
  exports.Path = __decorate([
8734
8784
  registerUI()
8735
8785
  ], exports.Path);
@@ -8768,10 +8818,10 @@ var LeaferUI = (function (exports) {
8768
8818
  };
8769
8819
  __decorate([
8770
8820
  dataProcessor(PenData)
8771
- ], exports.Pen.prototype, "__", undefined);
8821
+ ], exports.Pen.prototype, "__", void 0);
8772
8822
  __decorate([
8773
8823
  penPathType()
8774
- ], exports.Pen.prototype, "path", undefined);
8824
+ ], exports.Pen.prototype, "path", void 0);
8775
8825
  exports.Pen = __decorate([
8776
8826
  useModule(PathCreator, ['set', 'path', 'paint']),
8777
8827
  registerUI()
@@ -9143,7 +9193,7 @@ var LeaferUI = (function (exports) {
9143
9193
  box = tempBox.set(box).shrink(paint.padding);
9144
9194
  if (paint.mode === 'strench')
9145
9195
  paint.mode = 'stretch';
9146
- const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
9196
+ const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
9147
9197
  const sameBox = box.width === width && box.height === height;
9148
9198
  const data = { mode };
9149
9199
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -9206,6 +9256,8 @@ var LeaferUI = (function (exports) {
9206
9256
  data.height = height;
9207
9257
  if (opacity)
9208
9258
  data.opacity = opacity;
9259
+ if (filters)
9260
+ data.filters = filters;
9209
9261
  if (repeat)
9210
9262
  data.repeat = typeof repeat === 'string' ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat';
9211
9263
  return data;
@@ -9308,7 +9360,7 @@ var LeaferUI = (function (exports) {
9308
9360
  scaleX = abs$1(scaleX);
9309
9361
  scaleY = abs$1(scaleY);
9310
9362
  const { image, data } = paint;
9311
- let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform, repeat } = data;
9363
+ let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
9312
9364
  if (sx) {
9313
9365
  imageMatrix = get$1();
9314
9366
  copy$1(imageMatrix, transform);
@@ -9351,7 +9403,7 @@ var LeaferUI = (function (exports) {
9351
9403
  }
9352
9404
  scale(imageMatrix, 1 / scaleX, 1 / scaleY);
9353
9405
  }
9354
- const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, opacity);
9406
+ const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, data.opacity, data.filters);
9355
9407
  const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || 'no-repeat'), imageMatrix, paint);
9356
9408
  paint.style = pattern;
9357
9409
  paint.patternId = id;
@@ -9395,7 +9447,7 @@ var LeaferUI = (function (exports) {
9395
9447
  canvas.opacity *= data.opacity;
9396
9448
  if (data.transform)
9397
9449
  canvas.transform(data.transform);
9398
- canvas.drawImage(paint.image.view, 0, 0, data.width, data.height);
9450
+ canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height);
9399
9451
  canvas.restore();
9400
9452
  return true;
9401
9453
  }
@@ -9405,7 +9457,7 @@ var LeaferUI = (function (exports) {
9405
9457
  }
9406
9458
  else {
9407
9459
  if (!paint.patternTask) {
9408
- paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, undefined, undefined, function* () {
9460
+ paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
9409
9461
  paint.patternTask = null;
9410
9462
  if (canvas.bounds.hit(ui.__nowWorld))
9411
9463
  createPattern(ui, paint, pixelRatio);
@@ -9995,11 +10047,11 @@ var LeaferUI = (function (exports) {
9995
10047
  function layoutChar(drawData, style, width, _height) {
9996
10048
  const { rows } = drawData;
9997
10049
  const { textAlign, paraIndent, letterSpacing } = style;
9998
- let charX, addWordWidth, indentWidth, mode, wordChar;
10050
+ let charX, addWordWidth, indentWidth, mode, wordChar, wordsLength;
9999
10051
  rows.forEach(row => {
10000
10052
  if (row.words) {
10001
- indentWidth = paraIndent && row.paraStart ? paraIndent : 0;
10002
- addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
10053
+ indentWidth = paraIndent && row.paraStart ? paraIndent : 0, wordsLength = row.words.length;
10054
+ addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && wordsLength > 1) ? (width - row.width - indentWidth) / (wordsLength - 1) : 0;
10003
10055
  mode = (letterSpacing || row.isOverflow) ? CharMode : (addWordWidth > 0.01 ? WordMode : TextMode);
10004
10056
  if (row.isOverflow && !letterSpacing)
10005
10057
  row.textMode = true;
@@ -10011,7 +10063,7 @@ var LeaferUI = (function (exports) {
10011
10063
  row.x += indentWidth;
10012
10064
  charX = row.x;
10013
10065
  row.data = [];
10014
- row.words.forEach(word => {
10066
+ row.words.forEach((word, index) => {
10015
10067
  if (mode === WordMode) {
10016
10068
  wordChar = { char: '', x: charX };
10017
10069
  charX = toWordChar(word.data, charX, wordChar);
@@ -10021,7 +10073,7 @@ var LeaferUI = (function (exports) {
10021
10073
  else {
10022
10074
  charX = toChar(word.data, charX, row.data, row.isOverflow);
10023
10075
  }
10024
- if (addWordWidth && (!row.paraEnd || textAlign === 'both')) {
10076
+ if (addWordWidth && (!row.paraEnd || textAlign === 'both') && (index !== wordsLength - 1)) {
10025
10077
  charX += addWordWidth;
10026
10078
  row.width += addWordWidth;
10027
10079
  }
@@ -10296,6 +10348,7 @@ var LeaferUI = (function (exports) {
10296
10348
  exports.Eventer = Eventer;
10297
10349
  exports.Export = Export;
10298
10350
  exports.FileHelper = FileHelper;
10351
+ exports.Filter = Filter;
10299
10352
  exports.FrameData = FrameData;
10300
10353
  exports.GroupData = GroupData;
10301
10354
  exports.ImageData = ImageData;
@@ -10357,6 +10410,7 @@ var LeaferUI = (function (exports) {
10357
10410
  exports.RenderEvent = RenderEvent;
10358
10411
  exports.Renderer = Renderer;
10359
10412
  exports.ResizeEvent = ResizeEvent;
10413
+ exports.Resource = Resource;
10360
10414
  exports.Run = Run;
10361
10415
  exports.StarData = StarData;
10362
10416
  exports.State = State;
@@ -10430,3 +10484,4 @@ var LeaferUI = (function (exports) {
10430
10484
  return exports;
10431
10485
 
10432
10486
  })({});
10487
+ //# sourceMappingURL=web.js.map