leafer-ui 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$7(matrix$1, 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$7(matrix$1, o);
4215
4221
  scaleOfOuter$2(matrix$1, origin, scaleX, scaleY);
4216
4222
  if (t.origin || t.around) {
4217
- L.setTransform(t, matrix$1, resize);
4223
+ L.setTransform(t, matrix$1, resize, transition);
4218
4224
  }
4219
4225
  else {
4220
- moveByMatrix(t, matrix$1);
4221
- t.scaleResize(scaleX, scaleY, resize !== true);
4226
+ const x = t.x + matrix$1.e - o.e, y = t.y + matrix$1.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$7(matrix$1, t.__localMatrix);
4236
+ rotateOfLocal(t, origin, angle, transition) {
4237
+ const o = t.__localMatrix;
4238
+ copy$7(matrix$1, o);
4229
4239
  rotateOfOuter$2(matrix$1, origin, angle);
4230
- if (t.origin || t.around) {
4231
- L.setTransform(t, matrix$1);
4232
- }
4233
- else {
4234
- moveByMatrix(t, matrix$1);
4235
- t.rotation = MathHelper.formatRotation(t.rotation + angle);
4236
- }
4240
+ if (t.origin || t.around)
4241
+ L.setTransform(t, matrix$1, false, transition);
4242
+ else
4243
+ t.set({ x: t.x + matrix$1.e - o.e, y: t.y + matrix$1.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$7(matrix$1, t.__localMatrix);
4243
4250
  skewOfOuter(matrix$1, origin, skewX, skewY);
4244
- L.setTransform(t, matrix$1, resize);
4251
+ L.setTransform(t, matrix$1, resize, transition);
4245
4252
  },
4246
- transformWorld(t, transform, resize) {
4253
+ transformWorld(t, transform, resize, transition) {
4247
4254
  copy$7(matrix$1, t.worldTransform);
4248
4255
  multiplyParent$2(matrix$1, transform);
4249
4256
  if (t.parent)
4250
4257
  divideParent(matrix$1, t.parent.worldTransform);
4251
- L.setTransform(t, matrix$1, resize);
4258
+ L.setTransform(t, matrix$1, resize, transition);
4252
4259
  },
4253
- transform(t, transform, resize) {
4260
+ transform(t, transform, resize, transition) {
4254
4261
  copy$7(matrix$1, t.localTransform);
4255
4262
  multiplyParent$2(matrix$1, transform);
4256
- L.setTransform(t, matrix$1, resize);
4263
+ L.setTransform(t, matrix$1, 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$5 = 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;
@@ -7099,6 +7109,7 @@ class UIData extends LeafData {
7099
7109
  return t.fill && this.__hasStroke;
7100
7110
  }
7101
7111
  get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
7112
+ get __hasSurface() { const t = this; return (t.fill || t.stroke); }
7102
7113
  get __autoWidth() { return !this._width; }
7103
7114
  get __autoHeight() { return !this._height; }
7104
7115
  get __autoSide() { return !this._width || !this._height; }
@@ -7602,199 +7613,199 @@ let UI = UI_1 = class UI extends Leaf {
7602
7613
  };
7603
7614
  __decorate([
7604
7615
  dataProcessor(UIData)
7605
- ], UI.prototype, "__", void 0);
7616
+ ], UI.prototype, "__", undefined);
7606
7617
  __decorate([
7607
7618
  zoomLayerType()
7608
- ], UI.prototype, "zoomLayer", void 0);
7619
+ ], UI.prototype, "zoomLayer", undefined);
7609
7620
  __decorate([
7610
7621
  dataType('')
7611
- ], UI.prototype, "id", void 0);
7622
+ ], UI.prototype, "id", undefined);
7612
7623
  __decorate([
7613
7624
  dataType('')
7614
- ], UI.prototype, "name", void 0);
7625
+ ], UI.prototype, "name", undefined);
7615
7626
  __decorate([
7616
7627
  dataType('')
7617
- ], UI.prototype, "className", void 0);
7628
+ ], UI.prototype, "className", undefined);
7618
7629
  __decorate([
7619
7630
  surfaceType('pass-through')
7620
- ], UI.prototype, "blendMode", void 0);
7631
+ ], UI.prototype, "blendMode", undefined);
7621
7632
  __decorate([
7622
7633
  opacityType(1)
7623
- ], UI.prototype, "opacity", void 0);
7634
+ ], UI.prototype, "opacity", undefined);
7624
7635
  __decorate([
7625
7636
  visibleType(true)
7626
- ], UI.prototype, "visible", void 0);
7637
+ ], UI.prototype, "visible", undefined);
7627
7638
  __decorate([
7628
7639
  surfaceType(false)
7629
- ], UI.prototype, "locked", void 0);
7640
+ ], UI.prototype, "locked", undefined);
7630
7641
  __decorate([
7631
7642
  sortType(0)
7632
- ], UI.prototype, "zIndex", void 0);
7643
+ ], UI.prototype, "zIndex", undefined);
7633
7644
  __decorate([
7634
7645
  maskType(false)
7635
- ], UI.prototype, "mask", void 0);
7646
+ ], UI.prototype, "mask", undefined);
7636
7647
  __decorate([
7637
7648
  eraserType(false)
7638
- ], UI.prototype, "eraser", void 0);
7649
+ ], UI.prototype, "eraser", undefined);
7639
7650
  __decorate([
7640
7651
  positionType(0, true)
7641
- ], UI.prototype, "x", void 0);
7652
+ ], UI.prototype, "x", undefined);
7642
7653
  __decorate([
7643
7654
  positionType(0, true)
7644
- ], UI.prototype, "y", void 0);
7655
+ ], UI.prototype, "y", undefined);
7645
7656
  __decorate([
7646
7657
  boundsType(100, true)
7647
- ], UI.prototype, "width", void 0);
7658
+ ], UI.prototype, "width", undefined);
7648
7659
  __decorate([
7649
7660
  boundsType(100, true)
7650
- ], UI.prototype, "height", void 0);
7661
+ ], UI.prototype, "height", undefined);
7651
7662
  __decorate([
7652
7663
  scaleType(1, true)
7653
- ], UI.prototype, "scaleX", void 0);
7664
+ ], UI.prototype, "scaleX", undefined);
7654
7665
  __decorate([
7655
7666
  scaleType(1, true)
7656
- ], UI.prototype, "scaleY", void 0);
7667
+ ], UI.prototype, "scaleY", undefined);
7657
7668
  __decorate([
7658
7669
  rotationType(0, true)
7659
- ], UI.prototype, "rotation", void 0);
7670
+ ], UI.prototype, "rotation", undefined);
7660
7671
  __decorate([
7661
7672
  rotationType(0, true)
7662
- ], UI.prototype, "skewX", void 0);
7673
+ ], UI.prototype, "skewX", undefined);
7663
7674
  __decorate([
7664
7675
  rotationType(0, true)
7665
- ], UI.prototype, "skewY", void 0);
7676
+ ], UI.prototype, "skewY", undefined);
7666
7677
  __decorate([
7667
7678
  positionType(0, true)
7668
- ], UI.prototype, "offsetX", void 0);
7679
+ ], UI.prototype, "offsetX", undefined);
7669
7680
  __decorate([
7670
7681
  positionType(0, true)
7671
- ], UI.prototype, "offsetY", void 0);
7682
+ ], UI.prototype, "offsetY", undefined);
7672
7683
  __decorate([
7673
7684
  positionType(0, true)
7674
- ], UI.prototype, "scrollX", void 0);
7685
+ ], UI.prototype, "scrollX", undefined);
7675
7686
  __decorate([
7676
7687
  positionType(0, true)
7677
- ], UI.prototype, "scrollY", void 0);
7688
+ ], UI.prototype, "scrollY", undefined);
7678
7689
  __decorate([
7679
7690
  autoLayoutType()
7680
- ], UI.prototype, "origin", void 0);
7691
+ ], UI.prototype, "origin", undefined);
7681
7692
  __decorate([
7682
7693
  autoLayoutType()
7683
- ], UI.prototype, "around", void 0);
7694
+ ], UI.prototype, "around", undefined);
7684
7695
  __decorate([
7685
7696
  dataType(false)
7686
- ], UI.prototype, "lazy", void 0);
7697
+ ], UI.prototype, "lazy", undefined);
7687
7698
  __decorate([
7688
7699
  naturalBoundsType(1)
7689
- ], UI.prototype, "pixelRatio", void 0);
7700
+ ], UI.prototype, "pixelRatio", undefined);
7690
7701
  __decorate([
7691
7702
  pathInputType()
7692
- ], UI.prototype, "path", void 0);
7703
+ ], UI.prototype, "path", undefined);
7693
7704
  __decorate([
7694
7705
  pathType()
7695
- ], UI.prototype, "windingRule", void 0);
7706
+ ], UI.prototype, "windingRule", undefined);
7696
7707
  __decorate([
7697
7708
  pathType(true)
7698
- ], UI.prototype, "closed", void 0);
7709
+ ], UI.prototype, "closed", undefined);
7699
7710
  __decorate([
7700
7711
  boundsType(0)
7701
- ], UI.prototype, "padding", void 0);
7712
+ ], UI.prototype, "padding", undefined);
7702
7713
  __decorate([
7703
7714
  boundsType(false)
7704
- ], UI.prototype, "lockRatio", void 0);
7715
+ ], UI.prototype, "lockRatio", undefined);
7705
7716
  __decorate([
7706
7717
  boundsType()
7707
- ], UI.prototype, "widthRange", void 0);
7718
+ ], UI.prototype, "widthRange", undefined);
7708
7719
  __decorate([
7709
7720
  boundsType()
7710
- ], UI.prototype, "heightRange", void 0);
7721
+ ], UI.prototype, "heightRange", undefined);
7711
7722
  __decorate([
7712
7723
  dataType(false)
7713
- ], UI.prototype, "draggable", void 0);
7724
+ ], UI.prototype, "draggable", undefined);
7714
7725
  __decorate([
7715
7726
  dataType()
7716
- ], UI.prototype, "dragBounds", void 0);
7727
+ ], UI.prototype, "dragBounds", undefined);
7717
7728
  __decorate([
7718
7729
  dataType(false)
7719
- ], UI.prototype, "editable", void 0);
7730
+ ], UI.prototype, "editable", undefined);
7720
7731
  __decorate([
7721
7732
  hitType(true)
7722
- ], UI.prototype, "hittable", void 0);
7733
+ ], UI.prototype, "hittable", undefined);
7723
7734
  __decorate([
7724
7735
  hitType('path')
7725
- ], UI.prototype, "hitFill", void 0);
7736
+ ], UI.prototype, "hitFill", undefined);
7726
7737
  __decorate([
7727
7738
  strokeType('path')
7728
- ], UI.prototype, "hitStroke", void 0);
7739
+ ], UI.prototype, "hitStroke", undefined);
7729
7740
  __decorate([
7730
7741
  hitType(false)
7731
- ], UI.prototype, "hitBox", void 0);
7742
+ ], UI.prototype, "hitBox", undefined);
7732
7743
  __decorate([
7733
7744
  hitType(true)
7734
- ], UI.prototype, "hitChildren", void 0);
7745
+ ], UI.prototype, "hitChildren", undefined);
7735
7746
  __decorate([
7736
7747
  hitType(true)
7737
- ], UI.prototype, "hitSelf", void 0);
7748
+ ], UI.prototype, "hitSelf", undefined);
7738
7749
  __decorate([
7739
7750
  hitType()
7740
- ], UI.prototype, "hitRadius", void 0);
7751
+ ], UI.prototype, "hitRadius", undefined);
7741
7752
  __decorate([
7742
7753
  cursorType('')
7743
- ], UI.prototype, "cursor", void 0);
7754
+ ], UI.prototype, "cursor", undefined);
7744
7755
  __decorate([
7745
7756
  surfaceType()
7746
- ], UI.prototype, "fill", void 0);
7757
+ ], UI.prototype, "fill", undefined);
7747
7758
  __decorate([
7748
7759
  strokeType()
7749
- ], UI.prototype, "stroke", void 0);
7760
+ ], UI.prototype, "stroke", undefined);
7750
7761
  __decorate([
7751
7762
  strokeType('inside')
7752
- ], UI.prototype, "strokeAlign", void 0);
7763
+ ], UI.prototype, "strokeAlign", undefined);
7753
7764
  __decorate([
7754
7765
  strokeType(1)
7755
- ], UI.prototype, "strokeWidth", void 0);
7766
+ ], UI.prototype, "strokeWidth", undefined);
7756
7767
  __decorate([
7757
7768
  strokeType(false)
7758
- ], UI.prototype, "strokeWidthFixed", void 0);
7769
+ ], UI.prototype, "strokeWidthFixed", undefined);
7759
7770
  __decorate([
7760
7771
  strokeType('none')
7761
- ], UI.prototype, "strokeCap", void 0);
7772
+ ], UI.prototype, "strokeCap", undefined);
7762
7773
  __decorate([
7763
7774
  strokeType('miter')
7764
- ], UI.prototype, "strokeJoin", void 0);
7775
+ ], UI.prototype, "strokeJoin", undefined);
7765
7776
  __decorate([
7766
7777
  strokeType()
7767
- ], UI.prototype, "dashPattern", void 0);
7778
+ ], UI.prototype, "dashPattern", undefined);
7768
7779
  __decorate([
7769
7780
  strokeType()
7770
- ], UI.prototype, "dashOffset", void 0);
7781
+ ], UI.prototype, "dashOffset", undefined);
7771
7782
  __decorate([
7772
7783
  strokeType(10)
7773
- ], UI.prototype, "miterLimit", void 0);
7784
+ ], UI.prototype, "miterLimit", undefined);
7774
7785
  __decorate([
7775
7786
  pathType(0)
7776
- ], UI.prototype, "cornerRadius", void 0);
7787
+ ], UI.prototype, "cornerRadius", undefined);
7777
7788
  __decorate([
7778
7789
  pathType()
7779
- ], UI.prototype, "cornerSmoothing", void 0);
7790
+ ], UI.prototype, "cornerSmoothing", undefined);
7780
7791
  __decorate([
7781
7792
  effectType()
7782
- ], UI.prototype, "shadow", void 0);
7793
+ ], UI.prototype, "shadow", undefined);
7783
7794
  __decorate([
7784
7795
  effectType()
7785
- ], UI.prototype, "innerShadow", void 0);
7796
+ ], UI.prototype, "innerShadow", undefined);
7786
7797
  __decorate([
7787
7798
  effectType()
7788
- ], UI.prototype, "blur", void 0);
7799
+ ], UI.prototype, "blur", undefined);
7789
7800
  __decorate([
7790
7801
  effectType()
7791
- ], UI.prototype, "backgroundBlur", void 0);
7802
+ ], UI.prototype, "backgroundBlur", undefined);
7792
7803
  __decorate([
7793
7804
  effectType()
7794
- ], UI.prototype, "grayscale", void 0);
7805
+ ], UI.prototype, "grayscale", undefined);
7795
7806
  __decorate([
7796
7807
  dataType({})
7797
- ], UI.prototype, "data", void 0);
7808
+ ], UI.prototype, "data", undefined);
7798
7809
  __decorate([
7799
7810
  rewrite(Leaf.prototype.reset)
7800
7811
  ], UI.prototype, "reset", null);
