leafer-draw 1.3.2 → 1.4.0

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.
@@ -1533,10 +1533,10 @@ const DataHelper = {
1533
1533
  Object.keys(merge).forEach(key => {
1534
1534
  var _a, _b;
1535
1535
  value = merge[key];
1536
- if ((value === null || value === void 0 ? void 0 : value.constructor) === Object && ((_a = t[key]) === null || _a === void 0 ? void 0 : _a.constructor) === Object)
1536
+ if ((value === null || value === undefined ? undefined : value.constructor) === Object && ((_a = t[key]) === null || _a === undefined ? undefined : _a.constructor) === Object)
1537
1537
  return assign(t[key], merge[key], exclude && exclude[key]);
1538
1538
  if (exclude && (key in exclude)) {
1539
- if (((_b = exclude[key]) === null || _b === void 0 ? void 0 : _b.constructor) === Object)
1539
+ if (((_b = exclude[key]) === null || _b === undefined ? undefined : _b.constructor) === Object)
1540
1540
  assign(t[key] = {}, merge[key], exclude[key]);
1541
1541
  return;
1542
1542
  }
@@ -1705,7 +1705,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1705
1705
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1706
1706
  PERFORMANCE OF THIS SOFTWARE.
1707
1707
  ***************************************************************************** */
1708
- /* global Reflect, Promise, SuppressedError, Symbol */
1708
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
1709
1709
 
1710
1710
 
1711
1711
  function __decorate(decorators, target, key, desc) {
@@ -1773,7 +1773,7 @@ let Canvas$1 = class Canvas {
1773
1773
  }
1774
1774
  setTransform(_a, _b, _c, _d, _e, _f) { }
1775
1775
  resetTransform() { }
1776
- getTransform() { return void 0; }
1776
+ getTransform() { return undefined; }
1777
1777
  save() { }
1778
1778
  restore() { }
1779
1779
  transform(a, b, c, d, e, f) {
@@ -1830,12 +1830,12 @@ let Canvas$1 = class Canvas {
1830
1830
  ellipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise) { }
1831
1831
  rect(_x, _y, _width, _height) { }
1832
1832
  roundRect(_x, _y, _width, _height, _radius) { }
1833
- createConicGradient(_startAngle, _x, _y) { return void 0; }
1834
- createLinearGradient(_x0, _y0, _x1, _y1) { return void 0; }
1835
- createPattern(_image, _repetition) { return void 0; }
1836
- createRadialGradient(_x0, _y0, _r0, _x1, _y1, _r1) { return void 0; }
1833
+ createConicGradient(_startAngle, _x, _y) { return undefined; }
1834
+ createLinearGradient(_x0, _y0, _x1, _y1) { return undefined; }
1835
+ createPattern(_image, _repetition) { return undefined; }
1836
+ createRadialGradient(_x0, _y0, _r0, _x1, _y1, _r1) { return undefined; }
1837
1837
  fillText(_text, _x, _y, _maxWidth) { }
1838
- measureText(_text) { return void 0; }
1838
+ measureText(_text) { return undefined; }
1839
1839
  strokeText(_text, _x, _y, _maxWidth) { }
1840
1840
  destroy() {
1841
1841
  this.context = null;
@@ -1843,79 +1843,79 @@ let Canvas$1 = class Canvas {
1843
1843
  };
1844
1844
  __decorate([
1845
1845
  contextAttr('imageSmoothingEnabled')
1846
- ], Canvas$1.prototype, "smooth", void 0);
1846
+ ], Canvas$1.prototype, "smooth", undefined);
1847
1847
  __decorate([
1848
1848
  contextAttr('imageSmoothingQuality')
1849
- ], Canvas$1.prototype, "smoothLevel", void 0);
1849
+ ], Canvas$1.prototype, "smoothLevel", undefined);
1850
1850
  __decorate([
1851
1851
  contextAttr('globalAlpha')
1852
- ], Canvas$1.prototype, "opacity", void 0);
1852
+ ], Canvas$1.prototype, "opacity", undefined);
1853
1853
  __decorate([
1854
1854
  contextAttr()
1855
- ], Canvas$1.prototype, "fillStyle", void 0);
1855
+ ], Canvas$1.prototype, "fillStyle", undefined);
1856
1856
  __decorate([
1857
1857
  contextAttr()
1858
- ], Canvas$1.prototype, "strokeStyle", void 0);
1858
+ ], Canvas$1.prototype, "strokeStyle", undefined);
1859
1859
  __decorate([
1860
1860
  contextAttr('lineWidth')
1861
- ], Canvas$1.prototype, "strokeWidth", void 0);
1861
+ ], Canvas$1.prototype, "strokeWidth", undefined);
1862
1862
  __decorate([
1863
1863
  contextAttr('lineCap')
1864
- ], Canvas$1.prototype, "strokeCap", void 0);
1864
+ ], Canvas$1.prototype, "strokeCap", undefined);
1865
1865
  __decorate([
1866
1866
  contextAttr('lineJoin')
1867
- ], Canvas$1.prototype, "strokeJoin", void 0);
1867
+ ], Canvas$1.prototype, "strokeJoin", undefined);
1868
1868
  __decorate([
1869
1869
  contextAttr('lineDashOffset')
1870
- ], Canvas$1.prototype, "dashOffset", void 0);
1870
+ ], Canvas$1.prototype, "dashOffset", undefined);
1871
1871
  __decorate([
1872
1872
  contextAttr()
1873
- ], Canvas$1.prototype, "miterLimit", void 0);
1873
+ ], Canvas$1.prototype, "miterLimit", undefined);
1874
1874
  __decorate([
1875
1875
  contextAttr()
1876
- ], Canvas$1.prototype, "shadowBlur", void 0);
1876
+ ], Canvas$1.prototype, "shadowBlur", undefined);
1877
1877
  __decorate([
1878
1878
  contextAttr()
1879
- ], Canvas$1.prototype, "shadowColor", void 0);
1879
+ ], Canvas$1.prototype, "shadowColor", undefined);
1880
1880
  __decorate([
1881
1881
  contextAttr()
1882
- ], Canvas$1.prototype, "shadowOffsetX", void 0);
1882
+ ], Canvas$1.prototype, "shadowOffsetX", undefined);
1883
1883
  __decorate([
1884
1884
  contextAttr()
1885
- ], Canvas$1.prototype, "shadowOffsetY", void 0);
1885
+ ], Canvas$1.prototype, "shadowOffsetY", undefined);
1886
1886
  __decorate([
1887
1887
  contextAttr()
1888
- ], Canvas$1.prototype, "filter", void 0);
1888
+ ], Canvas$1.prototype, "filter", undefined);
1889
1889
  __decorate([
1890
1890
  contextAttr()
1891
- ], Canvas$1.prototype, "font", void 0);
1891
+ ], Canvas$1.prototype, "font", undefined);
1892
1892
  __decorate([
1893
1893
  contextAttr()
1894
- ], Canvas$1.prototype, "fontKerning", void 0);
1894
+ ], Canvas$1.prototype, "fontKerning", undefined);
1895
1895
  __decorate([
1896
1896
  contextAttr()
1897
- ], Canvas$1.prototype, "fontStretch", void 0);
1897
+ ], Canvas$1.prototype, "fontStretch", undefined);
1898
1898
  __decorate([
1899
1899
  contextAttr()
1900
- ], Canvas$1.prototype, "fontVariantCaps", void 0);
1900
+ ], Canvas$1.prototype, "fontVariantCaps", undefined);
1901
1901
  __decorate([
1902
1902
  contextAttr()
1903
- ], Canvas$1.prototype, "textAlign", void 0);
1903
+ ], Canvas$1.prototype, "textAlign", undefined);
1904
1904
  __decorate([
1905
1905
  contextAttr()
1906
- ], Canvas$1.prototype, "textBaseline", void 0);
1906
+ ], Canvas$1.prototype, "textBaseline", undefined);
1907
1907
  __decorate([
1908
1908
  contextAttr()
1909
- ], Canvas$1.prototype, "textRendering", void 0);
1909
+ ], Canvas$1.prototype, "textRendering", undefined);
1910
1910
  __decorate([
1911
1911
  contextAttr()
1912
- ], Canvas$1.prototype, "wordSpacing", void 0);
1912
+ ], Canvas$1.prototype, "wordSpacing", undefined);
1913
1913
  __decorate([
1914
1914
  contextAttr()
1915
- ], Canvas$1.prototype, "letterSpacing", void 0);
1915
+ ], Canvas$1.prototype, "letterSpacing", undefined);
1916
1916
  __decorate([
1917
1917
  contextAttr()
1918
- ], Canvas$1.prototype, "direction", void 0);
1918
+ ], Canvas$1.prototype, "direction", undefined);
1919
1919
  __decorate([
1920
1920
  contextMethod()
1921
1921
  ], Canvas$1.prototype, "setTransform", null);
