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.
package/dist/web.js CHANGED
@@ -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 === void 0 ? void 0 : value.constructor) === Object && ((_a = t[key]) === null || _a === void 0 ? void 0 : _a.constructor) === Object)
1539
+ if ((value === null || value === undefined ? undefined : value.constructor) === Object && ((_a = t[key]) === null || _a === undefined ? undefined : _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 === void 0 ? void 0 : _b.constructor) === Object)
1542
+ if (((_b = exclude[key]) === null || _b === undefined ? undefined : _b.constructor) === Object)
1543
1543
  assign(t[key] = {}, merge[key], exclude[key]);
1544
1544
  return;
1545
1545
  }
@@ -1708,7 +1708,7 @@ var LeaferUI = (function (exports) {
1708
1708
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1709
1709
  PERFORMANCE OF THIS SOFTWARE.
1710
1710
  ***************************************************************************** */
1711
- /* global Reflect, Promise, SuppressedError, Symbol */
1711
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
1712
1712
 
1713
1713
 
1714
1714
  function __decorate(decorators, target, key, desc) {
@@ -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 void 0; }
1779
+ getTransform() { return undefined; }
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 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; }
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; }
1840
1840
  fillText(_text, _x, _y, _maxWidth) { }
1841
- measureText(_text) { return void 0; }
1841
+ measureText(_text) { return undefined; }
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", void 0);
1849
+ ], Canvas.prototype, "smooth", undefined);
1850
1850
  __decorate([
1851
1851
  contextAttr('imageSmoothingQuality')
1852
- ], Canvas.prototype, "smoothLevel", void 0);
1852
+ ], Canvas.prototype, "smoothLevel", undefined);
1853
1853
  __decorate([
1854
1854
  contextAttr('globalAlpha')
1855
- ], Canvas.prototype, "opacity", void 0);
1855
+ ], Canvas.prototype, "opacity", undefined);
1856
1856
  __decorate([
1857
1857
  contextAttr()
1858
- ], Canvas.prototype, "fillStyle", void 0);
1858
+ ], Canvas.prototype, "fillStyle", undefined);
1859
1859
  __decorate([
1860
1860
  contextAttr()
1861
- ], Canvas.prototype, "strokeStyle", void 0);
1861
+ ], Canvas.prototype, "strokeStyle", undefined);
1862
1862
  __decorate([
1863
1863
  contextAttr('lineWidth')
1864
- ], Canvas.prototype, "strokeWidth", void 0);
1864
+ ], Canvas.prototype, "strokeWidth", undefined);
1865
1865
  __decorate([
1866
1866
  contextAttr('lineCap')
1867
- ], Canvas.prototype, "strokeCap", void 0);
1867
+ ], Canvas.prototype, "strokeCap", undefined);
1868
1868
  __decorate([
1869
1869
  contextAttr('lineJoin')
1870
- ], Canvas.prototype, "strokeJoin", void 0);
1870
+ ], Canvas.prototype, "strokeJoin", undefined);
1871
1871
  __decorate([
1872
1872
  contextAttr('lineDashOffset')
1873
- ], Canvas.prototype, "dashOffset", void 0);
1873
+ ], Canvas.prototype, "dashOffset", undefined);
1874
1874
  __decorate([
1875
1875
  contextAttr()
1876
- ], Canvas.prototype, "miterLimit", void 0);
1876
+ ], Canvas.prototype, "miterLimit", undefined);
1877
1877
  __decorate([
1878
1878
  contextAttr()
1879
- ], Canvas.prototype, "shadowBlur", void 0);
1879
+ ], Canvas.prototype, "shadowBlur", undefined);
1880
1880
  __decorate([
1881
1881
  contextAttr()
1882
- ], Canvas.prototype, "shadowColor", void 0);
1882
+ ], Canvas.prototype, "shadowColor", undefined);
1883
1883
  __decorate([
1884
1884
  contextAttr()
1885
- ], Canvas.prototype, "shadowOffsetX", void 0);
1885
+ ], Canvas.prototype, "shadowOffsetX", undefined);
1886
1886
  __decorate([
1887
1887
  contextAttr()
1888
- ], Canvas.prototype, "shadowOffsetY", void 0);
1888
+ ], Canvas.prototype, "shadowOffsetY", undefined);
1889
1889
  __decorate([
1890
1890
  contextAttr()
1891
- ], Canvas.prototype, "filter", void 0);
1891
+ ], Canvas.prototype, "filter", undefined);
1892
1892
  __decorate([
1893
1893
  contextAttr()
1894
- ], Canvas.prototype, "font", void 0);
1894
+ ], Canvas.prototype, "font", undefined);
1895
1895
  __decorate([
1896
1896
  contextAttr()
1897
- ], Canvas.prototype, "fontKerning", void 0);
1897
+ ], Canvas.prototype, "fontKerning", undefined);
1898
1898
  __decorate([
1899
1899
  contextAttr()
1900
- ], Canvas.prototype, "fontStretch", void 0);
1900
+ ], Canvas.prototype, "fontStretch", undefined);
1901
1901
  __decorate([
1902
1902
  contextAttr()
1903
- ], Canvas.prototype, "fontVariantCaps", void 0);
1903
+ ], Canvas.prototype, "fontVariantCaps", undefined);
1904
1904
  __decorate([
1905
1905
  contextAttr()
1906
- ], Canvas.prototype, "textAlign", void 0);
1906
+ ], Canvas.prototype, "textAlign", undefined);
1907
1907
  __decorate([
1908
1908
  contextAttr()
1909
- ], Canvas.prototype, "textBaseline", void 0);
1909
+ ], Canvas.prototype, "textBaseline", undefined);
1910
1910
  __decorate([
1911
1911
  contextAttr()
1912
- ], Canvas.prototype, "textRendering", void 0);
1912
+ ], Canvas.prototype, "textRendering", undefined);
1913
1913
  __decorate([
1914
1914
  contextAttr()
1915
- ], Canvas.prototype, "wordSpacing", void 0);
1915
+ ], Canvas.prototype, "wordSpacing", undefined);
1916
1916
  __decorate([
1917
1917
  contextAttr()
1918
- ], Canvas.prototype, "letterSpacing", void 0);
1918
+ ], Canvas.prototype, "letterSpacing", undefined);
1919
1919
  __decorate([
1920
1920
  contextAttr()
1921
- ], Canvas.prototype, "direction", void 0);
1921
+ ], Canvas.prototype, "direction", undefined);
1922
1922
  __decorate([
1923
1923
  contextMethod()
1924
1924
  ], Canvas.prototype, "setTransform", null);