@@ -7855,7 +7866,7 @@ let Group = class Group extends UI {
7855
7866
  };
7856
7867
  __decorate([
7857
7868
  dataProcessor(GroupData)
7858
- ], Group.prototype, "__", void 0);
7869
+ ], Group.prototype, "__", undefined);
7859
7870
  Group = __decorate([
7860
7871
  useModule(Branch),
7861
7872
  registerUI()
@@ -8026,8 +8037,6 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8026
8037
  __setAttr(attrName, newValue) {
8027
8038
  if (this.canvas) {
8028
8039
  if (canvasSizeAttrs.includes(attrName)) {
8029
- if (!newValue)
8030
- debug$1.warn(attrName + ' is 0');
8031
8040
  this.__changeCanvasSize(attrName, newValue);
8032
8041
  }
8033
8042
  else if (attrName === 'fill') {
@@ -8230,10 +8239,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8230
8239
  Leafer.list = new LeafList();
8231
8240
  __decorate([
8232
8241
  dataProcessor(LeaferData)
8233
- ], Leafer.prototype, "__", void 0);
8242
+ ], Leafer.prototype, "__", undefined);
8234
8243
  __decorate([
8235
8244
  boundsType()
8236
- ], Leafer.prototype, "pixelRatio", void 0);
8245
+ ], Leafer.prototype, "pixelRatio", undefined);
8237
8246
  Leafer = Leafer_1 = __decorate([
8238
8247
  registerUI()
8239
8248
  ], Leafer);
@@ -8246,7 +8255,7 @@ let Rect = class Rect extends UI {
8246
8255
  };
8247
8256
  __decorate([
8248
8257
  dataProcessor(RectData)
8249
- ], Rect.prototype, "__", void 0);
8258
+ ], Rect.prototype, "__", undefined);
8250
8259
  Rect = __decorate([
8251
8260
  useModule(RectRender),
8252
8261
  rewriteAble(),
@@ -8271,6 +8280,8 @@ let Box = class Box extends Group {
8271
8280
  const data = this.__;
8272
8281
  if (this.children.length) {
8273
8282
  if (data.__autoSide) {
8283
+ if (data.__hasSurface)
8284
+ this.__extraUpdate();
8274
8285
  super.__updateBoxBounds();
8275
8286
  const { boxBounds } = this.__layout;
8276
8287
  if (!data.__autoSize) {
@@ -8335,13 +8346,13 @@ let Box = class Box extends Group {
8335
8346
  };
8336
8347
  __decorate([
8337
8348
  dataProcessor(BoxData)
8338
- ], Box.prototype, "__", void 0);
8349
+ ], Box.prototype, "__", undefined);
8339
8350
  __decorate([
8340
8351
  dataType(false)
8341
- ], Box.prototype, "resizeChildren", void 0);
8352
+ ], Box.prototype, "resizeChildren", undefined);
8342
8353
  __decorate([
8343
8354
  affectRenderBoundsType('show')
8344
- ], Box.prototype, "overflow", void 0);
8355
+ ], Box.prototype, "overflow", undefined);
8345
8356
  __decorate([
8346
8357
  rewrite(rect$1.__updateStrokeSpread)
8347
8358
  ], Box.prototype, "__updateStrokeSpread", null);