@@ -3384,7 +3384,7 @@ class TaskItem {
3384
3384
  this.task = task;
3385
3385
  }
3386
3386
  run() {
3387
- return __awaiter(this, void 0, void 0, function* () {
3387
+ return __awaiter(this, undefined, undefined, function* () {
3388
3388
  try {
3389
3389
  if (this.task && !this.isComplete && this.parent.running)
3390
3390
  yield this.task();
@@ -3696,7 +3696,7 @@ class LeaferImage {
3696
3696
  load(onSuccess, onError) {
3697
3697
  if (!this.loading) {
3698
3698
  this.loading = true;
3699
- ImageManager.tasker.add(() => __awaiter(this, void 0, void 0, function* () {
3699
+ ImageManager.tasker.add(() => __awaiter(this, undefined, undefined, function* () {
3700
3700
  return yield Platform.origin.loadImage(this.url).then((img) => {
3701
3701
  this.ready = true;
3702
3702
  this.width = img.naturalWidth || img.width;
@@ -3821,10 +3821,10 @@ function autoLayoutType(defaultValue) {
3821
3821
  return decorateLeafAttr(defaultValue, (key) => attr({
3822
3822
  set(value) {
3823
3823
  if (this.__setAttr(key, value)) {
3824
- this.__layout.matrixChanged || this.__layout.matrixChange();
3825
3824
  this.__hasAutoLayout = !!(this.origin || this.around || this.flow);
3826
3825
  if (!this.__local)
3827
3826
  this.__layout.createLocal();
3827
+ doBoundsType(this);
3828
3828
  }
3829
3829
  }
3830
3830
  }));
@@ -4207,55 +4207,62 @@ const LeafHelper = {
4207
4207
  y += t.y;
4208
4208
  transition ? t.animate({ x, y }, transition) : (t.x = x, t.y = y);
4209
4209
  },
4210
- zoomOfWorld(t, origin, scaleX, scaleY, resize) {
4211
- L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
4210
+ zoomOfWorld(t, origin, scaleX, scaleY, resize, transition) {
4211
+ L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize, transition);
4212
4212
  },
4213
- zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize) {
4214
- copy$6(matrix, t.__localMatrix);
4213
+ zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize, transition) {
4214
+ const o = t.__localMatrix;
4215
+ if (typeof scaleY !== 'number') {
4216
+ if (scaleY)
4217
+ transition = scaleY;
4218
+ scaleY = scaleX;
4219
+ }
4220
+ copy$6(matrix, o);
4215
4221
  scaleOfOuter$2(matrix, origin, scaleX, scaleY);
4216
4222
  if (t.origin || t.around) {
4217
- L.setTransform(t, matrix, resize);
4223
+ L.setTransform(t, matrix, resize, transition);
4218
4224
  }
4219
4225
  else {
4220
- moveByMatrix(t, matrix);
4221
- t.scaleResize(scaleX, scaleY, resize !== true);
4226
+ const x = t.x + matrix.e - o.e, y = t.y + matrix.f - o.f;
4227
+ if (transition && !resize)
4228
+ t.animate({ x, y, scaleX: t.scaleX * scaleX, scaleY: t.scaleY * scaleY }, transition);
4229
+ else
4230
+ t.x = x, t.y = y, t.scaleResize(scaleX, scaleY, resize !== true);
4222
4231
  }
4223
4232
  },
4224
- rotateOfWorld(t, origin, angle) {
4225
- L.rotateOfLocal(t, getTempLocal(t, origin), angle);
4233
+ rotateOfWorld(t, origin, angle, transition) {
4234
+ L.rotateOfLocal(t, getTempLocal(t, origin), angle, transition);
4226
4235
  },
4227
- rotateOfLocal(t, origin, angle) {
4228
- copy$6(matrix, t.__localMatrix);
4236
+ rotateOfLocal(t, origin, angle, transition) {
4237
+ const o = t.__localMatrix;
4238
+ copy$6(matrix, o);
4229
4239
  rotateOfOuter$2(matrix, origin, angle);
4230
- if (t.origin || t.around) {
4231
- L.setTransform(t, matrix);
4232
- }
4233
- else {
4234
- moveByMatrix(t, matrix);
4235
- t.rotation = MathHelper.formatRotation(t.rotation + angle);
4236
- }
4240
+ if (t.origin || t.around)
4241
+ L.setTransform(t, matrix, false, transition);
4242
+ else
4243
+ t.set({ x: t.x + matrix.e - o.e, y: t.y + matrix.f - o.f, rotation: MathHelper.formatRotation(t.rotation + angle) }, transition);
4237
4244
  },
4238
- skewOfWorld(t, origin, skewX, skewY, resize) {
4239
- L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize);
4245
+ skewOfWorld(t, origin, skewX, skewY, resize, transition) {
4246
+ L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
4240
4247
  },
4241
- skewOfLocal(t, origin, skewX, skewY = 0, resize) {
4248
+ skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
4242
4249
  copy$6(matrix, t.__localMatrix);
4243
4250
  skewOfOuter(matrix, origin, skewX, skewY);
4244
- L.setTransform(t, matrix, resize);
4251
+ L.setTransform(t, matrix, resize, transition);
4245
4252
  },
4246
- transformWorld(t, transform, resize) {
4253
+ transformWorld(t, transform, resize, transition) {
4247
4254
  copy$6(matrix, t.worldTransform);
4248
4255
  multiplyParent$2(matrix, transform);
4249
4256
  if (t.parent)
4250
4257
  divideParent(matrix, t.parent.worldTransform);
4251
- L.setTransform(t, matrix, resize);
4258
+ L.setTransform(t, matrix, resize, transition);
4252
4259
  },
4253
- transform(t, transform, resize) {
4260
+ transform(t, transform, resize, transition) {
4254
4261
  copy$6(matrix, t.localTransform);
4255
4262
  multiplyParent$2(matrix, transform);
4256
- L.setTransform(t, matrix, resize);
4263
+ L.setTransform(t, matrix, resize, transition);
4257
4264
  },
4258
- setTransform(t, transform, resize) {
4265
+ setTransform(t, transform, resize, transition) {
4259
4266
  const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
4260
4267
  const layout = getLayout(transform, originPoint, data.around && L.getInnerOrigin(t, data.around));
4261
4268
  if (resize) {
@@ -4270,7 +4277,7 @@ const LeafHelper = {
4270
4277
  t.scaleResize(scaleX, scaleY, false);
4271
4278
  }
4272
4279
  else
4273
- t.set(layout);
4280
+ t.set(layout, transition);
4274
4281
  },
4275
4282
  getFlipTransform(t, axis) {
4276
4283
  const m = getMatrixData();
@@ -4307,11 +4314,6 @@ const LeafHelper = {
4307
4314
  };
4308
4315
  const L = LeafHelper;
4309
4316
  const { updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity$1, updateAllChange: updateAllChange$1 } = L;
4310
- function moveByMatrix(t, matrix) {
4311
- const { e, f } = t.__localMatrix;
4312
- t.x += matrix.e - e;
4313
- t.y += matrix.f - f;
4314
- }
4315
4317
  function getTempLocal(t, world) {
4316
4318
  t.__layout.update();
4317
4319
  return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
@@ -5175,8 +5177,7 @@ const LeafBounds = {
5175
5177
  __updateAutoLayout() {
5176
5178
  this.__layout.matrixChanged = true;
5177
5179
  if (this.isBranch) {
5178
- if (this.leaferIsReady)
5179
- this.leafer.layouter.addExtra(this);
5180
+ this.__extraUpdate();
5180
5181
  if (this.__.flow) {
5181
5182
  if (this.__layout.boxChanged)
5182
5183
  this.__updateFlowLayout();
@@ -5329,7 +5330,7 @@ let Leaf = class Leaf {
5329
5330
  get __worldFlipped() { return this.__world.scaleX < 0 || this.__world.scaleY < 0; }
5330
5331
  get __onlyHitMask() { return this.__hasMask && !this.__.hitChildren; }
5331
5332
  get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
5332
- get __inLazyBounds() { const { leafer } = this; return leafer && leafer.created && leafer.lazyBounds.hit(this.__world); }
5333
+ get __inLazyBounds() { return this.leaferIsCreated && this.leafer.lazyBounds.hit(this.__world); }
5333
5334
  get pathInputed() { return this.__.__pathInputed; }
5334
5335
  set event(map) { this.on(map); }
5335
5336
  constructor(data) {
@@ -5440,6 +5441,10 @@ let Leaf = class Leaf {
5440
5441
  forceRender(_bounds, _sync) {
5441
5442
  this.forceUpdate('surface');
5442
5443
  }
5444
+ __extraUpdate() {
5445
+ if (this.leaferIsReady)
5446
+ this.leafer.layouter.addExtra(this);
5447
+ }
5443
5448
  __updateWorldMatrix() { }
5444
5449
  __updateLocalMatrix() { }
5445
5450
  __updateWorldBounds() { }
@@ -5582,11 +5587,11 @@ let Leaf = class Leaf {
5582
5587
  const layer = this.leafer ? this.leafer.zoomLayer : this;
5583
5588
  return layer.getWorldPoint(page, relative, distance, change);
5584
5589
  }
5585
- setTransform(matrix, resize) {
5586
- setTransform(this, matrix, resize);
5590
+ setTransform(matrix, resize, transition) {
5591
+ setTransform(this, matrix, resize, transition);
5587
5592
  }
5588
- transform(matrix, resize) {
5589
- transform(this, matrix, resize);
5593
+ transform(matrix, resize, transition) {
5594
+ transform(this, matrix, resize, transition);
5590
5595
  }
5591
5596
  move(x, y, transition) {
5592
5597
  moveLocal(this, x, y, transition);
@@ -5594,32 +5599,32 @@ let Leaf = class Leaf {
5594
5599
  moveInner(x, y, transition) {
5595
5600
  moveWorld(this, x, y, true, transition);
5596
5601
  }
5597
- scaleOf(origin, scaleX, scaleY, resize) {
5598
- zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize);
5602
+ scaleOf(origin, scaleX, scaleY, resize, transition) {
5603
+ zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize, transition);
5599
5604
  }
5600
- rotateOf(origin, rotation) {
5601
- rotateOfLocal(this, getLocalOrigin(this, origin), rotation);
5605
+ rotateOf(origin, rotation, transition) {
5606
+ rotateOfLocal(this, getLocalOrigin(this, origin), rotation, transition);
5602
5607
  }
5603
- skewOf(origin, skewX, skewY, resize) {
5604
- skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize);
5608
+ skewOf(origin, skewX, skewY, resize, transition) {
5609
+ skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize, transition);
5605
5610
  }
5606
- transformWorld(worldTransform, resize) {
5607
- transformWorld(this, worldTransform, resize);
5611
+ transformWorld(worldTransform, resize, transition) {
5612
+ transformWorld(this, worldTransform, resize, transition);
5608
5613
  }
5609
5614
  moveWorld(x, y, transition) {
5610
5615
  moveWorld(this, x, y, false, transition);
5611
5616
  }
5612
- scaleOfWorld(worldOrigin, scaleX, scaleY, resize) {
5613
- zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize);
5617
+ scaleOfWorld(worldOrigin, scaleX, scaleY, resize, transition) {
5618
+ zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize, transition);
5614
5619
  }
5615
5620
  rotateOfWorld(worldOrigin, rotation) {
5616
5621
  rotateOfWorld(this, worldOrigin, rotation);
5617
5622
  }
5618
- skewOfWorld(worldOrigin, skewX, skewY, resize) {
5619
- skewOfWorld(this, worldOrigin, skewX, skewY, resize);
5623
+ skewOfWorld(worldOrigin, skewX, skewY, resize, transition) {
5624
+ skewOfWorld(this, worldOrigin, skewX, skewY, resize, transition);
5620
5625
  }
5621
- flip(axis) {
5622
- transform(this, getFlipTransform(this, axis));
5626
+ flip(axis, transition) {
5627
+ transform(this, getFlipTransform(this, axis), false, transition);
5623
5628
  }
5624
5629
  scaleResize(scaleX, scaleY = scaleX, _noResize) {
5625
5630
  this.scaleX *= scaleX;
@@ -6007,7 +6012,7 @@ class LeafLevelList {
6007
6012
  }
6008
6013
  }
6009
6014
 
6010
- const version = "1.3.2";
6015
+ const version = "1.4.0";
6011
6016
 
6012
6017
  const debug$4 = Debug.get('LeaferCanvas');
6013
6018
  class LeaferCanvas extends LeaferCanvasBase {
@@ -6127,7 +6132,7 @@ class LeaferCanvas extends LeaferCanvasBase {
6127
6132
  }
6128
6133
  }
6129
6134
  else {
6130
- window.addEventListener('resize', () => {
6135
+ window.addEventListener('resize', this.windowListener = () => {
6131
6136
  const pixelRatio = Platform.devicePixelRatio;
6132
6137
  if (this.pixelRatio !== pixelRatio) {
6133
6138
  const { width, height } = this;
@@ -6156,11 +6161,9 @@ class LeaferCanvas extends LeaferCanvasBase {
6156
6161
  }
6157
6162
  stopAutoLayout() {
6158
6163
  this.autoLayout = false;
6159
- this.resizeListener = null;
6160
- if (this.resizeObserver) {
6164
+ if (this.resizeObserver)
6161
6165
  this.resizeObserver.disconnect();
6162
- this.resizeObserver = null;
6163
- }
6166
+ this.resizeListener = this.resizeObserver = null;
6164
6167
  }
6165
6168
  emitResize(size) {
6166
6169
  const oldSize = {};
@@ -6181,6 +6184,10 @@ class LeaferCanvas extends LeaferCanvasBase {
6181
6184
  destroy() {
6182
6185
  if (this.view) {
6183
6186
  this.stopAutoLayout();
6187
+ if (this.windowListener) {
6188
+ window.removeEventListener('resize', this.windowListener);
6189
+ this.windowListener = null;
6190
+ }
6184
6191
  if (!this.unreal) {
6185
6192
  const view = this.view;
6186
6193
  if (view.parentElement)
@@ -6207,7 +6214,10 @@ function useCanvas(_canvasType, _power) {
6207
6214
  canvas.height = height;
6208
6215
  return canvas;
6209
6216
  },
6210
- canvasToDataURL: (canvas, type, quality) => canvas.toDataURL(mineType(type), quality),
6217
+ canvasToDataURL: (canvas, type, quality) => {
6218
+ const imageType = mineType(type), url = canvas.toDataURL(imageType, quality);
6219
+ return imageType === 'image/bmp' ? url.replace('image/png;', 'image/bmp;') : url;
6220
+ },
6211
6221
  canvasToBolb: (canvas, type, quality) => new Promise((resolve) => canvas.toBlob(resolve, mineType(type), quality)),
6212
6222
  canvasSaveAs: (canvas, filename, quality) => {
6213
6223
  const url = canvas.toDataURL(mineType(fileType(filename)), quality);
@@ -6252,7 +6262,7 @@ function useCanvas(_canvasType, _power) {
6252
6262
  Platform.name = 'web';
6253
6263
  Platform.isMobile = 'ontouchstart' in window;
6254
6264
  Platform.requestRender = function (render) { window.requestAnimationFrame(render); };
6255
- defineKey(Platform, 'devicePixelRatio', { get() { return Math.max(1, devicePixelRatio); } });
6265
+ defineKey(Platform, 'devicePixelRatio', { get() { return devicePixelRatio; } });
6256
6266
  const { userAgent } = navigator;
6257
6267
  if (userAgent.indexOf("Firefox") > -1) {
6258
6268
  Platform.conicGradientRotate90 = true;
@@ -6528,7 +6538,7 @@ class Layouter {
6528
6538
  }
6529
6539
  partLayout() {
6530
6540
  var _a;
6531
- if (!((_a = this.__updatedList) === null || _a === void 0 ? void 0 : _a.length))
6541
+ if (!((_a = this.__updatedList) === null || _a === undefined ? undefined : _a.length))
6532
6542
  return;
6533
6543
  const t = Run.start('PartLayout');
6534
6544
  const { target, __updatedList: updateList } = this;
@@ -6943,6 +6953,7 @@ class UIData extends LeafData {
6943
6953
  return t.fill && this.__hasStroke;
6944
6954
  }
6945
6955
  get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
6956
+ get __hasSurface() { const t = this; return (t.fill || t.stroke); }
6946
6957
  get __autoWidth() { return !this._width; }
6947
6958
  get __autoHeight() { return !this._height; }
6948
6959
  get __autoSide() { return !this._width || !this._height; }
@@ -7446,199 +7457,199 @@ let UI = UI_1 = class UI extends Leaf {
7446
7457
  };
7447
7458
  __decorate([
7448
7459
  dataProcessor(UIData)
7449
- ], UI.prototype, "__", void 0);
7460
+ ], UI.prototype, "__", undefined);
7450
7461
  __decorate([
7451
7462
  zoomLayerType()
7452
- ], UI.prototype, "zoomLayer", void 0);
7463
+ ], UI.prototype, "zoomLayer", undefined);
7453
7464
  __decorate([
7454
7465
  dataType('')
7455
- ], UI.prototype, "id", void 0);
7466
+ ], UI.prototype, "id", undefined);
7456
7467
  __decorate([
7457
7468
  dataType('')
7458
- ], UI.prototype, "name", void 0);
7469
+ ], UI.prototype, "name", undefined);
7459
7470
  __decorate([
7460
7471
  dataType('')
7461
- ], UI.prototype, "className", void 0);
7472
+ ], UI.prototype, "className", undefined);
7462
7473
  __decorate([
7463
7474
  surfaceType('pass-through')
7464
- ], UI.prototype, "blendMode", void 0);
7475
+ ], UI.prototype, "blendMode", undefined);
7465
7476
  __decorate([
7466
7477
  opacityType(1)
7467
- ], UI.prototype, "opacity", void 0);
7478
+ ], UI.prototype, "opacity", undefined);
7468
7479
  __decorate([
7469
7480
  visibleType(true)
7470
- ], UI.prototype, "visible", void 0);
7481
+ ], UI.prototype, "visible", undefined);
7471
7482
  __decorate([
7472
7483
  surfaceType(false)
7473
- ], UI.prototype, "locked", void 0);
7484
+ ], UI.prototype, "locked", undefined);
7474
7485
  __decorate([
7475
7486
  sortType(0)
7476
- ], UI.prototype, "zIndex", void 0);
7487
+ ], UI.prototype, "zIndex", undefined);
7477
7488
  __decorate([
7478
7489
  maskType(false)
7479
- ], UI.prototype, "mask", void 0);
7490
+ ], UI.prototype, "mask", undefined);
7480
7491
  __decorate([
7481
7492
  eraserType(false)
7482
- ], UI.prototype, "eraser", void 0);
7493
+ ], UI.prototype, "eraser", undefined);
7483
7494
  __decorate([
7484
7495
  positionType(0, true)
7485
- ], UI.prototype, "x", void 0);
7496
+ ], UI.prototype, "x", undefined);
7486
7497
  __decorate([
7487
7498
  positionType(0, true)
7488
- ], UI.prototype, "y", void 0);
7499
+ ], UI.prototype, "y", undefined);
7489
7500
  __decorate([
7490
7501
  boundsType(100, true)
7491
- ], UI.prototype, "width", void 0);
7502
+ ], UI.prototype, "width", undefined);
7492
7503
  __decorate([
7493
7504
  boundsType(100, true)
7494
- ], UI.prototype, "height", void 0);
7505
+ ], UI.prototype, "height", undefined);
7495
7506
  __decorate([
7496
7507
  scaleType(1, true)
7497
- ], UI.prototype, "scaleX", void 0);
7508
+ ], UI.prototype, "scaleX", undefined);
7498
7509
  __decorate([
7499
7510
  scaleType(1, true)
7500
- ], UI.prototype, "scaleY", void 0);
7511
+ ], UI.prototype, "scaleY", undefined);
7501
7512
  __decorate([
7502
7513
  rotationType(0, true)
7503
- ], UI.prototype, "rotation", void 0);
7514
+ ], UI.prototype, "rotation", undefined);
7504
7515
  __decorate([
7505
7516
  rotationType(0, true)
7506
- ], UI.prototype, "skewX", void 0);
7517
+ ], UI.prototype, "skewX", undefined);
7507
7518
  __decorate([
7508
7519
  rotationType(0, true)
7509
- ], UI.prototype, "skewY", void 0);
7520
+ ], UI.prototype, "skewY", undefined);
7510
7521
  __decorate([
7511
7522
  positionType(0, true)
7512
- ], UI.prototype, "offsetX", void 0);
7523
+ ], UI.prototype, "offsetX", undefined);
7513
7524
  __decorate([
7514
7525
  positionType(0, true)
7515
- ], UI.prototype, "offsetY", void 0);
7526
+ ], UI.prototype, "offsetY", undefined);
7516
7527
  __decorate([
7517
7528
  positionType(0, true)
7518
- ], UI.prototype, "scrollX", void 0);
7529
+ ], UI.prototype, "scrollX", undefined);
7519
7530
  __decorate([
7520
7531
  positionType(0, true)
7521
- ], UI.prototype, "scrollY", void 0);
7532
+ ], UI.prototype, "scrollY", undefined);
7522
7533
  __decorate([
7523
7534
  autoLayoutType()
7524
- ], UI.prototype, "origin", void 0);
7535
+ ], UI.prototype, "origin", undefined);
7525
7536
  __decorate([
7526
7537
  autoLayoutType()
7527
- ], UI.prototype, "around", void 0);
7538
+ ], UI.prototype, "around", undefined);
7528
7539
  __decorate([
7529
7540
  dataType(false)
7530
- ], UI.prototype, "lazy", void 0);
7541
+ ], UI.prototype, "lazy", undefined);
7531
7542
  __decorate([
7532
7543
  naturalBoundsType(1)
7533
- ], UI.prototype, "pixelRatio", void 0);
7544
+ ], UI.prototype, "pixelRatio", undefined);
7534
7545
  __decorate([
7535
7546
  pathInputType()
7536
- ], UI.prototype, "path", void 0);
7547
+ ], UI.prototype, "path", undefined);
7537
7548
  __decorate([
7538
7549
  pathType()
7539
- ], UI.prototype, "windingRule", void 0);
7550
+ ], UI.prototype, "windingRule", undefined);
7540
7551
  __decorate([
7541
7552
  pathType(true)
7542
- ], UI.prototype, "closed", void 0);
7553
+ ], UI.prototype, "closed", undefined);
7543
7554
  __decorate([
7544
7555
  boundsType(0)
7545
- ], UI.prototype, "padding", void 0);
7556
+ ], UI.prototype, "padding", undefined);
7546
7557
  __decorate([
7547
7558
  boundsType(false)
7548
- ], UI.prototype, "lockRatio", void 0);
7559
+ ], UI.prototype, "lockRatio", undefined);
7549
7560
  __decorate([
7550
7561
  boundsType()
7551
- ], UI.prototype, "widthRange", void 0);
7562
+ ], UI.prototype, "widthRange", undefined);
7552
7563
  __decorate([
7553
7564
  boundsType()
7554
- ], UI.prototype, "heightRange", void 0);
7565
+ ], UI.prototype, "heightRange", undefined);
7555
7566
  __decorate([
7556
7567
  dataType(false)
7557
- ], UI.prototype, "draggable", void 0);
7568
+ ], UI.prototype, "draggable", undefined);
7558
7569
  __decorate([
7559
7570
  dataType()
7560
- ], UI.prototype, "dragBounds", void 0);
7571
+ ], UI.prototype, "dragBounds", undefined);
7561
7572
  __decorate([
7562
7573
  dataType(false)
7563
- ], UI.prototype, "editable", void 0);
7574
+ ], UI.prototype, "editable", undefined);
7564
7575
  __decorate([
7565
7576
  hitType(true)
7566
- ], UI.prototype, "hittable", void 0);
7577
+ ], UI.prototype, "hittable", undefined);
7567
7578
  __decorate([
7568
7579
  hitType('path')
7569
- ], UI.prototype, "hitFill", void 0);
7580
+ ], UI.prototype, "hitFill", undefined);
7570
7581
  __decorate([
7571
7582
  strokeType('path')
7572
- ], UI.prototype, "hitStroke", void 0);
7583
+ ], UI.prototype, "hitStroke", undefined);
7573
7584
  __decorate([
7574
7585
  hitType(false)
7575
- ], UI.prototype, "hitBox", void 0);
7586
+ ], UI.prototype, "hitBox", undefined);
7576
7587
  __decorate([
7577
7588
  hitType(true)
7578
- ], UI.prototype, "hitChildren", void 0);
7589
+ ], UI.prototype, "hitChildren", undefined);
7579
7590
  __decorate([
7580
7591
  hitType(true)
7581
- ], UI.prototype, "hitSelf", void 0);
7592
+ ], UI.prototype, "hitSelf", undefined);
7582
7593
  __decorate([
7583
7594
  hitType()
7584
- ], UI.prototype, "hitRadius", void 0);
7595
+ ], UI.prototype, "hitRadius", undefined);
7585
7596
  __decorate([
7586
7597
  cursorType('')
7587
- ], UI.prototype, "cursor", void 0);
7598
+ ], UI.prototype, "cursor", undefined);
7588
7599
  __decorate([
7589
7600
  surfaceType()
7590
- ], UI.prototype, "fill", void 0);
7601
+ ], UI.prototype, "fill", undefined);
7591
7602
  __decorate([
7592
7603
  strokeType()
7593
- ], UI.prototype, "stroke", void 0);
7604
+ ], UI.prototype, "stroke", undefined);
7594
7605
  __decorate([
7595
7606
  strokeType('inside')
7596
- ], UI.prototype, "strokeAlign", void 0);
7607
+ ], UI.prototype, "strokeAlign", undefined);
7597
7608
  __decorate([
7598
7609
  strokeType(1)
7599
- ], UI.prototype, "strokeWidth", void 0);
7610
+ ], UI.prototype, "strokeWidth", undefined);
7600
7611
  __decorate([
7601
7612
  strokeType(false)
7602
- ], UI.prototype, "strokeWidthFixed", void 0);
7613
+ ], UI.prototype, "strokeWidthFixed", undefined);
7603
7614
  __decorate([
7604
7615
  strokeType('none')
7605
- ], UI.prototype, "strokeCap", void 0);
7616
+ ], UI.prototype, "strokeCap", undefined);
7606
7617
  __decorate([
7607
7618
  strokeType('miter')
7608
- ], UI.prototype, "strokeJoin", void 0);
7619
+ ], UI.prototype, "strokeJoin", undefined);
7609
7620
  __decorate([
7610
7621
  strokeType()
7611
- ], UI.prototype, "dashPattern", void 0);
7622
+ ], UI.prototype, "dashPattern", undefined);
7612
7623
  __decorate([
7613
7624
  strokeType()
7614
- ], UI.prototype, "dashOffset", void 0);
7625
+ ], UI.prototype, "dashOffset", undefined);
7615
7626
  __decorate([
7616
7627
  strokeType(10)
7617
- ], UI.prototype, "miterLimit", void 0);
7628
+ ], UI.prototype, "miterLimit", undefined);
7618
7629
  __decorate([
7619
7630
  pathType(0)
7620
- ], UI.prototype, "cornerRadius", void 0);
7631
+ ], UI.prototype, "cornerRadius", undefined);
7621
7632
  __decorate([
7622
7633
  pathType()
7623
- ], UI.prototype, "cornerSmoothing", void 0);
7634
+ ], UI.prototype, "cornerSmoothing", undefined);
7624
7635
  __decorate([
7625
7636
  effectType()
7626
- ], UI.prototype, "shadow", void 0);
7637
+ ], UI.prototype, "shadow", undefined);
7627
7638
  __decorate([
7628
7639
  effectType()
7629
- ], UI.prototype, "innerShadow", void 0);
7640
+ ], UI.prototype, "innerShadow", undefined);
7630
7641
  __decorate([
7631
7642
  effectType()
7632
- ], UI.prototype, "blur", void 0);
7643
+ ], UI.prototype, "blur", undefined);
7633
7644
  __decorate([
7634
7645
  effectType()
7635
- ], UI.prototype, "backgroundBlur", void 0);
7646
+ ], UI.prototype, "backgroundBlur", undefined);
7636
7647
  __decorate([
7637
7648
  effectType()
7638
- ], UI.prototype, "grayscale", void 0);
7649
+ ], UI.prototype, "grayscale", undefined);
7639
7650
  __decorate([
7640
7651
  dataType({})
7641
- ], UI.prototype, "data", void 0);
7652
+ ], UI.prototype, "data", undefined);
7642
7653
  __decorate([
7643
7654
  rewrite(Leaf.prototype.reset)
7644
7655
  ], UI.prototype, "reset", null);