@@ -3387,7 +3387,7 @@ var LeaferUI = (function (exports) {
3387
3387
  this.task = task;
3388
3388
  }
3389
3389
  run() {
3390
- return __awaiter(this, void 0, void 0, function* () {
3390
+ return __awaiter(this, undefined, undefined, function* () {
3391
3391
  try {
3392
3392
  if (this.task && !this.isComplete && this.parent.running)
3393
3393
  yield this.task();
@@ -3699,7 +3699,7 @@ var LeaferUI = (function (exports) {
3699
3699
  load(onSuccess, onError) {
3700
3700
  if (!this.loading) {
3701
3701
  this.loading = true;
3702
- ImageManager.tasker.add(() => __awaiter(this, void 0, void 0, function* () {
3702
+ ImageManager.tasker.add(() => __awaiter(this, undefined, undefined, function* () {
3703
3703
  return yield Platform.origin.loadImage(this.url).then((img) => {
3704
3704
  this.ready = true;
3705
3705
  this.width = img.naturalWidth || img.width;
@@ -3824,10 +3824,10 @@ var LeaferUI = (function (exports) {
3824
3824
  return decorateLeafAttr(defaultValue, (key) => attr({
3825
3825
  set(value) {
3826
3826
  if (this.__setAttr(key, value)) {
3827
- this.__layout.matrixChanged || this.__layout.matrixChange();
3828
3827
  this.__hasAutoLayout = !!(this.origin || this.around || this.flow);
3829
3828
  if (!this.__local)
3830
3829
  this.__layout.createLocal();
3830
+ doBoundsType(this);
3831
3831
  }
3832
3832
  }
3833
3833
  }));
@@ -4210,55 +4210,62 @@ var LeaferUI = (function (exports) {
4210
4210
  y += t.y;
4211
4211
  transition ? t.animate({ x, y }, transition) : (t.x = x, t.y = y);
4212
4212
  },
4213
- zoomOfWorld(t, origin, scaleX, scaleY, resize) {
4214
- L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
4213
+ zoomOfWorld(t, origin, scaleX, scaleY, resize, transition) {
4214
+ L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize, transition);
4215
4215
  },
4216
- zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize) {
4217
- copy$6(matrix, t.__localMatrix);
4216
+ zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize, transition) {
4217
+ const o = t.__localMatrix;
4218
+ if (typeof scaleY !== 'number') {
4219
+ if (scaleY)
4220
+ transition = scaleY;
4221
+ scaleY = scaleX;
4222
+ }
4223
+ copy$6(matrix, o);
4218
4224
  scaleOfOuter$2(matrix, origin, scaleX, scaleY);
4219
4225
  if (t.origin || t.around) {
4220
- L.setTransform(t, matrix, resize);
4226
+ L.setTransform(t, matrix, resize, transition);
4221
4227
  }
4222
4228
  else {
4223
- moveByMatrix(t, matrix);
4224
- t.scaleResize(scaleX, scaleY, resize !== true);
4229
+ const x = t.x + matrix.e - o.e, y = t.y + matrix.f - o.f;
4230
+ if (transition && !resize)
4231
+ t.animate({ x, y, scaleX: t.scaleX * scaleX, scaleY: t.scaleY * scaleY }, transition);
4232
+ else
4233
+ t.x = x, t.y = y, t.scaleResize(scaleX, scaleY, resize !== true);
4225
4234
  }
4226
4235
  },
4227
- rotateOfWorld(t, origin, angle) {
4228
- L.rotateOfLocal(t, getTempLocal(t, origin), angle);
4236
+ rotateOfWorld(t, origin, angle, transition) {
4237
+ L.rotateOfLocal(t, getTempLocal(t, origin), angle, transition);
4229
4238
  },
4230
- rotateOfLocal(t, origin, angle) {
4231
- copy$6(matrix, t.__localMatrix);
4239
+ rotateOfLocal(t, origin, angle, transition) {
4240
+ const o = t.__localMatrix;
4241
+ copy$6(matrix, o);
4232
4242
  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
- }
4243
+ if (t.origin || t.around)
4244
+ L.setTransform(t, matrix, false, transition);
4245
+ else
4246
+ t.set({ x: t.x + matrix.e - o.e, y: t.y + matrix.f - o.f, rotation: MathHelper.formatRotation(t.rotation + angle) }, transition);
4240
4247
  },
4241
- skewOfWorld(t, origin, skewX, skewY, resize) {
4242
- L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize);
4248
+ skewOfWorld(t, origin, skewX, skewY, resize, transition) {
4249
+ L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
4243
4250
  },
4244
- skewOfLocal(t, origin, skewX, skewY = 0, resize) {
4251
+ skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
4245
4252
  copy$6(matrix, t.__localMatrix);
4246
4253
  skewOfOuter(matrix, origin, skewX, skewY);
4247
- L.setTransform(t, matrix, resize);
4254
+ L.setTransform(t, matrix, resize, transition);
4248
4255
  },
4249
- transformWorld(t, transform, resize) {
4256
+ transformWorld(t, transform, resize, transition) {
4250
4257
  copy$6(matrix, t.worldTransform);
4251
4258
  multiplyParent$2(matrix, transform);
4252
4259
  if (t.parent)
4253
4260
  divideParent(matrix, t.parent.worldTransform);
4254
- L.setTransform(t, matrix, resize);
4261
+ L.setTransform(t, matrix, resize, transition);
4255
4262
  },
4256
- transform(t, transform, resize) {
4263
+ transform(t, transform, resize, transition) {
4257
4264
  copy$6(matrix, t.localTransform);
4258
4265
  multiplyParent$2(matrix, transform);
4259
- L.setTransform(t, matrix, resize);
4266
+ L.setTransform(t, matrix, resize, transition);
4260
4267
  },
4261
- setTransform(t, transform, resize) {
4268
+ setTransform(t, transform, resize, transition) {
4262
4269
  const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
4263
4270
  const layout = getLayout(transform, originPoint, data.around && L.getInnerOrigin(t, data.around));
4264
4271
  if (resize) {
@@ -4273,7 +4280,7 @@ var LeaferUI = (function (exports) {
4273
4280
  t.scaleResize(scaleX, scaleY, false);
4274
4281
  }
4275
4282
  else
4276
- t.set(layout);
4283
+ t.set(layout, transition);
4277
4284
  },
4278
4285
  getFlipTransform(t, axis) {
4279
4286
  const m = getMatrixData();
@@ -4310,11 +4317,6 @@ var LeaferUI = (function (exports) {
4310
4317
  };
4311
4318
  const L = LeafHelper;
4312
4319
  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
4320
  function getTempLocal(t, world) {
4319
4321
  t.__layout.update();
4320
4322
  return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
@@ -5178,8 +5180,7 @@ var LeaferUI = (function (exports) {
5178
5180
  __updateAutoLayout() {
5179
5181
  this.__layout.matrixChanged = true;
5180
5182
  if (this.isBranch) {
5181
- if (this.leaferIsReady)
5182
- this.leafer.layouter.addExtra(this);
5183
+ this.__extraUpdate();
5183
5184
  if (this.__.flow) {
5184
5185
  if (this.__layout.boxChanged)
5185
5186
  this.__updateFlowLayout();
@@ -5332,7 +5333,7 @@ var LeaferUI = (function (exports) {
5332
5333
  get __worldFlipped() { return this.__world.scaleX < 0 || this.__world.scaleY < 0; }
5333
5334
  get __onlyHitMask() { return this.__hasMask && !this.__.hitChildren; }
5334
5335
  get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
5335
- get __inLazyBounds() { const { leafer } = this; return leafer && leafer.created && leafer.lazyBounds.hit(this.__world); }
5336
+ get __inLazyBounds() { return this.leaferIsCreated && this.leafer.lazyBounds.hit(this.__world); }
5336
5337
  get pathInputed() { return this.__.__pathInputed; }
5337
5338
  set event(map) { this.on(map); }
5338
5339
  constructor(data) {
@@ -5443,6 +5444,10 @@ var LeaferUI = (function (exports) {
5443
5444
  forceRender(_bounds, _sync) {
5444
5445
  this.forceUpdate('surface');
5445
5446
  }
5447
+ __extraUpdate() {
5448
+ if (this.leaferIsReady)
5449
+ this.leafer.layouter.addExtra(this);
5450
+ }
5446
5451
  __updateWorldMatrix() { }
5447
5452
  __updateLocalMatrix() { }
5448
5453
  __updateWorldBounds() { }
@@ -5585,11 +5590,11 @@ var LeaferUI = (function (exports) {
5585
5590
  const layer = this.leafer ? this.leafer.zoomLayer : this;
5586
5591
  return layer.getWorldPoint(page, relative, distance, change);
5587
5592
  }
5588
- setTransform(matrix, resize) {
5589
- setTransform(this, matrix, resize);
5593
+ setTransform(matrix, resize, transition) {
5594
+ setTransform(this, matrix, resize, transition);
5590
5595
  }
5591
- transform(matrix, resize) {
5592
- transform(this, matrix, resize);
5596
+ transform(matrix, resize, transition) {
5597
+ transform(this, matrix, resize, transition);
5593
5598
  }
5594
5599
  move(x, y, transition) {
5595
5600
  moveLocal(this, x, y, transition);
@@ -5597,32 +5602,32 @@ var LeaferUI = (function (exports) {
5597
5602
  moveInner(x, y, transition) {
5598
5603
  moveWorld(this, x, y, true, transition);
5599
5604
  }
5600
- scaleOf(origin, scaleX, scaleY, resize) {
5601
- zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize);
5605
+ scaleOf(origin, scaleX, scaleY, resize, transition) {
5606
+ zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize, transition);
5602
5607
  }
5603
- rotateOf(origin, rotation) {
5604
- rotateOfLocal(this, getLocalOrigin(this, origin), rotation);
5608
+ rotateOf(origin, rotation, transition) {
5609
+ rotateOfLocal(this, getLocalOrigin(this, origin), rotation, transition);
5605
5610
  }
5606
- skewOf(origin, skewX, skewY, resize) {
5607
- skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize);
5611
+ skewOf(origin, skewX, skewY, resize, transition) {
5612
+ skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize, transition);
5608
5613
  }
5609
- transformWorld(worldTransform, resize) {
5610
- transformWorld(this, worldTransform, resize);
5614
+ transformWorld(worldTransform, resize, transition) {
5615
+ transformWorld(this, worldTransform, resize, transition);
5611
5616
  }
5612
5617
  moveWorld(x, y, transition) {
5613
5618
  moveWorld(this, x, y, false, transition);
5614
5619
  }
5615
- scaleOfWorld(worldOrigin, scaleX, scaleY, resize) {
5616
- zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize);
5620
+ scaleOfWorld(worldOrigin, scaleX, scaleY, resize, transition) {
5621
+ zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize, transition);
5617
5622
  }
5618
5623
  rotateOfWorld(worldOrigin, rotation) {
5619
5624
  rotateOfWorld(this, worldOrigin, rotation);
5620
5625
  }
5621
- skewOfWorld(worldOrigin, skewX, skewY, resize) {
5622
- skewOfWorld(this, worldOrigin, skewX, skewY, resize);
5626
+ skewOfWorld(worldOrigin, skewX, skewY, resize, transition) {
5627
+ skewOfWorld(this, worldOrigin, skewX, skewY, resize, transition);
5623
5628
  }
5624
- flip(axis) {
5625
- transform(this, getFlipTransform(this, axis));
5629
+ flip(axis, transition) {
5630
+ transform(this, getFlipTransform(this, axis), false, transition);
5626
5631
  }
5627
5632
  scaleResize(scaleX, scaleY = scaleX, _noResize) {
5628
5633
  this.scaleX *= scaleX;
@@ -6010,7 +6015,7 @@ var LeaferUI = (function (exports) {
6010
6015
  }
6011
6016
  }
6012
6017
 
6013
- const version = "1.3.2";
6018
+ const version = "1.4.0";
6014
6019
 
6015
6020
  const debug$4 = Debug.get('LeaferCanvas');
6016
6021
  class LeaferCanvas extends LeaferCanvasBase {
@@ -6130,7 +6135,7 @@ var LeaferUI = (function (exports) {
6130
6135
  }
6131
6136
  }
6132
6137
  else {
6133
- window.addEventListener('resize', () => {
6138
+ window.addEventListener('resize', this.windowListener = () => {
6134
6139
  const pixelRatio = Platform.devicePixelRatio;
6135
6140
  if (this.pixelRatio !== pixelRatio) {
6136
6141
  const { width, height } = this;
@@ -6159,11 +6164,9 @@ var LeaferUI = (function (exports) {
6159
6164
  }
6160
6165
  stopAutoLayout() {
6161
6166
  this.autoLayout = false;
6162
- this.resizeListener = null;
6163
- if (this.resizeObserver) {
6167
+ if (this.resizeObserver)
6164
6168
  this.resizeObserver.disconnect();
6165
- this.resizeObserver = null;
6166
- }
6169
+ this.resizeListener = this.resizeObserver = null;
6167
6170
  }
6168
6171
  emitResize(size) {
6169
6172
  const oldSize = {};
@@ -6184,6 +6187,10 @@ var LeaferUI = (function (exports) {
6184
6187
  destroy() {
6185
6188
  if (this.view) {
6186
6189
  this.stopAutoLayout();
6190
+ if (this.windowListener) {
6191
+ window.removeEventListener('resize', this.windowListener);
6192
+ this.windowListener = null;
6193
+ }
6187
6194
  if (!this.unreal) {
6188
6195
  const view = this.view;
6189
6196
  if (view.parentElement)
@@ -6210,7 +6217,10 @@ var LeaferUI = (function (exports) {
6210
6217
  canvas.height = height;
6211
6218
  return canvas;
6212
6219
  },
6213
- canvasToDataURL: (canvas, type, quality) => canvas.toDataURL(mineType(type), quality),
6220
+ canvasToDataURL: (canvas, type, quality) => {
6221
+ const imageType = mineType(type), url = canvas.toDataURL(imageType, quality);
6222
+ return imageType === 'image/bmp' ? url.replace('image/png;', 'image/bmp;') : url;
6223
+ },
6214
6224
  canvasToBolb: (canvas, type, quality) => new Promise((resolve) => canvas.toBlob(resolve, mineType(type), quality)),
6215
6225
  canvasSaveAs: (canvas, filename, quality) => {
6216
6226
  const url = canvas.toDataURL(mineType(fileType(filename)), quality);
@@ -6255,7 +6265,7 @@ var LeaferUI = (function (exports) {
6255
6265
  Platform.name = 'web';
6256
6266
  Platform.isMobile = 'ontouchstart' in window;
6257
6267
  Platform.requestRender = function (render) { window.requestAnimationFrame(render); };
6258
- defineKey(Platform, 'devicePixelRatio', { get() { return Math.max(1, devicePixelRatio); } });
6268
+ defineKey(Platform, 'devicePixelRatio', { get() { return devicePixelRatio; } });
6259
6269
  const { userAgent } = navigator;
6260
6270
  if (userAgent.indexOf("Firefox") > -1) {
6261
6271
  Platform.conicGradientRotate90 = true;
@@ -6531,7 +6541,7 @@ var LeaferUI = (function (exports) {
6531
6541
  }
6532
6542
  partLayout() {
6533
6543
  var _a;
6534
- if (!((_a = this.__updatedList) === null || _a === void 0 ? void 0 : _a.length))
6544
+ if (!((_a = this.__updatedList) === null || _a === undefined ? undefined : _a.length))
6535
6545
  return;
6536
6546
  const t = Run.start('PartLayout');
6537
6547
  const { target, __updatedList: updateList } = this;
@@ -6946,6 +6956,7 @@ var LeaferUI = (function (exports) {
6946
6956
  return t.fill && this.__hasStroke;
6947
6957
  }
6948
6958
  get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
6959
+ get __hasSurface() { const t = this; return (t.fill || t.stroke); }
6949
6960
  get __autoWidth() { return !this._width; }
6950
6961
  get __autoHeight() { return !this._height; }
6951
6962
  get __autoSide() { return !this._width || !this._height; }
@@ -7449,199 +7460,199 @@ var LeaferUI = (function (exports) {
7449
7460
  };
7450
7461
  __decorate([
7451
7462
  dataProcessor(UIData)
7452
- ], exports.UI.prototype, "__", void 0);
7463
+ ], exports.UI.prototype, "__", undefined);
7453
7464
  __decorate([
7454
7465
  zoomLayerType()
7455
- ], exports.UI.prototype, "zoomLayer", void 0);
7466
+ ], exports.UI.prototype, "zoomLayer", undefined);
7456
7467
  __decorate([
7457
7468
  dataType('')
7458
- ], exports.UI.prototype, "id", void 0);
7469
+ ], exports.UI.prototype, "id", undefined);
7459
7470
  __decorate([
7460
7471
  dataType('')
7461
- ], exports.UI.prototype, "name", void 0);
7472
+ ], exports.UI.prototype, "name", undefined);
7462
7473
  __decorate([
7463
7474
  dataType('')
7464
- ], exports.UI.prototype, "className", void 0);
7475
+ ], exports.UI.prototype, "className", undefined);
7465
7476
  __decorate([
7466
7477
  surfaceType('pass-through')
7467
- ], exports.UI.prototype, "blendMode", void 0);
7478
+ ], exports.UI.prototype, "blendMode", undefined);
7468
7479
  __decorate([
7469
7480
  opacityType(1)
7470
- ], exports.UI.prototype, "opacity", void 0);
7481
+ ], exports.UI.prototype, "opacity", undefined);
7471
7482
  __decorate([
7472
7483
  visibleType(true)
7473
- ], exports.UI.prototype, "visible", void 0);
7484
+ ], exports.UI.prototype, "visible", undefined);
7474
7485
  __decorate([
7475
7486
  surfaceType(false)
7476
- ], exports.UI.prototype, "locked", void 0);
7487
+ ], exports.UI.prototype, "locked", undefined);
7477
7488
  __decorate([
7478
7489
  sortType(0)
7479
- ], exports.UI.prototype, "zIndex", void 0);
7490
+ ], exports.UI.prototype, "zIndex", undefined);
7480
7491
  __decorate([
7481
7492
  maskType(false)
7482
- ], exports.UI.prototype, "mask", void 0);
7493
+ ], exports.UI.prototype, "mask", undefined);
7483
7494
  __decorate([
7484
7495
  eraserType(false)
7485
- ], exports.UI.prototype, "eraser", void 0);
7496
+ ], exports.UI.prototype, "eraser", undefined);
7486
7497
  __decorate([
7487
7498
  positionType(0, true)
7488
- ], exports.UI.prototype, "x", void 0);
7499
+ ], exports.UI.prototype, "x", undefined);
7489
7500
  __decorate([
7490
7501
  positionType(0, true)
7491
- ], exports.UI.prototype, "y", void 0);
7502
+ ], exports.UI.prototype, "y", undefined);
7492
7503
  __decorate([
7493
7504
  boundsType(100, true)
7494
- ], exports.UI.prototype, "width", void 0);
7505
+ ], exports.UI.prototype, "width", undefined);
7495
7506
  __decorate([
7496
7507
  boundsType(100, true)
7497
- ], exports.UI.prototype, "height", void 0);
7508
+ ], exports.UI.prototype, "height", undefined);
7498
7509
  __decorate([
7499
7510
  scaleType(1, true)
7500
- ], exports.UI.prototype, "scaleX", void 0);
7511
+ ], exports.UI.prototype, "scaleX", undefined);
7501
7512
  __decorate([
7502
7513
  scaleType(1, true)
7503
- ], exports.UI.prototype, "scaleY", void 0);
7514
+ ], exports.UI.prototype, "scaleY", undefined);
7504
7515
  __decorate([
7505
7516
  rotationType(0, true)
7506
- ], exports.UI.prototype, "rotation", void 0);
7517
+ ], exports.UI.prototype, "rotation", undefined);
7507
7518
  __decorate([
7508
7519
  rotationType(0, true)
7509
- ], exports.UI.prototype, "skewX", void 0);
7520
+ ], exports.UI.prototype, "skewX", undefined);
7510
7521
  __decorate([
7511
7522
  rotationType(0, true)
7512
- ], exports.UI.prototype, "skewY", void 0);
7523
+ ], exports.UI.prototype, "skewY", undefined);
7513
7524
  __decorate([
7514
7525
  positionType(0, true)
7515
- ], exports.UI.prototype, "offsetX", void 0);
7526
+ ], exports.UI.prototype, "offsetX", undefined);
7516
7527
  __decorate([
7517
7528
  positionType(0, true)
7518
- ], exports.UI.prototype, "offsetY", void 0);
7529
+ ], exports.UI.prototype, "offsetY", undefined);
7519
7530
  __decorate([
7520
7531
  positionType(0, true)
7521
- ], exports.UI.prototype, "scrollX", void 0);
7532
+ ], exports.UI.prototype, "scrollX", undefined);
7522
7533
  __decorate([
7523
7534
  positionType(0, true)
7524
- ], exports.UI.prototype, "scrollY", void 0);
7535
+ ], exports.UI.prototype, "scrollY", undefined);
7525
7536
  __decorate([
7526
7537
  autoLayoutType()
7527
- ], exports.UI.prototype, "origin", void 0);
7538
+ ], exports.UI.prototype, "origin", undefined);
7528
7539
  __decorate([
7529
7540
  autoLayoutType()
7530
- ], exports.UI.prototype, "around", void 0);
7541
+ ], exports.UI.prototype, "around", undefined);
7531
7542
  __decorate([
7532
7543
  dataType(false)
7533
- ], exports.UI.prototype, "lazy", void 0);
7544
+ ], exports.UI.prototype, "lazy", undefined);
7534
7545
  __decorate([
7535
7546
  naturalBoundsType(1)
7536
- ], exports.UI.prototype, "pixelRatio", void 0);
7547
+ ], exports.UI.prototype, "pixelRatio", undefined);
7537
7548
  __decorate([
7538
7549
  pathInputType()
7539
- ], exports.UI.prototype, "path", void 0);
7550
+ ], exports.UI.prototype, "path", undefined);
7540
7551
  __decorate([
7541
7552
  pathType()
7542
- ], exports.UI.prototype, "windingRule", void 0);
7553
+ ], exports.UI.prototype, "windingRule", undefined);
7543
7554
  __decorate([
7544
7555
  pathType(true)
7545
- ], exports.UI.prototype, "closed", void 0);
7556
+ ], exports.UI.prototype, "closed", undefined);
7546
7557
  __decorate([
7547
7558
  boundsType(0)
7548
- ], exports.UI.prototype, "padding", void 0);
7559
+ ], exports.UI.prototype, "padding", undefined);
7549
7560
  __decorate([
7550
7561
  boundsType(false)
7551
- ], exports.UI.prototype, "lockRatio", void 0);
7562
+ ], exports.UI.prototype, "lockRatio", undefined);
7552
7563
  __decorate([
7553
7564
  boundsType()
7554
- ], exports.UI.prototype, "widthRange", void 0);
7565
+ ], exports.UI.prototype, "widthRange", undefined);
7555
7566
  __decorate([
7556
7567
  boundsType()
7557
- ], exports.UI.prototype, "heightRange", void 0);
7568
+ ], exports.UI.prototype, "heightRange", undefined);
7558
7569
  __decorate([
7559
7570
  dataType(false)
7560
- ], exports.UI.prototype, "draggable", void 0);
7571
+ ], exports.UI.prototype, "draggable", undefined);
7561
7572
  __decorate([
7562
7573
  dataType()
7563
- ], exports.UI.prototype, "dragBounds", void 0);
7574
+ ], exports.UI.prototype, "dragBounds", undefined);
7564
7575
  __decorate([
7565
7576
  dataType(false)
7566
- ], exports.UI.prototype, "editable", void 0);
7577
+ ], exports.UI.prototype, "editable", undefined);
7567
7578
  __decorate([
7568
7579
  hitType(true)
7569
- ], exports.UI.prototype, "hittable", void 0);
7580
+ ], exports.UI.prototype, "hittable", undefined);
7570
7581
  __decorate([
7571
7582
  hitType('path')
7572
- ], exports.UI.prototype, "hitFill", void 0);
7583
+ ], exports.UI.prototype, "hitFill", undefined);
7573
7584
  __decorate([
7574
7585
  strokeType('path')
7575
- ], exports.UI.prototype, "hitStroke", void 0);
7586
+ ], exports.UI.prototype, "hitStroke", undefined);
7576
7587
  __decorate([
7577
7588
  hitType(false)
7578
- ], exports.UI.prototype, "hitBox", void 0);
7589
+ ], exports.UI.prototype, "hitBox", undefined);
7579
7590
  __decorate([
7580
7591
  hitType(true)
7581
- ], exports.UI.prototype, "hitChildren", void 0);
7592
+ ], exports.UI.prototype, "hitChildren", undefined);
7582
7593
  __decorate([
7583
7594
  hitType(true)
7584
- ], exports.UI.prototype, "hitSelf", void 0);
7595
+ ], exports.UI.prototype, "hitSelf", undefined);
7585
7596
  __decorate([
7586
7597
  hitType()
7587
- ], exports.UI.prototype, "hitRadius", void 0);
7598
+ ], exports.UI.prototype, "hitRadius", undefined);
7588
7599
  __decorate([
7589
7600
  cursorType('')
7590
- ], exports.UI.prototype, "cursor", void 0);
7601
+ ], exports.UI.prototype, "cursor", undefined);
7591
7602
  __decorate([
7592
7603
  surfaceType()
7593
- ], exports.UI.prototype, "fill", void 0);
7604
+ ], exports.UI.prototype, "fill", undefined);
7594
7605
  __decorate([
7595
7606
  strokeType()
7596
- ], exports.UI.prototype, "stroke", void 0);
7607
+ ], exports.UI.prototype, "stroke", undefined);
7597
7608
  __decorate([
7598
7609
  strokeType('inside')
7599
- ], exports.UI.prototype, "strokeAlign", void 0);
7610
+ ], exports.UI.prototype, "strokeAlign", undefined);
7600
7611
  __decorate([
7601
7612
  strokeType(1)
7602
- ], exports.UI.prototype, "strokeWidth", void 0);
7613
+ ], exports.UI.prototype, "strokeWidth", undefined);
7603
7614
  __decorate([
7604
7615
  strokeType(false)
7605
- ], exports.UI.prototype, "strokeWidthFixed", void 0);
7616
+ ], exports.UI.prototype, "strokeWidthFixed", undefined);
7606
7617
  __decorate([
7607
7618
  strokeType('none')
7608
- ], exports.UI.prototype, "strokeCap", void 0);
7619
+ ], exports.UI.prototype, "strokeCap", undefined);
7609
7620
  __decorate([
7610
7621
  strokeType('miter')
7611
- ], exports.UI.prototype, "strokeJoin", void 0);
7622
+ ], exports.UI.prototype, "strokeJoin", undefined);
7612
7623
  __decorate([
7613
7624
  strokeType()
7614
- ], exports.UI.prototype, "dashPattern", void 0);
7625
+ ], exports.UI.prototype, "dashPattern", undefined);
7615
7626
  __decorate([
7616
7627
  strokeType()
7617
- ], exports.UI.prototype, "dashOffset", void 0);
7628
+ ], exports.UI.prototype, "dashOffset", undefined);
7618
7629
  __decorate([
7619
7630
  strokeType(10)
7620
- ], exports.UI.prototype, "miterLimit", void 0);
7631
+ ], exports.UI.prototype, "miterLimit", undefined);
7621
7632
  __decorate([
7622
7633
  pathType(0)
7623
- ], exports.UI.prototype, "cornerRadius", void 0);
7634
+ ], exports.UI.prototype, "cornerRadius", undefined);
7624
7635
  __decorate([
7625
7636
  pathType()
7626
- ], exports.UI.prototype, "cornerSmoothing", void 0);
7637
+ ], exports.UI.prototype, "cornerSmoothing", undefined);
7627
7638
  __decorate([
7628
7639
  effectType()
7629
- ], exports.UI.prototype, "shadow", void 0);
7640
+ ], exports.UI.prototype, "shadow", undefined);
7630
7641
  __decorate([
7631
7642
  effectType()
7632
- ], exports.UI.prototype, "innerShadow", void 0);
7643
+ ], exports.UI.prototype, "innerShadow", undefined);
7633
7644
  __decorate([
7634
7645
  effectType()
7635
- ], exports.UI.prototype, "blur", void 0);
7646
+ ], exports.UI.prototype, "blur", undefined);
7636
7647
  __decorate([
7637
7648
  effectType()
7638
- ], exports.UI.prototype, "backgroundBlur", void 0);
7649
+ ], exports.UI.prototype, "backgroundBlur", undefined);
7639
7650
  __decorate([
7640
7651
  effectType()
7641
- ], exports.UI.prototype, "grayscale", void 0);
7652
+ ], exports.UI.prototype, "grayscale", undefined);
7642
7653
  __decorate([
7643
7654
  dataType({})
7644
- ], exports.UI.prototype, "data", void 0);
7655
+ ], exports.UI.prototype, "data", undefined);
7645
7656
  __decorate([
7646
7657
  rewrite(exports.Leaf.prototype.reset)
7647
7658
  ], exports.UI.prototype, "reset", null);