@@ -8380,13 +8391,13 @@ let Frame = class Frame extends Box {
8380
8391
  };
8381
8392
  __decorate([
8382
8393
  dataProcessor(FrameData)
8383
- ], Frame.prototype, "__", void 0);
8394
+ ], Frame.prototype, "__", undefined);
8384
8395
  __decorate([
8385
8396
  surfaceType('#FFFFFF')
8386
- ], Frame.prototype, "fill", void 0);
8397
+ ], Frame.prototype, "fill", undefined);
8387
8398
  __decorate([
8388
8399
  affectRenderBoundsType('hide')
8389
- ], Frame.prototype, "overflow", void 0);
8400
+ ], Frame.prototype, "overflow", undefined);
8390
8401
  Frame = __decorate([
8391
8402
  registerUI()
8392
8403
  ], Frame);
@@ -8433,16 +8444,16 @@ let Ellipse = class Ellipse extends UI {
8433
8444
  };
8434
8445
  __decorate([
8435
8446
  dataProcessor(EllipseData)
8436
- ], Ellipse.prototype, "__", void 0);
8447
+ ], Ellipse.prototype, "__", undefined);
8437
8448
  __decorate([
8438
8449
  pathType(0)
8439
- ], Ellipse.prototype, "innerRadius", void 0);
8450
+ ], Ellipse.prototype, "innerRadius", undefined);
8440
8451
  __decorate([
8441
8452
  pathType(0)
8442
- ], Ellipse.prototype, "startAngle", void 0);
8453
+ ], Ellipse.prototype, "startAngle", undefined);
8443
8454
  __decorate([
8444
8455
  pathType(0)
8445
- ], Ellipse.prototype, "endAngle", void 0);
8456
+ ], Ellipse.prototype, "endAngle", undefined);
8446
8457
  Ellipse = __decorate([
8447
8458
  registerUI()
8448
8459
  ], Ellipse);