@@ -7699,7 +7710,7 @@ let Group = class Group extends UI {
7699
7710
  };
7700
7711
  __decorate([
7701
7712
  dataProcessor(GroupData)
7702
- ], Group.prototype, "__", void 0);
7713
+ ], Group.prototype, "__", undefined);
7703
7714
  Group = __decorate([
7704
7715
  useModule(Branch),
7705
7716
  registerUI()
@@ -7870,8 +7881,6 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7870
7881
  __setAttr(attrName, newValue) {
7871
7882
  if (this.canvas) {
7872
7883
  if (canvasSizeAttrs.includes(attrName)) {
7873
- if (!newValue)
7874
- debug.warn(attrName + ' is 0');
7875
7884
  this.__changeCanvasSize(attrName, newValue);
7876
7885
  }
7877
7886
  else if (attrName === 'fill') {
@@ -8074,10 +8083,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8074
8083
  Leafer.list = new LeafList();
8075
8084
  __decorate([
8076
8085
  dataProcessor(LeaferData)
8077
- ], Leafer.prototype, "__", void 0);
8086
+ ], Leafer.prototype, "__", undefined);
8078
8087
  __decorate([
8079
8088
  boundsType()
8080
- ], Leafer.prototype, "pixelRatio", void 0);
8089
+ ], Leafer.prototype, "pixelRatio", undefined);
8081
8090
  Leafer = Leafer_1 = __decorate([
8082
8091
  registerUI()
8083
8092
  ], Leafer);
@@ -8090,7 +8099,7 @@ let Rect = class Rect extends UI {
8090
8099
  };
8091
8100
  __decorate([
8092
8101
  dataProcessor(RectData)
8093
- ], Rect.prototype, "__", void 0);
8102
+ ], Rect.prototype, "__", undefined);
8094
8103
  Rect = __decorate([
8095
8104
  useModule(RectRender),
8096
8105
  rewriteAble(),
@@ -8115,6 +8124,8 @@ let Box = class Box extends Group {
8115
8124
  const data = this.__;
8116
8125
  if (this.children.length) {
8117
8126
  if (data.__autoSide) {
8127
+ if (data.__hasSurface)
8128
+ this.__extraUpdate();
8118
8129
  super.__updateBoxBounds();
8119
8130
  const { boxBounds } = this.__layout;
8120
8131
  if (!data.__autoSize) {
@@ -8179,13 +8190,13 @@ let Box = class Box extends Group {
8179
8190
  };
8180
8191
  __decorate([
8181
8192
  dataProcessor(BoxData)
8182
- ], Box.prototype, "__", void 0);
8193
+ ], Box.prototype, "__", undefined);
8183
8194
  __decorate([
8184
8195
  dataType(false)
8185
- ], Box.prototype, "resizeChildren", void 0);
8196
+ ], Box.prototype, "resizeChildren", undefined);
8186
8197
  __decorate([
8187
8198
  affectRenderBoundsType('show')
8188
- ], Box.prototype, "overflow", void 0);
8199
+ ], Box.prototype, "overflow", undefined);
8189
8200
  __decorate([
8190
8201
  rewrite(rect.__updateStrokeSpread)
8191
8202
  ], Box.prototype, "__updateStrokeSpread", null);