@@ -7702,7 +7713,7 @@ var LeaferUI = (function (exports) {
7702
7713
  };
7703
7714
  __decorate([
7704
7715
  dataProcessor(GroupData)
7705
- ], exports.Group.prototype, "__", void 0);
7716
+ ], exports.Group.prototype, "__", undefined);
7706
7717
  exports.Group = __decorate([
7707
7718
  useModule(exports.Branch),
7708
7719
  registerUI()
@@ -7873,8 +7884,6 @@ var LeaferUI = (function (exports) {
7873
7884
  __setAttr(attrName, newValue) {
7874
7885
  if (this.canvas) {
7875
7886
  if (canvasSizeAttrs.includes(attrName)) {
7876
- if (!newValue)
7877
- debug.warn(attrName + ' is 0');
7878
7887
  this.__changeCanvasSize(attrName, newValue);
7879
7888
  }
7880
7889
  else if (attrName === 'fill') {
@@ -8077,10 +8086,10 @@ var LeaferUI = (function (exports) {
8077
8086
  exports.Leafer.list = new LeafList();
8078
8087
  __decorate([
8079
8088
  dataProcessor(LeaferData)
8080
- ], exports.Leafer.prototype, "__", void 0);
8089
+ ], exports.Leafer.prototype, "__", undefined);
8081
8090
  __decorate([
8082
8091
  boundsType()
8083
- ], exports.Leafer.prototype, "pixelRatio", void 0);
8092
+ ], exports.Leafer.prototype, "pixelRatio", undefined);
8084
8093
  exports.Leafer = Leafer_1 = __decorate([
8085
8094
  registerUI()
8086
8095
  ], exports.Leafer);
@@ -8093,7 +8102,7 @@ var LeaferUI = (function (exports) {
8093
8102
  };
8094
8103
  __decorate([
8095
8104
  dataProcessor(RectData)
8096
- ], exports.Rect.prototype, "__", void 0);
8105
+ ], exports.Rect.prototype, "__", undefined);
8097
8106
  exports.Rect = __decorate([
8098
8107
  useModule(RectRender),
8099
8108
  rewriteAble(),
@@ -8118,6 +8127,8 @@ var LeaferUI = (function (exports) {
8118
8127
  const data = this.__;
8119
8128
  if (this.children.length) {
8120
8129
  if (data.__autoSide) {
8130
+ if (data.__hasSurface)
8131
+ this.__extraUpdate();
8121
8132
  super.__updateBoxBounds();
8122
8133
  const { boxBounds } = this.__layout;
8123
8134
  if (!data.__autoSize) {
@@ -8182,13 +8193,13 @@ var LeaferUI = (function (exports) {
8182
8193
  };
8183
8194
  __decorate([
8184
8195
  dataProcessor(BoxData)
8185
- ], exports.Box.prototype, "__", void 0);
8196
+ ], exports.Box.prototype, "__", undefined);
8186
8197
  __decorate([
8187
8198
  dataType(false)
8188
- ], exports.Box.prototype, "resizeChildren", void 0);
8199
+ ], exports.Box.prototype, "resizeChildren", undefined);
8189
8200
  __decorate([
8190
8201
  affectRenderBoundsType('show')
8191
- ], exports.Box.prototype, "overflow", void 0);
8202
+ ], exports.Box.prototype, "overflow", undefined);
8192
8203
  __decorate([
8193
8204
  rewrite(rect.__updateStrokeSpread)
8194
8205
  ], exports.Box.prototype, "__updateStrokeSpread", null);
@@ -8227,13 +8238,13 @@ var LeaferUI = (function (exports) {
8227
8238
  };
8228
8239
  __decorate([
8229
8240
  dataProcessor(FrameData)
8230
- ], exports.Frame.prototype, "__", void 0);
8241
+ ], exports.Frame.prototype, "__", undefined);
8231
8242
  __decorate([
8232
8243
  surfaceType('#FFFFFF')
8233
- ], exports.Frame.prototype, "fill", void 0);
8244
+ ], exports.Frame.prototype, "fill", undefined);
8234
8245
  __decorate([
8235
8246
  affectRenderBoundsType('hide')
8236
- ], exports.Frame.prototype, "overflow", void 0);
8247
+ ], exports.Frame.prototype, "overflow", undefined);
8237
8248
  exports.Frame = __decorate([
8238
8249
  registerUI()
8239
8250
  ], exports.Frame);
@@ -8280,16 +8291,16 @@ var LeaferUI = (function (exports) {
8280
8291
  };
8281
8292
  __decorate([
8282
8293
  dataProcessor(EllipseData)
8283
- ], exports.Ellipse.prototype, "__", void 0);
8294
+ ], exports.Ellipse.prototype, "__", undefined);
8284
8295
  __decorate([
8285
8296
  pathType(0)
8286
- ], exports.Ellipse.prototype, "innerRadius", void 0);
8297
+ ], exports.Ellipse.prototype, "innerRadius", undefined);
8287
8298
  __decorate([
8288
8299
  pathType(0)
8289
- ], exports.Ellipse.prototype, "startAngle", void 0);
8300
+ ], exports.Ellipse.prototype, "startAngle", undefined);
8290
8301
  __decorate([
8291
8302
  pathType(0)
8292
- ], exports.Ellipse.prototype, "endAngle", void 0);
8303
+ ], exports.Ellipse.prototype, "endAngle", undefined);
8293
8304
  exports.Ellipse = __decorate([
8294
8305
  registerUI()
8295
8306
  ], exports.Ellipse);