@@ -8501,22 +8512,22 @@ let Line = class Line extends UI {
8501
8512
  };
8502
8513
  __decorate([
8503
8514
  dataProcessor(LineData)
8504
- ], Line.prototype, "__", void 0);
8515
+ ], Line.prototype, "__", undefined);
8505
8516
  __decorate([
8506
8517
  affectStrokeBoundsType('center')
8507
- ], Line.prototype, "strokeAlign", void 0);
8518
+ ], Line.prototype, "strokeAlign", undefined);
8508
8519
  __decorate([
8509
8520
  boundsType(0)
8510
- ], Line.prototype, "height", void 0);
8521
+ ], Line.prototype, "height", undefined);
8511
8522
  __decorate([
8512
8523
  pathType()
8513
- ], Line.prototype, "points", void 0);
8524
+ ], Line.prototype, "points", undefined);
8514
8525
  __decorate([
8515
8526
  pathType(0)
8516
- ], Line.prototype, "curve", void 0);
8527
+ ], Line.prototype, "curve", undefined);
8517
8528
  __decorate([
8518
8529
  pathType(false)
8519
- ], Line.prototype, "closed", void 0);
8530
+ ], Line.prototype, "closed", undefined);
8520
8531
  Line = __decorate([
8521
8532
  registerUI()
8522
8533
  ], Line);