@@ -8224,13 +8235,13 @@ let Frame = class Frame extends Box {
8224
8235
  };
8225
8236
  __decorate([
8226
8237
  dataProcessor(FrameData)
8227
- ], Frame.prototype, "__", void 0);
8238
+ ], Frame.prototype, "__", undefined);
8228
8239
  __decorate([
8229
8240
  surfaceType('#FFFFFF')
8230
- ], Frame.prototype, "fill", void 0);
8241
+ ], Frame.prototype, "fill", undefined);
8231
8242
  __decorate([
8232
8243
  affectRenderBoundsType('hide')
8233
- ], Frame.prototype, "overflow", void 0);
8244
+ ], Frame.prototype, "overflow", undefined);
8234
8245
  Frame = __decorate([
8235
8246
  registerUI()
8236
8247
  ], Frame);
@@ -8277,16 +8288,16 @@ let Ellipse = class Ellipse extends UI {
8277
8288
  };
8278
8289
  __decorate([
8279
8290
  dataProcessor(EllipseData)
8280
- ], Ellipse.prototype, "__", void 0);
8291
+ ], Ellipse.prototype, "__", undefined);
8281
8292
  __decorate([
8282
8293
  pathType(0)
8283
- ], Ellipse.prototype, "innerRadius", void 0);
8294
+ ], Ellipse.prototype, "innerRadius", undefined);
8284
8295
  __decorate([
8285
8296
  pathType(0)
8286
- ], Ellipse.prototype, "startAngle", void 0);
8297
+ ], Ellipse.prototype, "startAngle", undefined);
8287
8298
  __decorate([
8288
8299
  pathType(0)
8289
- ], Ellipse.prototype, "endAngle", void 0);
8300
+ ], Ellipse.prototype, "endAngle", undefined);
8290
8301
  Ellipse = __decorate([
8291
8302
  registerUI()
8292
8303
  ], Ellipse);