@@ -8348,22 +8359,22 @@ var LeaferUI = (function (exports) {
8348
8359
  };
8349
8360
  __decorate([
8350
8361
  dataProcessor(LineData)
8351
- ], exports.Line.prototype, "__", void 0);
8362
+ ], exports.Line.prototype, "__", undefined);
8352
8363
  __decorate([
8353
8364
  affectStrokeBoundsType('center')
8354
- ], exports.Line.prototype, "strokeAlign", void 0);
8365
+ ], exports.Line.prototype, "strokeAlign", undefined);
8355
8366
  __decorate([
8356
8367
  boundsType(0)
8357
- ], exports.Line.prototype, "height", void 0);
8368
+ ], exports.Line.prototype, "height", undefined);
8358
8369
  __decorate([
8359
8370
  pathType()
8360
- ], exports.Line.prototype, "points", void 0);
8371
+ ], exports.Line.prototype, "points", undefined);
8361
8372
  __decorate([
8362
8373
  pathType(0)
8363
- ], exports.Line.prototype, "curve", void 0);
8374
+ ], exports.Line.prototype, "curve", undefined);
8364
8375
  __decorate([
8365
8376
  pathType(false)
8366
- ], exports.Line.prototype, "closed", void 0);
8377
+ ], exports.Line.prototype, "closed", undefined);
8367
8378
  exports.Line = __decorate([
8368
8379
  registerUI()
8369
8380
  ], exports.Line);