@@ -8549,16 +8560,16 @@ let Polygon = class Polygon extends UI {
8549
8560
  };
8550
8561
  __decorate([
8551
8562
  dataProcessor(PolygonData)
8552
- ], Polygon.prototype, "__", void 0);
8563
+ ], Polygon.prototype, "__", undefined);
8553
8564
  __decorate([
8554
8565
  pathType(3)
8555
- ], Polygon.prototype, "sides", void 0);
8566
+ ], Polygon.prototype, "sides", undefined);
8556
8567
  __decorate([
8557
8568
  pathType()
8558
- ], Polygon.prototype, "points", void 0);
8569
+ ], Polygon.prototype, "points", undefined);
8559
8570
  __decorate([
8560
8571
  pathType(0)
8561
- ], Polygon.prototype, "curve", void 0);
8572
+ ], Polygon.prototype, "curve", undefined);
8562
8573
  __decorate([
8563
8574
  rewrite(line.__updateRenderPath)
8564
8575
  ], Polygon.prototype, "__updateRenderPath", null);
@@ -8590,13 +8601,13 @@ let Star = class Star extends UI {
8590
8601
  };
8591
8602
  __decorate([
8592
8603
  dataProcessor(StarData)
8593
- ], Star.prototype, "__", void 0);
8604
+ ], Star.prototype, "__", undefined);
8594
8605
  __decorate([
8595
8606
  pathType(5)
8596
- ], Star.prototype, "corners", void 0);
8607
+ ], Star.prototype, "corners", undefined);
8597
8608
  __decorate([
8598
8609
  pathType(0.382)
8599
- ], Star.prototype, "innerRadius", void 0);
8610
+ ], Star.prototype, "innerRadius", undefined);
8600
8611
  Star = __decorate([
8601
8612
  registerUI()
8602
8613
  ], Star);
@@ -8618,10 +8629,10 @@ let Image$1 = class Image extends Rect {
8618
8629
  };
8619
8630
  __decorate([
8620
8631
  dataProcessor(ImageData)
8621
- ], Image$1.prototype, "__", void 0);
8632
+ ], Image$1.prototype, "__", undefined);
8622
8633
  __decorate([
8623
8634
  boundsType('')
8624
- ], Image$1.prototype, "url", void 0);
8635
+ ], Image$1.prototype, "url", undefined);
8625
8636
  Image$1 = __decorate([
8626
8637
  registerUI()
8627
8638
  ], Image$1);
@@ -8684,25 +8695,25 @@ let Canvas = class Canvas extends Rect {
8684
8695
  };
8685
8696
  __decorate([
8686
8697
  dataProcessor(CanvasData)
8687
- ], Canvas.prototype, "__", void 0);
8698
+ ], Canvas.prototype, "__", undefined);
8688
8699
  __decorate([
8689
8700
  resizeType(100)
8690
- ], Canvas.prototype, "width", void 0);
8701
+ ], Canvas.prototype, "width", undefined);
8691
8702
  __decorate([
8692
8703
  resizeType(100)
8693
- ], Canvas.prototype, "height", void 0);
8704
+ ], Canvas.prototype, "height", undefined);
8694
8705
  __decorate([
8695
8706
  resizeType(1)
8696
- ], Canvas.prototype, "pixelRatio", void 0);
8707
+ ], Canvas.prototype, "pixelRatio", undefined);
8697
8708
  __decorate([
8698
8709
  resizeType(true)
8699
- ], Canvas.prototype, "smooth", void 0);
8710
+ ], Canvas.prototype, "smooth", undefined);
8700
8711
  __decorate([
8701
8712
  dataType(false)
8702
- ], Canvas.prototype, "safeResize", void 0);
8713
+ ], Canvas.prototype, "safeResize", undefined);
8703
8714
  __decorate([
8704
8715
  resizeType()
8705
- ], Canvas.prototype, "contextSettings", void 0);
8716
+ ], Canvas.prototype, "contextSettings", undefined);
8706
8717
  Canvas = __decorate([
8707
8718
  registerUI()
8708
8719
  ], Canvas);