@@ -8345,22 +8356,22 @@ let Line = class Line extends UI {
8345
8356
  };
8346
8357
  __decorate([
8347
8358
  dataProcessor(LineData)
8348
- ], Line.prototype, "__", void 0);
8359
+ ], Line.prototype, "__", undefined);
8349
8360
  __decorate([
8350
8361
  affectStrokeBoundsType('center')
8351
- ], Line.prototype, "strokeAlign", void 0);
8362
+ ], Line.prototype, "strokeAlign", undefined);
8352
8363
  __decorate([
8353
8364
  boundsType(0)
8354
- ], Line.prototype, "height", void 0);
8365
+ ], Line.prototype, "height", undefined);
8355
8366
  __decorate([
8356
8367
  pathType()
8357
- ], Line.prototype, "points", void 0);
8368
+ ], Line.prototype, "points", undefined);
8358
8369
  __decorate([
8359
8370
  pathType(0)
8360
- ], Line.prototype, "curve", void 0);
8371
+ ], Line.prototype, "curve", undefined);
8361
8372
  __decorate([
8362
8373
  pathType(false)
8363
- ], Line.prototype, "closed", void 0);
8374
+ ], Line.prototype, "closed", undefined);
8364
8375
  Line = __decorate([
8365
8376
  registerUI()
8366
8377
  ], Line);