@@ -8396,16 +8407,16 @@ var LeaferUI = (function (exports) {
8396
8407
  };
8397
8408
  __decorate([
8398
8409
  dataProcessor(PolygonData)
8399
- ], exports.Polygon.prototype, "__", void 0);
8410
+ ], exports.Polygon.prototype, "__", undefined);
8400
8411
  __decorate([
8401
8412
  pathType(3)
8402
- ], exports.Polygon.prototype, "sides", void 0);
8413
+ ], exports.Polygon.prototype, "sides", undefined);
8403
8414
  __decorate([
8404
8415
  pathType()
8405
- ], exports.Polygon.prototype, "points", void 0);
8416
+ ], exports.Polygon.prototype, "points", undefined);
8406
8417
  __decorate([
8407
8418
  pathType(0)
8408
- ], exports.Polygon.prototype, "curve", void 0);
8419
+ ], exports.Polygon.prototype, "curve", undefined);
8409
8420
  __decorate([
8410
8421
  rewrite(line.__updateRenderPath)
8411
8422
  ], exports.Polygon.prototype, "__updateRenderPath", null);
@@ -8437,13 +8448,13 @@ var LeaferUI = (function (exports) {
8437
8448
  };
8438
8449
  __decorate([
8439
8450
  dataProcessor(StarData)
8440
- ], exports.Star.prototype, "__", void 0);
8451
+ ], exports.Star.prototype, "__", undefined);
8441
8452
  __decorate([
8442
8453
  pathType(5)
8443
- ], exports.Star.prototype, "corners", void 0);
8454
+ ], exports.Star.prototype, "corners", undefined);
8444
8455
  __decorate([
8445
8456
  pathType(0.382)
8446
- ], exports.Star.prototype, "innerRadius", void 0);
8457
+ ], exports.Star.prototype, "innerRadius", undefined);
8447
8458
  exports.Star = __decorate([
8448
8459
  registerUI()
8449
8460
  ], exports.Star);