@@ -8793,76 +8804,76 @@ let Text = class Text extends UI {
8793
8804
  };
8794
8805
  __decorate([
8795
8806
  dataProcessor(TextData)
8796
- ], Text.prototype, "__", void 0);
8807
+ ], Text.prototype, "__", undefined);
8797
8808
  __decorate([
8798
8809
  boundsType(0)
8799
- ], Text.prototype, "width", void 0);
8810
+ ], Text.prototype, "width", undefined);
8800
8811
  __decorate([
8801
8812
  boundsType(0)
8802
- ], Text.prototype, "height", void 0);
8813
+ ], Text.prototype, "height", undefined);
8803
8814
  __decorate([
8804
8815
  dataType(false)
8805
- ], Text.prototype, "resizeFontSize", void 0);
8816
+ ], Text.prototype, "resizeFontSize", undefined);
8806
8817
  __decorate([
8807
8818
  surfaceType('#000000')
8808
- ], Text.prototype, "fill", void 0);
8819
+ ], Text.prototype, "fill", undefined);
8809
8820
  __decorate([
8810
8821
  affectStrokeBoundsType('outside')
8811
- ], Text.prototype, "strokeAlign", void 0);
8822
+ ], Text.prototype, "strokeAlign", undefined);
8812
8823
  __decorate([
8813
8824
  hitType('all')
8814
- ], Text.prototype, "hitFill", void 0);
8825
+ ], Text.prototype, "hitFill", undefined);
8815
8826
  __decorate([
8816
8827
  boundsType('')
8817
- ], Text.prototype, "text", void 0);
8828
+ ], Text.prototype, "text", undefined);
8818
8829
  __decorate([
8819
- boundsType('L')
8820
- ], Text.prototype, "fontFamily", void 0);
8830
+ boundsType('caption')
8831
+ ], Text.prototype, "fontFamily", undefined);
8821
8832
  __decorate([
8822
8833
  boundsType(12)
8823
- ], Text.prototype, "fontSize", void 0);
8834
+ ], Text.prototype, "fontSize", undefined);
8824
8835
  __decorate([
8825
8836
  boundsType('normal')
8826
- ], Text.prototype, "fontWeight", void 0);
8837
+ ], Text.prototype, "fontWeight", undefined);
8827
8838
  __decorate([
8828
8839
  boundsType(false)
8829
- ], Text.prototype, "italic", void 0);
8840
+ ], Text.prototype, "italic", undefined);
8830
8841
  __decorate([
8831
8842
  boundsType('none')
8832
- ], Text.prototype, "textCase", void 0);
8843
+ ], Text.prototype, "textCase", undefined);
8833
8844
  __decorate([
8834
8845
  boundsType('none')
8835
- ], Text.prototype, "textDecoration", void 0);
8846
+ ], Text.prototype, "textDecoration", undefined);
8836
8847
  __decorate([
8837
8848
  boundsType(0)
8838
- ], Text.prototype, "letterSpacing", void 0);
8849
+ ], Text.prototype, "letterSpacing", undefined);
8839
8850
  __decorate([
8840
8851
  boundsType({ type: 'percent', value: 1.5 })
8841
- ], Text.prototype, "lineHeight", void 0);
8852
+ ], Text.prototype, "lineHeight", undefined);
8842
8853
  __decorate([
8843
8854
  boundsType(0)
8844
- ], Text.prototype, "paraIndent", void 0);
8855
+ ], Text.prototype, "paraIndent", undefined);
8845
8856
  __decorate([
8846
8857
  boundsType(0)
8847
- ], Text.prototype, "paraSpacing", void 0);
8858
+ ], Text.prototype, "paraSpacing", undefined);
8848
8859
  __decorate([
8849
8860
  boundsType('x')
8850
- ], Text.prototype, "writingMode", void 0);
8861
+ ], Text.prototype, "writingMode", undefined);
8851
8862
  __decorate([
8852
8863
  boundsType('left')
8853
- ], Text.prototype, "textAlign", void 0);
8864
+ ], Text.prototype, "textAlign", undefined);
8854
8865
  __decorate([
8855
8866
  boundsType('top')
8856
- ], Text.prototype, "verticalAlign", void 0);
8867
+ ], Text.prototype, "verticalAlign", undefined);
8857
8868
  __decorate([
8858
8869
  boundsType(true)
8859
- ], Text.prototype, "autoSizeAlign", void 0);
8870
+ ], Text.prototype, "autoSizeAlign", undefined);
8860
8871
  __decorate([
8861
8872
  boundsType('normal')
8862
- ], Text.prototype, "textWrap", void 0);
8873
+ ], Text.prototype, "textWrap", undefined);
8863
8874
  __decorate([
8864
8875
  boundsType('show')
8865
- ], Text.prototype, "textOverflow", void 0);
8876
+ ], Text.prototype, "textOverflow", undefined);
8866
8877
  Text = __decorate([
8867
8878
  registerUI()
8868
8879
  ], Text);