@@ -8393,16 +8404,16 @@ let Polygon = class Polygon extends UI {
8393
8404
  };
8394
8405
  __decorate([
8395
8406
  dataProcessor(PolygonData)
8396
- ], Polygon.prototype, "__", void 0);
8407
+ ], Polygon.prototype, "__", undefined);
8397
8408
  __decorate([
8398
8409
  pathType(3)
8399
- ], Polygon.prototype, "sides", void 0);
8410
+ ], Polygon.prototype, "sides", undefined);
8400
8411
  __decorate([
8401
8412
  pathType()
8402
- ], Polygon.prototype, "points", void 0);
8413
+ ], Polygon.prototype, "points", undefined);
8403
8414
  __decorate([
8404
8415
  pathType(0)
8405
- ], Polygon.prototype, "curve", void 0);
8416
+ ], Polygon.prototype, "curve", undefined);
8406
8417
  __decorate([
8407
8418
  rewrite(line.__updateRenderPath)
8408
8419
  ], Polygon.prototype, "__updateRenderPath", null);
@@ -8434,13 +8445,13 @@ let Star = class Star extends UI {
8434
8445
  };
8435
8446
  __decorate([
8436
8447
  dataProcessor(StarData)
8437
- ], Star.prototype, "__", void 0);
8448
+ ], Star.prototype, "__", undefined);
8438
8449
  __decorate([
8439
8450
  pathType(5)
8440
- ], Star.prototype, "corners", void 0);
8451
+ ], Star.prototype, "corners", undefined);
8441
8452
  __decorate([
8442
8453
  pathType(0.382)
8443
- ], Star.prototype, "innerRadius", void 0);
8454
+ ], Star.prototype, "innerRadius", undefined);
8444
8455
  Star = __decorate([
8445
8456
  registerUI()
8446
8457
  ], Star);