@@ -8465,10 +8476,10 @@ var LeaferUI = (function (exports) {
8465
8476
  };
8466
8477
  __decorate([
8467
8478
  dataProcessor(ImageData)
8468
- ], exports.Image.prototype, "__", void 0);
8479
+ ], exports.Image.prototype, "__", undefined);
8469
8480
  __decorate([
8470
8481
  boundsType('')
8471
- ], exports.Image.prototype, "url", void 0);
8482
+ ], exports.Image.prototype, "url", undefined);
8472
8483
  exports.Image = __decorate([
8473
8484
  registerUI()
8474
8485
  ], exports.Image);
@@ -8531,25 +8542,25 @@ var LeaferUI = (function (exports) {
8531
8542
  };
8532
8543
  __decorate([
8533
8544
  dataProcessor(CanvasData)
8534
- ], exports.Canvas.prototype, "__", void 0);
8545
+ ], exports.Canvas.prototype, "__", undefined);
8535
8546
  __decorate([
8536
8547
  resizeType(100)
8537
- ], exports.Canvas.prototype, "width", void 0);
8548
+ ], exports.Canvas.prototype, "width", undefined);
8538
8549
  __decorate([
8539
8550
  resizeType(100)
8540
- ], exports.Canvas.prototype, "height", void 0);
8551
+ ], exports.Canvas.prototype, "height", undefined);
8541
8552
  __decorate([
8542
8553
  resizeType(1)
8543
- ], exports.Canvas.prototype, "pixelRatio", void 0);
8554
+ ], exports.Canvas.prototype, "pixelRatio", undefined);
8544
8555
  __decorate([
8545
8556
  resizeType(true)
8546
- ], exports.Canvas.prototype, "smooth", void 0);
8557
+ ], exports.Canvas.prototype, "smooth", undefined);
8547
8558
  __decorate([
8548
8559
  dataType(false)
8549
- ], exports.Canvas.prototype, "safeResize", void 0);
8560
+ ], exports.Canvas.prototype, "safeResize", undefined);
8550
8561
  __decorate([
8551
8562
  resizeType()
8552
- ], exports.Canvas.prototype, "contextSettings", void 0);
8563
+ ], exports.Canvas.prototype, "contextSettings", undefined);
8553
8564
  exports.Canvas = __decorate([
8554
8565
  registerUI()
8555
8566
  ], exports.Canvas);