@@ -8875,10 +8886,10 @@ let Path = class Path extends UI {
8875
8886
  };
8876
8887
  __decorate([
8877
8888
  dataProcessor(PathData)
8878
- ], Path.prototype, "__", void 0);
8889
+ ], Path.prototype, "__", undefined);
8879
8890
  __decorate([
8880
8891
  affectStrokeBoundsType('center')
8881
- ], Path.prototype, "strokeAlign", void 0);
8892
+ ], Path.prototype, "strokeAlign", undefined);
8882
8893
  Path = __decorate([
8883
8894
  registerUI()
8884
8895
  ], Path);
@@ -8917,10 +8928,10 @@ let Pen = class Pen extends Group {
8917
8928
  };
8918
8929
  __decorate([
8919
8930
  dataProcessor(PenData)
8920
- ], Pen.prototype, "__", void 0);
8931
+ ], Pen.prototype, "__", undefined);
8921
8932
  __decorate([
8922
8933
  penPathType()
8923
- ], Pen.prototype, "path", void 0);
8934
+ ], Pen.prototype, "path", undefined);
8924
8935
  Pen = __decorate([
8925
8936
  useModule(PathCreator, ['set', 'path', 'paint']),
8926
8937
  registerUI()
@@ -9687,10 +9698,9 @@ class InteractionBase {
9687
9698
  }
9688
9699
  }
9689
9700
  pointerMoveReal(data) {
9690
- const { dragHover, dragDistance } = this.p;
9691
9701
  this.emit(PointerEvent$1.BEFORE_MOVE, data, this.defaultPath);
9692
9702
  if (this.downData) {
9693
- const canDrag = PointHelper.getDistance(this.downData, data) > dragDistance;
9703
+ const canDrag = PointHelper.getDistance(this.downData, data) > this.p.dragDistance;
9694
9704
  if (canDrag) {
9695
9705
  if (this.waitTap)
9696
9706
  this.pointerWaitCancel();
@@ -9702,9 +9712,8 @@ class InteractionBase {
9702
9712
  this.updateHoverData(data);
9703
9713
  this.checkPath(data);
9704
9714
  this.emit(PointerEvent$1.MOVE, data);
9705
- if (!(this.dragging && !dragHover))
9706
- this.pointerHover(data);
9707
- if (this.dragger.dragging) {
9715
+ this.pointerHover(data);
9716
+ if (this.dragging) {
9708
9717
  this.dragger.dragOverOrOut(data);
9709
9718
  this.dragger.dragEnterOrLeave(data);
9710
9719
  }
@@ -9785,7 +9794,8 @@ class InteractionBase {
9785
9794
  this.updateCursor();
9786
9795
  }
9787
9796
  pointerHover(data) {
9788
- if (this.canHover) {
9797
+ if (this.canHover && !(this.dragging && !this.p.dragHover)) {
9798
+ data.path || (data.path = new LeafList());
9789
9799
  this.pointerOverOrOut(data);
9790
9800
  this.pointerEnterOrLeave(data);
9791
9801
  }
@@ -10105,9 +10115,9 @@ leaf.__hitWorld = function (point) {
10105
10115
  }
10106
10116
  return this.__hit(inner);
10107
10117
  };
10108
- leaf.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitFill(inner, this.__.windingRule); };
10109
- leaf.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitStroke(inner, strokeWidth); };
10110
- leaf.__hitPixel = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitPixel(inner, this.__layout.renderBounds, this.__hitCanvas.hitScale); };
10118
+ leaf.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === undefined ? undefined : _a.hitFill(inner, this.__.windingRule); };
10119
+ leaf.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === undefined ? undefined : _a.hitStroke(inner, strokeWidth); };
10120
+ leaf.__hitPixel = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === undefined ? undefined : _a.hitPixel(inner, this.__layout.renderBounds, this.__hitCanvas.hitScale); };
10111
10121
  leaf.__drawHitPath = function (canvas) { if (canvas)
10112
10122
  this.__drawRenderPath(canvas); };
10113
10123
 
@@ -10264,6 +10274,7 @@ class Interaction extends InteractionBase {
10264
10274
  'pointerdown': this.onPointerDown,
10265
10275
  'mousedown': this.onMouseDown,
10266
10276
  'touchstart': this.onTouchStart,
10277
+ 'pointerleave': this.onPointerLeave,
10267
10278
  'contextmenu': this.onContextMenu,
10268
10279
  'wheel': this.onWheel,
10269
10280
  'gesturestart': this.onGesturestart,
@@ -10346,11 +10357,15 @@ class Interaction extends InteractionBase {
10346
10357
  this.usePointer || (this.usePointer = true);
10347
10358
  this.pointerDown(PointerEventHelper.convert(e, this.getLocal(e)));
10348
10359
  }
10349
- onPointerMove(e) {
10360
+ onPointerMove(e, isLeave) {
10350
10361
  if (this.config.pointer.touch || this.useMultiTouch || this.preventWindowPointer(e))
10351
10362
  return;
10352
10363
  this.usePointer || (this.usePointer = true);
10353
- this.pointerMove(PointerEventHelper.convert(e, this.getLocal(e, true)));
10364
+ const data = PointerEventHelper.convert(e, this.getLocal(e, true));
10365
+ isLeave ? this.pointerHover(data) : this.pointerMove(data);
10366
+ }
10367
+ onPointerLeave(e) {
10368
+ this.onPointerMove(e, true);
10354
10369
  }
10355
10370
  onPointerUp(e) {
10356
10371
  if (this.downData)
@@ -11146,7 +11161,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
11146
11161
  }
11147
11162
  else {
11148
11163
  if (!paint.patternTask) {
11149
- paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
11164
+ paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, undefined, undefined, function* () {
11150
11165
  paint.patternTask = null;
11151
11166
  if (canvas.bounds.hit(ui.__nowWorld))
11152
11167
  createPattern(ui, paint, pixelRatio);
@@ -11302,7 +11317,7 @@ function shadow(ui, current, shape) {
11302
11317
  const end = shadow.length - 1;
11303
11318
  toOffsetOutBounds$1(bounds, offsetOutBounds$1);
11304
11319
  shadow.forEach((item, index) => {
11305
- other.setWorldShadow((offsetOutBounds$1.offsetX + item.x * scaleX), (offsetOutBounds$1.offsetY + item.y * scaleY), item.blur * scaleX, item.color);
11320
+ other.setWorldShadow((offsetOutBounds$1.offsetX + item.x * scaleX), (offsetOutBounds$1.offsetY + item.y * scaleY), item.blur * scaleX, ColorConvert.string(item.color));
11306
11321
  spreadScale = item.spread ? 1 + item.spread * 2 / (__layout.boxBounds.width + (__layout.strokeBoxSpread || 0) * 2) : 0;
11307
11322
  drawWorldShadow(other, offsetOutBounds$1, spreadScale, shape);
11308
11323
  copyBounds = bounds;
@@ -11378,7 +11393,7 @@ function innerShadow(ui, current, shape) {
11378
11393
  other.copyWorld(shape.canvas, shapeBounds, bounds, 'source-out');
11379
11394
  copyBounds = bounds;
11380
11395
  }
11381
- other.fillWorld(copyBounds, item.color, 'source-in');
11396
+ other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
11382
11397
  if (ui.__worldFlipped) {
11383
11398
  current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
11384
11399
  }
@@ -11736,11 +11751,11 @@ const TextMode = 2;
11736
11751
  function layoutChar(drawData, style, width, _height) {
11737
11752
  const { rows } = drawData;
11738
11753
  const { textAlign, paraIndent, letterSpacing } = style;
11739
- let charX, addWordWidth, indentWidth, mode, wordChar;
11754
+ let charX, addWordWidth, indentWidth, mode, wordChar, wordsLength;
11740
11755
  rows.forEach(row => {
11741
11756
  if (row.words) {
11742
- indentWidth = paraIndent && row.paraStart ? paraIndent : 0;
11743
- addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
11757
+ indentWidth = paraIndent && row.paraStart ? paraIndent : 0, wordsLength = row.words.length;
11758
+ addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && wordsLength > 1) ? (width - row.width - indentWidth) / (wordsLength - 1) : 0;
11744
11759
  mode = (letterSpacing || row.isOverflow) ? CharMode : (addWordWidth > 0.01 ? WordMode : TextMode);
11745
11760
  if (row.isOverflow && !letterSpacing)
11746
11761
  row.textMode = true;
@@ -11752,7 +11767,7 @@ function layoutChar(drawData, style, width, _height) {
11752
11767
  row.x += indentWidth;
11753
11768
  charX = row.x;
11754
11769
  row.data = [];
11755
- row.words.forEach(word => {
11770
+ row.words.forEach((word, index) => {
11756
11771
  if (mode === WordMode) {
11757
11772
  wordChar = { char: '', x: charX };
11758
11773
  charX = toWordChar(word.data, charX, wordChar);
@@ -11762,7 +11777,7 @@ function layoutChar(drawData, style, width, _height) {
11762
11777
  else {
11763
11778
  charX = toChar(word.data, charX, row.data, row.isOverflow);
11764
11779
  }
11765
- if (addWordWidth && (!row.paraEnd || textAlign === 'both')) {
11780
+ if (addWordWidth && (!row.paraEnd || textAlign === 'both') && (index !== wordsLength - 1)) {
11766
11781
  charX += addWordWidth;
11767
11782
  row.width += addWordWidth;
11768
11783
  }
@@ -12019,3 +12034,4 @@ Object.assign(Creator, {
12019
12034
  useCanvas();
12020
12035
 
12021
12036
  export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent$1 as DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, 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, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent$1 as PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, 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 };
12037
+ //# sourceMappingURL=web.module.js.map