@@ -8462,10 +8473,10 @@ let Image$1 = class Image extends Rect {
8462
8473
  };
8463
8474
  __decorate([
8464
8475
  dataProcessor(ImageData)
8465
- ], Image$1.prototype, "__", void 0);
8476
+ ], Image$1.prototype, "__", undefined);
8466
8477
  __decorate([
8467
8478
  boundsType('')
8468
- ], Image$1.prototype, "url", void 0);
8479
+ ], Image$1.prototype, "url", undefined);
8469
8480
  Image$1 = __decorate([
8470
8481
  registerUI()
8471
8482
  ], Image$1);
@@ -8528,25 +8539,25 @@ let Canvas = class Canvas extends Rect {
8528
8539
  };
8529
8540
  __decorate([
8530
8541
  dataProcessor(CanvasData)
8531
- ], Canvas.prototype, "__", void 0);
8542
+ ], Canvas.prototype, "__", undefined);
8532
8543
  __decorate([
8533
8544
  resizeType(100)
8534
- ], Canvas.prototype, "width", void 0);
8545
+ ], Canvas.prototype, "width", undefined);
8535
8546
  __decorate([
8536
8547
  resizeType(100)
8537
- ], Canvas.prototype, "height", void 0);
8548
+ ], Canvas.prototype, "height", undefined);
8538
8549
  __decorate([
8539
8550
  resizeType(1)
8540
- ], Canvas.prototype, "pixelRatio", void 0);
8551
+ ], Canvas.prototype, "pixelRatio", undefined);
8541
8552
  __decorate([
8542
8553
  resizeType(true)
8543
- ], Canvas.prototype, "smooth", void 0);
8554
+ ], Canvas.prototype, "smooth", undefined);
8544
8555
  __decorate([
8545
8556
  dataType(false)
8546
- ], Canvas.prototype, "safeResize", void 0);
8557
+ ], Canvas.prototype, "safeResize", undefined);
8547
8558
  __decorate([
8548
8559
  resizeType()
8549
- ], Canvas.prototype, "contextSettings", void 0);
8560
+ ], Canvas.prototype, "contextSettings", undefined);
8550
8561
  Canvas = __decorate([
8551
8562
  registerUI()
8552
8563
  ], Canvas);
@@ -8637,76 +8648,76 @@ let Text = class Text extends UI {
8637
8648
  };
8638
8649
  __decorate([
8639
8650
  dataProcessor(TextData)
8640
- ], Text.prototype, "__", void 0);
8651
+ ], Text.prototype, "__", undefined);
8641
8652
  __decorate([
8642
8653
  boundsType(0)
8643
- ], Text.prototype, "width", void 0);
8654
+ ], Text.prototype, "width", undefined);
8644
8655
  __decorate([
8645
8656
  boundsType(0)
8646
- ], Text.prototype, "height", void 0);
8657
+ ], Text.prototype, "height", undefined);
8647
8658
  __decorate([
8648
8659
  dataType(false)
8649
- ], Text.prototype, "resizeFontSize", void 0);
8660
+ ], Text.prototype, "resizeFontSize", undefined);
8650
8661
  __decorate([
8651
8662
  surfaceType('#000000')
8652
- ], Text.prototype, "fill", void 0);
8663
+ ], Text.prototype, "fill", undefined);
8653
8664
  __decorate([
8654
8665
  affectStrokeBoundsType('outside')
8655
- ], Text.prototype, "strokeAlign", void 0);
8666
+ ], Text.prototype, "strokeAlign", undefined);
8656
8667
  __decorate([
8657
8668
  hitType('all')
8658
- ], Text.prototype, "hitFill", void 0);
8669
+ ], Text.prototype, "hitFill", undefined);
8659
8670
  __decorate([
8660
8671
  boundsType('')
8661
- ], Text.prototype, "text", void 0);
8672
+ ], Text.prototype, "text", undefined);
8662
8673
  __decorate([
8663
- boundsType('L')
8664
- ], Text.prototype, "fontFamily", void 0);
8674
+ boundsType('caption')
8675
+ ], Text.prototype, "fontFamily", undefined);
8665
8676
  __decorate([
8666
8677
  boundsType(12)
8667
- ], Text.prototype, "fontSize", void 0);
8678
+ ], Text.prototype, "fontSize", undefined);
8668
8679
  __decorate([
8669
8680
  boundsType('normal')
8670
- ], Text.prototype, "fontWeight", void 0);
8681
+ ], Text.prototype, "fontWeight", undefined);
8671
8682
  __decorate([
8672
8683
  boundsType(false)
8673
- ], Text.prototype, "italic", void 0);
8684
+ ], Text.prototype, "italic", undefined);
8674
8685
  __decorate([
8675
8686
  boundsType('none')
8676
- ], Text.prototype, "textCase", void 0);
8687
+ ], Text.prototype, "textCase", undefined);
8677
8688
  __decorate([
8678
8689
  boundsType('none')
8679
- ], Text.prototype, "textDecoration", void 0);
8690
+ ], Text.prototype, "textDecoration", undefined);
8680
8691
  __decorate([
8681
8692
  boundsType(0)
8682
- ], Text.prototype, "letterSpacing", void 0);
8693
+ ], Text.prototype, "letterSpacing", undefined);
8683
8694
  __decorate([
8684
8695
  boundsType({ type: 'percent', value: 1.5 })
8685
- ], Text.prototype, "lineHeight", void 0);
8696
+ ], Text.prototype, "lineHeight", undefined);
8686
8697
  __decorate([
8687
8698
  boundsType(0)
8688
- ], Text.prototype, "paraIndent", void 0);
8699
+ ], Text.prototype, "paraIndent", undefined);
8689
8700
  __decorate([
8690
8701
  boundsType(0)
8691
- ], Text.prototype, "paraSpacing", void 0);
8702
+ ], Text.prototype, "paraSpacing", undefined);
8692
8703
  __decorate([
8693
8704
  boundsType('x')
8694
- ], Text.prototype, "writingMode", void 0);
8705
+ ], Text.prototype, "writingMode", undefined);
8695
8706
  __decorate([
8696
8707
  boundsType('left')
8697
- ], Text.prototype, "textAlign", void 0);
8708
+ ], Text.prototype, "textAlign", undefined);
8698
8709
  __decorate([
8699
8710
  boundsType('top')
8700
- ], Text.prototype, "verticalAlign", void 0);
8711
+ ], Text.prototype, "verticalAlign", undefined);
8701
8712
  __decorate([
8702
8713
  boundsType(true)
8703
- ], Text.prototype, "autoSizeAlign", void 0);
8714
+ ], Text.prototype, "autoSizeAlign", undefined);
8704
8715
  __decorate([
8705
8716
  boundsType('normal')
8706
- ], Text.prototype, "textWrap", void 0);
8717
+ ], Text.prototype, "textWrap", undefined);
8707
8718
  __decorate([
8708
8719
  boundsType('show')
8709
- ], Text.prototype, "textOverflow", void 0);
8720
+ ], Text.prototype, "textOverflow", undefined);
8710
8721
  Text = __decorate([
8711
8722
  registerUI()
8712
8723
  ], Text);