@@ -8640,76 +8651,76 @@ var LeaferUI = (function (exports) {
8640
8651
  };
8641
8652
  __decorate([
8642
8653
  dataProcessor(TextData)
8643
- ], exports.Text.prototype, "__", void 0);
8654
+ ], exports.Text.prototype, "__", undefined);
8644
8655
  __decorate([
8645
8656
  boundsType(0)
8646
- ], exports.Text.prototype, "width", void 0);
8657
+ ], exports.Text.prototype, "width", undefined);
8647
8658
  __decorate([
8648
8659
  boundsType(0)
8649
- ], exports.Text.prototype, "height", void 0);
8660
+ ], exports.Text.prototype, "height", undefined);
8650
8661
  __decorate([
8651
8662
  dataType(false)
8652
- ], exports.Text.prototype, "resizeFontSize", void 0);
8663
+ ], exports.Text.prototype, "resizeFontSize", undefined);
8653
8664
  __decorate([
8654
8665
  surfaceType('#000000')
8655
- ], exports.Text.prototype, "fill", void 0);
8666
+ ], exports.Text.prototype, "fill", undefined);
8656
8667
  __decorate([
8657
8668
  affectStrokeBoundsType('outside')
8658
- ], exports.Text.prototype, "strokeAlign", void 0);
8669
+ ], exports.Text.prototype, "strokeAlign", undefined);
8659
8670
  __decorate([
8660
8671
  hitType('all')
8661
- ], exports.Text.prototype, "hitFill", void 0);
8672
+ ], exports.Text.prototype, "hitFill", undefined);
8662
8673
  __decorate([
8663
8674
  boundsType('')
8664
- ], exports.Text.prototype, "text", void 0);
8675
+ ], exports.Text.prototype, "text", undefined);
8665
8676
  __decorate([
8666
- boundsType('L')
8667
- ], exports.Text.prototype, "fontFamily", void 0);
8677
+ boundsType('caption')
8678
+ ], exports.Text.prototype, "fontFamily", undefined);
8668
8679
  __decorate([
8669
8680
  boundsType(12)
8670
- ], exports.Text.prototype, "fontSize", void 0);
8681
+ ], exports.Text.prototype, "fontSize", undefined);
8671
8682
  __decorate([
8672
8683
  boundsType('normal')
8673
- ], exports.Text.prototype, "fontWeight", void 0);
8684
+ ], exports.Text.prototype, "fontWeight", undefined);
8674
8685
  __decorate([
8675
8686
  boundsType(false)
8676
- ], exports.Text.prototype, "italic", void 0);
8687
+ ], exports.Text.prototype, "italic", undefined);
8677
8688
  __decorate([
8678
8689
  boundsType('none')
8679
- ], exports.Text.prototype, "textCase", void 0);
8690
+ ], exports.Text.prototype, "textCase", undefined);
8680
8691
  __decorate([
8681
8692
  boundsType('none')
8682
- ], exports.Text.prototype, "textDecoration", void 0);
8693
+ ], exports.Text.prototype, "textDecoration", undefined);
8683
8694
  __decorate([
8684
8695
  boundsType(0)
8685
- ], exports.Text.prototype, "letterSpacing", void 0);
8696
+ ], exports.Text.prototype, "letterSpacing", undefined);
8686
8697
  __decorate([
8687
8698
  boundsType({ type: 'percent', value: 1.5 })
8688
- ], exports.Text.prototype, "lineHeight", void 0);
8699
+ ], exports.Text.prototype, "lineHeight", undefined);
8689
8700
  __decorate([
8690
8701
  boundsType(0)
8691
- ], exports.Text.prototype, "paraIndent", void 0);
8702
+ ], exports.Text.prototype, "paraIndent", undefined);
8692
8703
  __decorate([
8693
8704
  boundsType(0)
8694
- ], exports.Text.prototype, "paraSpacing", void 0);
8705
+ ], exports.Text.prototype, "paraSpacing", undefined);
8695
8706
  __decorate([
8696
8707
  boundsType('x')
8697
- ], exports.Text.prototype, "writingMode", void 0);
8708
+ ], exports.Text.prototype, "writingMode", undefined);
8698
8709
  __decorate([
8699
8710
  boundsType('left')
8700
- ], exports.Text.prototype, "textAlign", void 0);
8711
+ ], exports.Text.prototype, "textAlign", undefined);
8701
8712
  __decorate([
8702
8713
  boundsType('top')
8703
- ], exports.Text.prototype, "verticalAlign", void 0);
8714
+ ], exports.Text.prototype, "verticalAlign", undefined);
8704
8715
  __decorate([
8705
8716
  boundsType(true)
8706
- ], exports.Text.prototype, "autoSizeAlign", void 0);
8717
+ ], exports.Text.prototype, "autoSizeAlign", undefined);
8707
8718
  __decorate([
8708
8719
  boundsType('normal')
8709
- ], exports.Text.prototype, "textWrap", void 0);
8720
+ ], exports.Text.prototype, "textWrap", undefined);
8710
8721
  __decorate([
8711
8722
  boundsType('show')
8712
- ], exports.Text.prototype, "textOverflow", void 0);
8723
+ ], exports.Text.prototype, "textOverflow", undefined);
8713
8724
  exports.Text = __decorate([
8714
8725
  registerUI()
8715
8726
  ], exports.Text);