@@ -8719,10 +8730,10 @@ let Path = class Path extends UI {
8719
8730
  };
8720
8731
  __decorate([
8721
8732
  dataProcessor(PathData)
8722
- ], Path.prototype, "__", void 0);
8733
+ ], Path.prototype, "__", undefined);
8723
8734
  __decorate([
8724
8735
  affectStrokeBoundsType('center')
8725
- ], Path.prototype, "strokeAlign", void 0);
8736
+ ], Path.prototype, "strokeAlign", undefined);
8726
8737
  Path = __decorate([
8727
8738
  registerUI()
8728
8739
  ], Path);
@@ -8761,10 +8772,10 @@ let Pen = class Pen extends Group {
8761
8772
  };
8762
8773
  __decorate([
8763
8774
  dataProcessor(PenData)
8764
- ], Pen.prototype, "__", void 0);
8775
+ ], Pen.prototype, "__", undefined);
8765
8776
  __decorate([
8766
8777
  penPathType()
8767
- ], Pen.prototype, "path", void 0);
8778
+ ], Pen.prototype, "path", undefined);
8768
8779
  Pen = __decorate([
8769
8780
  useModule(PathCreator, ['set', 'path', 'paint']),
8770
8781
  registerUI()
@@ -9398,7 +9409,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
9398
9409
  }
9399
9410
  else {
9400
9411
  if (!paint.patternTask) {
9401
- paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
9412
+ paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, undefined, undefined, function* () {
9402
9413
  paint.patternTask = null;
9403
9414
  if (canvas.bounds.hit(ui.__nowWorld))
9404
9415
  createPattern(ui, paint, pixelRatio);
@@ -9554,7 +9565,7 @@ function shadow(ui, current, shape) {
9554
9565
  const end = shadow.length - 1;
9555
9566
  toOffsetOutBounds$1(bounds, offsetOutBounds$1);
9556
9567
  shadow.forEach((item, index) => {
9557
- other.setWorldShadow((offsetOutBounds$1.offsetX + item.x * scaleX), (offsetOutBounds$1.offsetY + item.y * scaleY), item.blur * scaleX, item.color);
9568
+ other.setWorldShadow((offsetOutBounds$1.offsetX + item.x * scaleX), (offsetOutBounds$1.offsetY + item.y * scaleY), item.blur * scaleX, ColorConvert.string(item.color));
9558
9569
  spreadScale = item.spread ? 1 + item.spread * 2 / (__layout.boxBounds.width + (__layout.strokeBoxSpread || 0) * 2) : 0;
9559
9570
  drawWorldShadow(other, offsetOutBounds$1, spreadScale, shape);
9560
9571
  copyBounds = bounds;
@@ -9630,7 +9641,7 @@ function innerShadow(ui, current, shape) {
9630
9641
  other.copyWorld(shape.canvas, shapeBounds, bounds, 'source-out');
9631
9642
  copyBounds = bounds;
9632
9643
  }
9633
- other.fillWorld(copyBounds, item.color, 'source-in');
9644
+ other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
9634
9645
  if (ui.__worldFlipped) {
9635
9646
  current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
9636
9647
  }
@@ -9988,11 +9999,11 @@ const TextMode = 2;
9988
9999
  function layoutChar(drawData, style, width, _height) {
9989
10000
  const { rows } = drawData;
9990
10001
  const { textAlign, paraIndent, letterSpacing } = style;
9991
- let charX, addWordWidth, indentWidth, mode, wordChar;
10002
+ let charX, addWordWidth, indentWidth, mode, wordChar, wordsLength;
9992
10003
  rows.forEach(row => {
9993
10004
  if (row.words) {
9994
- indentWidth = paraIndent && row.paraStart ? paraIndent : 0;
9995
- addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
10005
+ indentWidth = paraIndent && row.paraStart ? paraIndent : 0, wordsLength = row.words.length;
10006
+ addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && wordsLength > 1) ? (width - row.width - indentWidth) / (wordsLength - 1) : 0;
9996
10007
  mode = (letterSpacing || row.isOverflow) ? CharMode : (addWordWidth > 0.01 ? WordMode : TextMode);
9997
10008
  if (row.isOverflow && !letterSpacing)
9998
10009
  row.textMode = true;
@@ -10004,7 +10015,7 @@ function layoutChar(drawData, style, width, _height) {
10004
10015
  row.x += indentWidth;
10005
10016
  charX = row.x;
10006
10017
  row.data = [];
10007
- row.words.forEach(word => {
10018
+ row.words.forEach((word, index) => {
10008
10019
  if (mode === WordMode) {
10009
10020
  wordChar = { char: '', x: charX };
10010
10021
  charX = toWordChar(word.data, charX, wordChar);
@@ -10014,7 +10025,7 @@ function layoutChar(drawData, style, width, _height) {
10014
10025
  else {
10015
10026
  charX = toChar(word.data, charX, row.data, row.isOverflow);
10016
10027
  }
10017
- if (addWordWidth && (!row.paraEnd || textAlign === 'both')) {
10028
+ if (addWordWidth && (!row.paraEnd || textAlign === 'both') && (index !== wordsLength - 1)) {
10018
10029
  charX += addWordWidth;
10019
10030
  row.width += addWordWidth;
10020
10031
  }
@@ -10266,3 +10277,4 @@ Object.assign(Effect, EffectModule);
10266
10277
  useCanvas();
10267
10278
 
10268
10279
  export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Frame, FrameData, Group, GroupData, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isNull, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
10280
+ //# sourceMappingURL=web.module.js.map