@@ -8722,10 +8733,10 @@ var LeaferUI = (function (exports) {
8722
8733
  };
8723
8734
  __decorate([
8724
8735
  dataProcessor(PathData)
8725
- ], exports.Path.prototype, "__", void 0);
8736
+ ], exports.Path.prototype, "__", undefined);
8726
8737
  __decorate([
8727
8738
  affectStrokeBoundsType('center')
8728
- ], exports.Path.prototype, "strokeAlign", void 0);
8739
+ ], exports.Path.prototype, "strokeAlign", undefined);
8729
8740
  exports.Path = __decorate([
8730
8741
  registerUI()
8731
8742
  ], exports.Path);
@@ -8764,10 +8775,10 @@ var LeaferUI = (function (exports) {
8764
8775
  };
8765
8776
  __decorate([
8766
8777
  dataProcessor(PenData)
8767
- ], exports.Pen.prototype, "__", void 0);
8778
+ ], exports.Pen.prototype, "__", undefined);
8768
8779
  __decorate([
8769
8780
  penPathType()
8770
- ], exports.Pen.prototype, "path", void 0);
8781
+ ], exports.Pen.prototype, "path", undefined);
8771
8782
  exports.Pen = __decorate([
8772
8783
  useModule(PathCreator, ['set', 'path', 'paint']),
8773
8784
  registerUI()
@@ -9401,7 +9412,7 @@ var LeaferUI = (function (exports) {
9401
9412
  }
9402
9413
  else {
9403
9414
  if (!paint.patternTask) {
9404
- paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
9415
+ paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, undefined, undefined, function* () {
9405
9416
  paint.patternTask = null;
9406
9417
  if (canvas.bounds.hit(ui.__nowWorld))
9407
9418
  createPattern(ui, paint, pixelRatio);
@@ -9557,7 +9568,7 @@ var LeaferUI = (function (exports) {
9557
9568
  const end = shadow.length - 1;
9558
9569
  toOffsetOutBounds$1(bounds, offsetOutBounds$1);
9559
9570
  shadow.forEach((item, index) => {
9560
- other.setWorldShadow((offsetOutBounds$1.offsetX + item.x * scaleX), (offsetOutBounds$1.offsetY + item.y * scaleY), item.blur * scaleX, item.color);
9571
+ other.setWorldShadow((offsetOutBounds$1.offsetX + item.x * scaleX), (offsetOutBounds$1.offsetY + item.y * scaleY), item.blur * scaleX, ColorConvert.string(item.color));
9561
9572
  spreadScale = item.spread ? 1 + item.spread * 2 / (__layout.boxBounds.width + (__layout.strokeBoxSpread || 0) * 2) : 0;
9562
9573
  drawWorldShadow(other, offsetOutBounds$1, spreadScale, shape);
9563
9574
  copyBounds = bounds;
@@ -9633,7 +9644,7 @@ var LeaferUI = (function (exports) {
9633
9644
  other.copyWorld(shape.canvas, shapeBounds, bounds, 'source-out');
9634
9645
  copyBounds = bounds;
9635
9646
  }
9636
- other.fillWorld(copyBounds, item.color, 'source-in');
9647
+ other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
9637
9648
  if (ui.__worldFlipped) {
9638
9649
  current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
9639
9650
  }
@@ -9991,11 +10002,11 @@ var LeaferUI = (function (exports) {
9991
10002
  function layoutChar(drawData, style, width, _height) {
9992
10003
  const { rows } = drawData;
9993
10004
  const { textAlign, paraIndent, letterSpacing } = style;
9994
- let charX, addWordWidth, indentWidth, mode, wordChar;
10005
+ let charX, addWordWidth, indentWidth, mode, wordChar, wordsLength;
9995
10006
  rows.forEach(row => {
9996
10007
  if (row.words) {
9997
- indentWidth = paraIndent && row.paraStart ? paraIndent : 0;
9998
- addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
10008
+ indentWidth = paraIndent && row.paraStart ? paraIndent : 0, wordsLength = row.words.length;
10009
+ addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && wordsLength > 1) ? (width - row.width - indentWidth) / (wordsLength - 1) : 0;
9999
10010
  mode = (letterSpacing || row.isOverflow) ? CharMode : (addWordWidth > 0.01 ? WordMode : TextMode);
10000
10011
  if (row.isOverflow && !letterSpacing)
10001
10012
  row.textMode = true;
@@ -10007,7 +10018,7 @@ var LeaferUI = (function (exports) {
10007
10018
  row.x += indentWidth;
10008
10019
  charX = row.x;
10009
10020
  row.data = [];
10010
- row.words.forEach(word => {
10021
+ row.words.forEach((word, index) => {
10011
10022
  if (mode === WordMode) {
10012
10023
  wordChar = { char: '', x: charX };
10013
10024
  charX = toWordChar(word.data, charX, wordChar);
@@ -10017,7 +10028,7 @@ var LeaferUI = (function (exports) {
10017
10028
  else {
10018
10029
  charX = toChar(word.data, charX, row.data, row.isOverflow);
10019
10030
  }
10020
- if (addWordWidth && (!row.paraEnd || textAlign === 'both')) {
10031
+ if (addWordWidth && (!row.paraEnd || textAlign === 'both') && (index !== wordsLength - 1)) {
10021
10032
  charX += addWordWidth;
10022
10033
  row.width += addWordWidth;
10023
10034
  }
@@ -10426,3 +10437,4 @@ var LeaferUI = (function (exports) {
10426
10437
  return exports;
10427
10438
 
10428
10439
  })({});
10440
+ //# sourceMappingURL=web.js.map