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.
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$7(matrix$1, 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$7(matrix$1, o);
4218
4224
  scaleOfOuter$2(matrix$1, origin, scaleX, scaleY);
4219
4225
  if (t.origin || t.around) {
4220
- L.setTransform(t, matrix$1, resize);
4226
+ L.setTransform(t, matrix$1, resize, transition);
4221
4227
  }
4222
4228
  else {
4223
- moveByMatrix(t, matrix$1);
4224
- t.scaleResize(scaleX, scaleY, resize !== true);
4229
+ const x = t.x + matrix$1.e - o.e, y = t.y + matrix$1.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$7(matrix$1, t.__localMatrix);
4239
+ rotateOfLocal(t, origin, angle, transition) {
4240
+ const o = t.__localMatrix;
4241
+ copy$7(matrix$1, o);
4232
4242
  rotateOfOuter$2(matrix$1, origin, angle);
4233
- if (t.origin || t.around) {
4234
- L.setTransform(t, matrix$1);
4235
- }
4236
- else {
4237
- moveByMatrix(t, matrix$1);
4238
- t.rotation = MathHelper.formatRotation(t.rotation + angle);
4239
- }
4243
+ if (t.origin || t.around)
4244
+ L.setTransform(t, matrix$1, false, transition);
4245
+ else
4246
+ 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);
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$7(matrix$1, t.__localMatrix);
4246
4253
  skewOfOuter(matrix$1, origin, skewX, skewY);
4247
- L.setTransform(t, matrix$1, resize);
4254
+ L.setTransform(t, matrix$1, resize, transition);
4248
4255
  },
4249
- transformWorld(t, transform, resize) {
4256
+ transformWorld(t, transform, resize, transition) {
4250
4257
  copy$7(matrix$1, t.worldTransform);
4251
4258
  multiplyParent$2(matrix$1, transform);
4252
4259
  if (t.parent)
4253
4260
  divideParent(matrix$1, t.parent.worldTransform);
4254
- L.setTransform(t, matrix$1, resize);
4261
+ L.setTransform(t, matrix$1, resize, transition);
4255
4262
  },
4256
- transform(t, transform, resize) {
4263
+ transform(t, transform, resize, transition) {
4257
4264
  copy$7(matrix$1, t.localTransform);
4258
4265
  multiplyParent$2(matrix$1, transform);
4259
- L.setTransform(t, matrix$1, resize);
4266
+ L.setTransform(t, matrix$1, 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$5 = 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;
@@ -7102,6 +7112,7 @@ var LeaferUI = (function (exports) {
7102
7112
  return t.fill && this.__hasStroke;
7103
7113
  }
7104
7114
  get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
7115
+ get __hasSurface() { const t = this; return (t.fill || t.stroke); }
7105
7116
  get __autoWidth() { return !this._width; }
7106
7117
  get __autoHeight() { return !this._height; }
7107
7118
  get __autoSide() { return !this._width || !this._height; }
@@ -7605,199 +7616,199 @@ var LeaferUI = (function (exports) {
7605
7616
  };
7606
7617
  __decorate([
7607
7618
  dataProcessor(UIData)
7608
- ], exports.UI.prototype, "__", void 0);
7619
+ ], exports.UI.prototype, "__", undefined);
7609
7620
  __decorate([
7610
7621
  zoomLayerType()
7611
- ], exports.UI.prototype, "zoomLayer", void 0);
7622
+ ], exports.UI.prototype, "zoomLayer", undefined);
7612
7623
  __decorate([
7613
7624
  dataType('')
7614
- ], exports.UI.prototype, "id", void 0);
7625
+ ], exports.UI.prototype, "id", undefined);
7615
7626
  __decorate([
7616
7627
  dataType('')
7617
- ], exports.UI.prototype, "name", void 0);
7628
+ ], exports.UI.prototype, "name", undefined);
7618
7629
  __decorate([
7619
7630
  dataType('')
7620
- ], exports.UI.prototype, "className", void 0);
7631
+ ], exports.UI.prototype, "className", undefined);
7621
7632
  __decorate([
7622
7633
  surfaceType('pass-through')
7623
- ], exports.UI.prototype, "blendMode", void 0);
7634
+ ], exports.UI.prototype, "blendMode", undefined);
7624
7635
  __decorate([
7625
7636
  opacityType(1)
7626
- ], exports.UI.prototype, "opacity", void 0);
7637
+ ], exports.UI.prototype, "opacity", undefined);
7627
7638
  __decorate([
7628
7639
  visibleType(true)
7629
- ], exports.UI.prototype, "visible", void 0);
7640
+ ], exports.UI.prototype, "visible", undefined);
7630
7641
  __decorate([
7631
7642
  surfaceType(false)
7632
- ], exports.UI.prototype, "locked", void 0);
7643
+ ], exports.UI.prototype, "locked", undefined);
7633
7644
  __decorate([
7634
7645
  sortType(0)
7635
- ], exports.UI.prototype, "zIndex", void 0);
7646
+ ], exports.UI.prototype, "zIndex", undefined);
7636
7647
  __decorate([
7637
7648
  maskType(false)
7638
- ], exports.UI.prototype, "mask", void 0);
7649
+ ], exports.UI.prototype, "mask", undefined);
7639
7650
  __decorate([
7640
7651
  eraserType(false)
7641
- ], exports.UI.prototype, "eraser", void 0);
7652
+ ], exports.UI.prototype, "eraser", undefined);
7642
7653
  __decorate([
7643
7654
  positionType(0, true)
7644
- ], exports.UI.prototype, "x", void 0);
7655
+ ], exports.UI.prototype, "x", undefined);
7645
7656
  __decorate([
7646
7657
  positionType(0, true)
7647
- ], exports.UI.prototype, "y", void 0);
7658
+ ], exports.UI.prototype, "y", undefined);
7648
7659
  __decorate([
7649
7660
  boundsType(100, true)
7650
- ], exports.UI.prototype, "width", void 0);
7661
+ ], exports.UI.prototype, "width", undefined);
7651
7662
  __decorate([
7652
7663
  boundsType(100, true)
7653
- ], exports.UI.prototype, "height", void 0);
7664
+ ], exports.UI.prototype, "height", undefined);
7654
7665
  __decorate([
7655
7666
  scaleType(1, true)
7656
- ], exports.UI.prototype, "scaleX", void 0);
7667
+ ], exports.UI.prototype, "scaleX", undefined);
7657
7668
  __decorate([
7658
7669
  scaleType(1, true)
7659
- ], exports.UI.prototype, "scaleY", void 0);
7670
+ ], exports.UI.prototype, "scaleY", undefined);
7660
7671
  __decorate([
7661
7672
  rotationType(0, true)
7662
- ], exports.UI.prototype, "rotation", void 0);
7673
+ ], exports.UI.prototype, "rotation", undefined);
7663
7674
  __decorate([
7664
7675
  rotationType(0, true)
7665
- ], exports.UI.prototype, "skewX", void 0);
7676
+ ], exports.UI.prototype, "skewX", undefined);
7666
7677
  __decorate([
7667
7678
  rotationType(0, true)
7668
- ], exports.UI.prototype, "skewY", void 0);
7679
+ ], exports.UI.prototype, "skewY", undefined);
7669
7680
  __decorate([
7670
7681
  positionType(0, true)
7671
- ], exports.UI.prototype, "offsetX", void 0);
7682
+ ], exports.UI.prototype, "offsetX", undefined);
7672
7683
  __decorate([
7673
7684
  positionType(0, true)
7674
- ], exports.UI.prototype, "offsetY", void 0);
7685
+ ], exports.UI.prototype, "offsetY", undefined);
7675
7686
  __decorate([
7676
7687
  positionType(0, true)
7677
- ], exports.UI.prototype, "scrollX", void 0);
7688
+ ], exports.UI.prototype, "scrollX", undefined);
7678
7689
  __decorate([
7679
7690
  positionType(0, true)
7680
- ], exports.UI.prototype, "scrollY", void 0);
7691
+ ], exports.UI.prototype, "scrollY", undefined);
7681
7692
  __decorate([
7682
7693
  autoLayoutType()
7683
- ], exports.UI.prototype, "origin", void 0);
7694
+ ], exports.UI.prototype, "origin", undefined);
7684
7695
  __decorate([
7685
7696
  autoLayoutType()
7686
- ], exports.UI.prototype, "around", void 0);
7697
+ ], exports.UI.prototype, "around", undefined);
7687
7698
  __decorate([
7688
7699
  dataType(false)
7689
- ], exports.UI.prototype, "lazy", void 0);
7700
+ ], exports.UI.prototype, "lazy", undefined);
7690
7701
  __decorate([
7691
7702
  naturalBoundsType(1)
7692
- ], exports.UI.prototype, "pixelRatio", void 0);
7703
+ ], exports.UI.prototype, "pixelRatio", undefined);
7693
7704
  __decorate([
7694
7705
  pathInputType()
7695
- ], exports.UI.prototype, "path", void 0);
7706
+ ], exports.UI.prototype, "path", undefined);
7696
7707
  __decorate([
7697
7708
  pathType()
7698
- ], exports.UI.prototype, "windingRule", void 0);
7709
+ ], exports.UI.prototype, "windingRule", undefined);
7699
7710
  __decorate([
7700
7711
  pathType(true)
7701
- ], exports.UI.prototype, "closed", void 0);
7712
+ ], exports.UI.prototype, "closed", undefined);
7702
7713
  __decorate([
7703
7714
  boundsType(0)
7704
- ], exports.UI.prototype, "padding", void 0);
7715
+ ], exports.UI.prototype, "padding", undefined);
7705
7716
  __decorate([
7706
7717
  boundsType(false)
7707
- ], exports.UI.prototype, "lockRatio", void 0);
7718
+ ], exports.UI.prototype, "lockRatio", undefined);
7708
7719
  __decorate([
7709
7720
  boundsType()
7710
- ], exports.UI.prototype, "widthRange", void 0);
7721
+ ], exports.UI.prototype, "widthRange", undefined);
7711
7722
  __decorate([
7712
7723
  boundsType()
7713
- ], exports.UI.prototype, "heightRange", void 0);
7724
+ ], exports.UI.prototype, "heightRange", undefined);
7714
7725
  __decorate([
7715
7726
  dataType(false)
7716
- ], exports.UI.prototype, "draggable", void 0);
7727
+ ], exports.UI.prototype, "draggable", undefined);
7717
7728
  __decorate([
7718
7729
  dataType()
7719
- ], exports.UI.prototype, "dragBounds", void 0);
7730
+ ], exports.UI.prototype, "dragBounds", undefined);
7720
7731
  __decorate([
7721
7732
  dataType(false)
7722
- ], exports.UI.prototype, "editable", void 0);
7733
+ ], exports.UI.prototype, "editable", undefined);
7723
7734
  __decorate([
7724
7735
  hitType(true)
7725
- ], exports.UI.prototype, "hittable", void 0);
7736
+ ], exports.UI.prototype, "hittable", undefined);
7726
7737
  __decorate([
7727
7738
  hitType('path')
7728
- ], exports.UI.prototype, "hitFill", void 0);
7739
+ ], exports.UI.prototype, "hitFill", undefined);
7729
7740
  __decorate([
7730
7741
  strokeType('path')
7731
- ], exports.UI.prototype, "hitStroke", void 0);
7742
+ ], exports.UI.prototype, "hitStroke", undefined);
7732
7743
  __decorate([
7733
7744
  hitType(false)
7734
- ], exports.UI.prototype, "hitBox", void 0);
7745
+ ], exports.UI.prototype, "hitBox", undefined);
7735
7746
  __decorate([
7736
7747
  hitType(true)
7737
- ], exports.UI.prototype, "hitChildren", void 0);
7748
+ ], exports.UI.prototype, "hitChildren", undefined);
7738
7749
  __decorate([
7739
7750
  hitType(true)
7740
- ], exports.UI.prototype, "hitSelf", void 0);
7751
+ ], exports.UI.prototype, "hitSelf", undefined);
7741
7752
  __decorate([
7742
7753
  hitType()
7743
- ], exports.UI.prototype, "hitRadius", void 0);
7754
+ ], exports.UI.prototype, "hitRadius", undefined);
7744
7755
  __decorate([
7745
7756
  cursorType('')
7746
- ], exports.UI.prototype, "cursor", void 0);
7757
+ ], exports.UI.prototype, "cursor", undefined);
7747
7758
  __decorate([
7748
7759
  surfaceType()
7749
- ], exports.UI.prototype, "fill", void 0);
7760
+ ], exports.UI.prototype, "fill", undefined);
7750
7761
  __decorate([
7751
7762
  strokeType()
7752
- ], exports.UI.prototype, "stroke", void 0);
7763
+ ], exports.UI.prototype, "stroke", undefined);
7753
7764
  __decorate([
7754
7765
  strokeType('inside')
7755
- ], exports.UI.prototype, "strokeAlign", void 0);
7766
+ ], exports.UI.prototype, "strokeAlign", undefined);
7756
7767
  __decorate([
7757
7768
  strokeType(1)
7758
- ], exports.UI.prototype, "strokeWidth", void 0);
7769
+ ], exports.UI.prototype, "strokeWidth", undefined);
7759
7770
  __decorate([
7760
7771
  strokeType(false)
7761
- ], exports.UI.prototype, "strokeWidthFixed", void 0);
7772
+ ], exports.UI.prototype, "strokeWidthFixed", undefined);
7762
7773
  __decorate([
7763
7774
  strokeType('none')
7764
- ], exports.UI.prototype, "strokeCap", void 0);
7775
+ ], exports.UI.prototype, "strokeCap", undefined);
7765
7776
  __decorate([
7766
7777
  strokeType('miter')
7767
- ], exports.UI.prototype, "strokeJoin", void 0);
7778
+ ], exports.UI.prototype, "strokeJoin", undefined);
7768
7779
  __decorate([
7769
7780
  strokeType()
7770
- ], exports.UI.prototype, "dashPattern", void 0);
7781
+ ], exports.UI.prototype, "dashPattern", undefined);
7771
7782
  __decorate([
7772
7783
  strokeType()
7773
- ], exports.UI.prototype, "dashOffset", void 0);
7784
+ ], exports.UI.prototype, "dashOffset", undefined);
7774
7785
  __decorate([
7775
7786
  strokeType(10)
7776
- ], exports.UI.prototype, "miterLimit", void 0);
7787
+ ], exports.UI.prototype, "miterLimit", undefined);
7777
7788
  __decorate([
7778
7789
  pathType(0)
7779
- ], exports.UI.prototype, "cornerRadius", void 0);
7790
+ ], exports.UI.prototype, "cornerRadius", undefined);
7780
7791
  __decorate([
7781
7792
  pathType()
7782
- ], exports.UI.prototype, "cornerSmoothing", void 0);
7793
+ ], exports.UI.prototype, "cornerSmoothing", undefined);
7783
7794
  __decorate([
7784
7795
  effectType()
7785
- ], exports.UI.prototype, "shadow", void 0);
7796
+ ], exports.UI.prototype, "shadow", undefined);
7786
7797
  __decorate([
7787
7798
  effectType()
7788
- ], exports.UI.prototype, "innerShadow", void 0);
7799
+ ], exports.UI.prototype, "innerShadow", undefined);
7789
7800
  __decorate([
7790
7801
  effectType()
7791
- ], exports.UI.prototype, "blur", void 0);
7802
+ ], exports.UI.prototype, "blur", undefined);
7792
7803
  __decorate([
7793
7804
  effectType()
7794
- ], exports.UI.prototype, "backgroundBlur", void 0);
7805
+ ], exports.UI.prototype, "backgroundBlur", undefined);
7795
7806
  __decorate([
7796
7807
  effectType()
7797
- ], exports.UI.prototype, "grayscale", void 0);
7808
+ ], exports.UI.prototype, "grayscale", undefined);
7798
7809
  __decorate([
7799
7810
  dataType({})
7800
- ], exports.UI.prototype, "data", void 0);
7811
+ ], exports.UI.prototype, "data", undefined);
7801
7812
  __decorate([
7802
7813
  rewrite(exports.Leaf.prototype.reset)
7803
7814
  ], exports.UI.prototype, "reset", null);
@@ -7858,7 +7869,7 @@ var LeaferUI = (function (exports) {
7858
7869
  };
7859
7870
  __decorate([
7860
7871
  dataProcessor(GroupData)
7861
- ], exports.Group.prototype, "__", void 0);
7872
+ ], exports.Group.prototype, "__", undefined);
7862
7873
  exports.Group = __decorate([
7863
7874
  useModule(exports.Branch),
7864
7875
  registerUI()
@@ -8029,8 +8040,6 @@ var LeaferUI = (function (exports) {
8029
8040
  __setAttr(attrName, newValue) {
8030
8041
  if (this.canvas) {
8031
8042
  if (canvasSizeAttrs.includes(attrName)) {
8032
- if (!newValue)
8033
- debug$1.warn(attrName + ' is 0');
8034
8043
  this.__changeCanvasSize(attrName, newValue);
8035
8044
  }
8036
8045
  else if (attrName === 'fill') {
@@ -8233,10 +8242,10 @@ var LeaferUI = (function (exports) {
8233
8242
  exports.Leafer.list = new LeafList();
8234
8243
  __decorate([
8235
8244
  dataProcessor(LeaferData)
8236
- ], exports.Leafer.prototype, "__", void 0);
8245
+ ], exports.Leafer.prototype, "__", undefined);
8237
8246
  __decorate([
8238
8247
  boundsType()
8239
- ], exports.Leafer.prototype, "pixelRatio", void 0);
8248
+ ], exports.Leafer.prototype, "pixelRatio", undefined);
8240
8249
  exports.Leafer = Leafer_1 = __decorate([
8241
8250
  registerUI()
8242
8251
  ], exports.Leafer);
@@ -8249,7 +8258,7 @@ var LeaferUI = (function (exports) {
8249
8258
  };
8250
8259
  __decorate([
8251
8260
  dataProcessor(RectData)
8252
- ], exports.Rect.prototype, "__", void 0);
8261
+ ], exports.Rect.prototype, "__", undefined);
8253
8262
  exports.Rect = __decorate([
8254
8263
  useModule(RectRender),
8255
8264
  rewriteAble(),
@@ -8274,6 +8283,8 @@ var LeaferUI = (function (exports) {
8274
8283
  const data = this.__;
8275
8284
  if (this.children.length) {
8276
8285
  if (data.__autoSide) {
8286
+ if (data.__hasSurface)
8287
+ this.__extraUpdate();
8277
8288
  super.__updateBoxBounds();
8278
8289
  const { boxBounds } = this.__layout;
8279
8290
  if (!data.__autoSize) {
@@ -8338,13 +8349,13 @@ var LeaferUI = (function (exports) {
8338
8349
  };
8339
8350
  __decorate([
8340
8351
  dataProcessor(BoxData)
8341
- ], exports.Box.prototype, "__", void 0);
8352
+ ], exports.Box.prototype, "__", undefined);
8342
8353
  __decorate([
8343
8354
  dataType(false)
8344
- ], exports.Box.prototype, "resizeChildren", void 0);
8355
+ ], exports.Box.prototype, "resizeChildren", undefined);
8345
8356
  __decorate([
8346
8357
  affectRenderBoundsType('show')
8347
- ], exports.Box.prototype, "overflow", void 0);
8358
+ ], exports.Box.prototype, "overflow", undefined);
8348
8359
  __decorate([
8349
8360
  rewrite(rect$1.__updateStrokeSpread)
8350
8361
  ], exports.Box.prototype, "__updateStrokeSpread", null);
@@ -8383,13 +8394,13 @@ var LeaferUI = (function (exports) {
8383
8394
  };
8384
8395
  __decorate([
8385
8396
  dataProcessor(FrameData)
8386
- ], exports.Frame.prototype, "__", void 0);
8397
+ ], exports.Frame.prototype, "__", undefined);
8387
8398
  __decorate([
8388
8399
  surfaceType('#FFFFFF')
8389
- ], exports.Frame.prototype, "fill", void 0);
8400
+ ], exports.Frame.prototype, "fill", undefined);
8390
8401
  __decorate([
8391
8402
  affectRenderBoundsType('hide')
8392
- ], exports.Frame.prototype, "overflow", void 0);
8403
+ ], exports.Frame.prototype, "overflow", undefined);
8393
8404
  exports.Frame = __decorate([
8394
8405
  registerUI()
8395
8406
  ], exports.Frame);
@@ -8436,16 +8447,16 @@ var LeaferUI = (function (exports) {
8436
8447
  };
8437
8448
  __decorate([
8438
8449
  dataProcessor(EllipseData)
8439
- ], exports.Ellipse.prototype, "__", void 0);
8450
+ ], exports.Ellipse.prototype, "__", undefined);
8440
8451
  __decorate([
8441
8452
  pathType(0)
8442
- ], exports.Ellipse.prototype, "innerRadius", void 0);
8453
+ ], exports.Ellipse.prototype, "innerRadius", undefined);
8443
8454
  __decorate([
8444
8455
  pathType(0)
8445
- ], exports.Ellipse.prototype, "startAngle", void 0);
8456
+ ], exports.Ellipse.prototype, "startAngle", undefined);
8446
8457
  __decorate([
8447
8458
  pathType(0)
8448
- ], exports.Ellipse.prototype, "endAngle", void 0);
8459
+ ], exports.Ellipse.prototype, "endAngle", undefined);
8449
8460
  exports.Ellipse = __decorate([
8450
8461
  registerUI()
8451
8462
  ], exports.Ellipse);
@@ -8504,22 +8515,22 @@ var LeaferUI = (function (exports) {
8504
8515
  };
8505
8516
  __decorate([
8506
8517
  dataProcessor(LineData)
8507
- ], exports.Line.prototype, "__", void 0);
8518
+ ], exports.Line.prototype, "__", undefined);
8508
8519
  __decorate([
8509
8520
  affectStrokeBoundsType('center')
8510
- ], exports.Line.prototype, "strokeAlign", void 0);
8521
+ ], exports.Line.prototype, "strokeAlign", undefined);
8511
8522
  __decorate([
8512
8523
  boundsType(0)
8513
- ], exports.Line.prototype, "height", void 0);
8524
+ ], exports.Line.prototype, "height", undefined);
8514
8525
  __decorate([
8515
8526
  pathType()
8516
- ], exports.Line.prototype, "points", void 0);
8527
+ ], exports.Line.prototype, "points", undefined);
8517
8528
  __decorate([
8518
8529
  pathType(0)
8519
- ], exports.Line.prototype, "curve", void 0);
8530
+ ], exports.Line.prototype, "curve", undefined);
8520
8531
  __decorate([
8521
8532
  pathType(false)
8522
- ], exports.Line.prototype, "closed", void 0);
8533
+ ], exports.Line.prototype, "closed", undefined);
8523
8534
  exports.Line = __decorate([
8524
8535
  registerUI()
8525
8536
  ], exports.Line);
@@ -8552,16 +8563,16 @@ var LeaferUI = (function (exports) {
8552
8563
  };
8553
8564
  __decorate([
8554
8565
  dataProcessor(PolygonData)
8555
- ], exports.Polygon.prototype, "__", void 0);
8566
+ ], exports.Polygon.prototype, "__", undefined);
8556
8567
  __decorate([
8557
8568
  pathType(3)
8558
- ], exports.Polygon.prototype, "sides", void 0);
8569
+ ], exports.Polygon.prototype, "sides", undefined);
8559
8570
  __decorate([
8560
8571
  pathType()
8561
- ], exports.Polygon.prototype, "points", void 0);
8572
+ ], exports.Polygon.prototype, "points", undefined);
8562
8573
  __decorate([
8563
8574
  pathType(0)
8564
- ], exports.Polygon.prototype, "curve", void 0);
8575
+ ], exports.Polygon.prototype, "curve", undefined);
8565
8576
  __decorate([
8566
8577
  rewrite(line.__updateRenderPath)
8567
8578
  ], exports.Polygon.prototype, "__updateRenderPath", null);
@@ -8593,13 +8604,13 @@ var LeaferUI = (function (exports) {
8593
8604
  };
8594
8605
  __decorate([
8595
8606
  dataProcessor(StarData)
8596
- ], exports.Star.prototype, "__", void 0);
8607
+ ], exports.Star.prototype, "__", undefined);
8597
8608
  __decorate([
8598
8609
  pathType(5)
8599
- ], exports.Star.prototype, "corners", void 0);
8610
+ ], exports.Star.prototype, "corners", undefined);
8600
8611
  __decorate([
8601
8612
  pathType(0.382)
8602
- ], exports.Star.prototype, "innerRadius", void 0);
8613
+ ], exports.Star.prototype, "innerRadius", undefined);
8603
8614
  exports.Star = __decorate([
8604
8615
  registerUI()
8605
8616
  ], exports.Star);
@@ -8621,10 +8632,10 @@ var LeaferUI = (function (exports) {
8621
8632
  };
8622
8633
  __decorate([
8623
8634
  dataProcessor(ImageData)
8624
- ], exports.Image.prototype, "__", void 0);
8635
+ ], exports.Image.prototype, "__", undefined);
8625
8636
  __decorate([
8626
8637
  boundsType('')
8627
- ], exports.Image.prototype, "url", void 0);
8638
+ ], exports.Image.prototype, "url", undefined);
8628
8639
  exports.Image = __decorate([
8629
8640
  registerUI()
8630
8641
  ], exports.Image);
@@ -8687,25 +8698,25 @@ var LeaferUI = (function (exports) {
8687
8698
  };
8688
8699
  __decorate([
8689
8700
  dataProcessor(CanvasData)
8690
- ], exports.Canvas.prototype, "__", void 0);
8701
+ ], exports.Canvas.prototype, "__", undefined);
8691
8702
  __decorate([
8692
8703
  resizeType(100)
8693
- ], exports.Canvas.prototype, "width", void 0);
8704
+ ], exports.Canvas.prototype, "width", undefined);
8694
8705
  __decorate([
8695
8706
  resizeType(100)
8696
- ], exports.Canvas.prototype, "height", void 0);
8707
+ ], exports.Canvas.prototype, "height", undefined);
8697
8708
  __decorate([
8698
8709
  resizeType(1)
8699
- ], exports.Canvas.prototype, "pixelRatio", void 0);
8710
+ ], exports.Canvas.prototype, "pixelRatio", undefined);
8700
8711
  __decorate([
8701
8712
  resizeType(true)
8702
- ], exports.Canvas.prototype, "smooth", void 0);
8713
+ ], exports.Canvas.prototype, "smooth", undefined);
8703
8714
  __decorate([
8704
8715
  dataType(false)
8705
- ], exports.Canvas.prototype, "safeResize", void 0);
8716
+ ], exports.Canvas.prototype, "safeResize", undefined);
8706
8717
  __decorate([
8707
8718
  resizeType()
8708
- ], exports.Canvas.prototype, "contextSettings", void 0);
8719
+ ], exports.Canvas.prototype, "contextSettings", undefined);
8709
8720
  exports.Canvas = __decorate([
8710
8721
  registerUI()
8711
8722
  ], exports.Canvas);
@@ -8796,76 +8807,76 @@ var LeaferUI = (function (exports) {
8796
8807
  };
8797
8808
  __decorate([
8798
8809
  dataProcessor(TextData)
8799
- ], exports.Text.prototype, "__", void 0);
8810
+ ], exports.Text.prototype, "__", undefined);
8800
8811
  __decorate([
8801
8812
  boundsType(0)
8802
- ], exports.Text.prototype, "width", void 0);
8813
+ ], exports.Text.prototype, "width", undefined);
8803
8814
  __decorate([
8804
8815
  boundsType(0)
8805
- ], exports.Text.prototype, "height", void 0);
8816
+ ], exports.Text.prototype, "height", undefined);
8806
8817
  __decorate([
8807
8818
  dataType(false)
8808
- ], exports.Text.prototype, "resizeFontSize", void 0);
8819
+ ], exports.Text.prototype, "resizeFontSize", undefined);
8809
8820
  __decorate([
8810
8821
  surfaceType('#000000')
8811
- ], exports.Text.prototype, "fill", void 0);
8822
+ ], exports.Text.prototype, "fill", undefined);
8812
8823
  __decorate([
8813
8824
  affectStrokeBoundsType('outside')
8814
- ], exports.Text.prototype, "strokeAlign", void 0);
8825
+ ], exports.Text.prototype, "strokeAlign", undefined);
8815
8826
  __decorate([
8816
8827
  hitType('all')
8817
- ], exports.Text.prototype, "hitFill", void 0);
8828
+ ], exports.Text.prototype, "hitFill", undefined);
8818
8829
  __decorate([
8819
8830
  boundsType('')
8820
- ], exports.Text.prototype, "text", void 0);
8831
+ ], exports.Text.prototype, "text", undefined);
8821
8832
  __decorate([
8822
- boundsType('L')
8823
- ], exports.Text.prototype, "fontFamily", void 0);
8833
+ boundsType('caption')
8834
+ ], exports.Text.prototype, "fontFamily", undefined);
8824
8835
  __decorate([
8825
8836
  boundsType(12)
8826
- ], exports.Text.prototype, "fontSize", void 0);
8837
+ ], exports.Text.prototype, "fontSize", undefined);
8827
8838
  __decorate([
8828
8839
  boundsType('normal')
8829
- ], exports.Text.prototype, "fontWeight", void 0);
8840
+ ], exports.Text.prototype, "fontWeight", undefined);
8830
8841
  __decorate([
8831
8842
  boundsType(false)
8832
- ], exports.Text.prototype, "italic", void 0);
8843
+ ], exports.Text.prototype, "italic", undefined);
8833
8844
  __decorate([
8834
8845
  boundsType('none')
8835
- ], exports.Text.prototype, "textCase", void 0);
8846
+ ], exports.Text.prototype, "textCase", undefined);
8836
8847
  __decorate([
8837
8848
  boundsType('none')
8838
- ], exports.Text.prototype, "textDecoration", void 0);
8849
+ ], exports.Text.prototype, "textDecoration", undefined);
8839
8850
  __decorate([
8840
8851
  boundsType(0)
8841
- ], exports.Text.prototype, "letterSpacing", void 0);
8852
+ ], exports.Text.prototype, "letterSpacing", undefined);
8842
8853
  __decorate([
8843
8854
  boundsType({ type: 'percent', value: 1.5 })
8844
- ], exports.Text.prototype, "lineHeight", void 0);
8855
+ ], exports.Text.prototype, "lineHeight", undefined);
8845
8856
  __decorate([
8846
8857
  boundsType(0)
8847
- ], exports.Text.prototype, "paraIndent", void 0);
8858
+ ], exports.Text.prototype, "paraIndent", undefined);
8848
8859
  __decorate([
8849
8860
  boundsType(0)
8850
- ], exports.Text.prototype, "paraSpacing", void 0);
8861
+ ], exports.Text.prototype, "paraSpacing", undefined);
8851
8862
  __decorate([
8852
8863
  boundsType('x')
8853
- ], exports.Text.prototype, "writingMode", void 0);
8864
+ ], exports.Text.prototype, "writingMode", undefined);
8854
8865
  __decorate([
8855
8866
  boundsType('left')
8856
- ], exports.Text.prototype, "textAlign", void 0);
8867
+ ], exports.Text.prototype, "textAlign", undefined);
8857
8868
  __decorate([
8858
8869
  boundsType('top')
8859
- ], exports.Text.prototype, "verticalAlign", void 0);
8870
+ ], exports.Text.prototype, "verticalAlign", undefined);
8860
8871
  __decorate([
8861
8872
  boundsType(true)
8862
- ], exports.Text.prototype, "autoSizeAlign", void 0);
8873
+ ], exports.Text.prototype, "autoSizeAlign", undefined);
8863
8874
  __decorate([
8864
8875
  boundsType('normal')
8865
- ], exports.Text.prototype, "textWrap", void 0);
8876
+ ], exports.Text.prototype, "textWrap", undefined);
8866
8877
  __decorate([
8867
8878
  boundsType('show')
8868
- ], exports.Text.prototype, "textOverflow", void 0);
8879
+ ], exports.Text.prototype, "textOverflow", undefined);
8869
8880
  exports.Text = __decorate([
8870
8881
  registerUI()
8871
8882
  ], exports.Text);
@@ -8878,10 +8889,10 @@ var LeaferUI = (function (exports) {
8878
8889
  };
8879
8890
  __decorate([
8880
8891
  dataProcessor(PathData)
8881
- ], exports.Path.prototype, "__", void 0);
8892
+ ], exports.Path.prototype, "__", undefined);
8882
8893
  __decorate([
8883
8894
  affectStrokeBoundsType('center')
8884
- ], exports.Path.prototype, "strokeAlign", void 0);
8895
+ ], exports.Path.prototype, "strokeAlign", undefined);
8885
8896
  exports.Path = __decorate([
8886
8897
  registerUI()
8887
8898
  ], exports.Path);
@@ -8920,10 +8931,10 @@ var LeaferUI = (function (exports) {
8920
8931
  };
8921
8932
  __decorate([
8922
8933
  dataProcessor(PenData)
8923
- ], exports.Pen.prototype, "__", void 0);
8934
+ ], exports.Pen.prototype, "__", undefined);
8924
8935
  __decorate([
8925
8936
  penPathType()
8926
- ], exports.Pen.prototype, "path", void 0);
8937
+ ], exports.Pen.prototype, "path", undefined);
8927
8938
  exports.Pen = __decorate([
8928
8939
  useModule(PathCreator, ['set', 'path', 'paint']),
8929
8940
  registerUI()
@@ -9690,10 +9701,9 @@ var LeaferUI = (function (exports) {
9690
9701
  }
9691
9702
  }
9692
9703
  pointerMoveReal(data) {
9693
- const { dragHover, dragDistance } = this.p;
9694
9704
  this.emit(exports.PointerEvent.BEFORE_MOVE, data, this.defaultPath);
9695
9705
  if (this.downData) {
9696
- const canDrag = PointHelper.getDistance(this.downData, data) > dragDistance;
9706
+ const canDrag = PointHelper.getDistance(this.downData, data) > this.p.dragDistance;
9697
9707
  if (canDrag) {
9698
9708
  if (this.waitTap)
9699
9709
  this.pointerWaitCancel();
@@ -9705,9 +9715,8 @@ var LeaferUI = (function (exports) {
9705
9715
  this.updateHoverData(data);
9706
9716
  this.checkPath(data);
9707
9717
  this.emit(exports.PointerEvent.MOVE, data);
9708
- if (!(this.dragging && !dragHover))
9709
- this.pointerHover(data);
9710
- if (this.dragger.dragging) {
9718
+ this.pointerHover(data);
9719
+ if (this.dragging) {
9711
9720
  this.dragger.dragOverOrOut(data);
9712
9721
  this.dragger.dragEnterOrLeave(data);
9713
9722
  }
@@ -9788,7 +9797,8 @@ var LeaferUI = (function (exports) {
9788
9797
  this.updateCursor();
9789
9798
  }
9790
9799
  pointerHover(data) {
9791
- if (this.canHover) {
9800
+ if (this.canHover && !(this.dragging && !this.p.dragHover)) {
9801
+ data.path || (data.path = new LeafList());
9792
9802
  this.pointerOverOrOut(data);
9793
9803
  this.pointerEnterOrLeave(data);
9794
9804
  }
@@ -10108,9 +10118,9 @@ var LeaferUI = (function (exports) {
10108
10118
  }
10109
10119
  return this.__hit(inner);
10110
10120
  };
10111
- leaf.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitFill(inner, this.__.windingRule); };
10112
- leaf.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitStroke(inner, strokeWidth); };
10113
- 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); };
10121
+ leaf.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === undefined ? undefined : _a.hitFill(inner, this.__.windingRule); };
10122
+ leaf.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === undefined ? undefined : _a.hitStroke(inner, strokeWidth); };
10123
+ leaf.__hitPixel = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === undefined ? undefined : _a.hitPixel(inner, this.__layout.renderBounds, this.__hitCanvas.hitScale); };
10114
10124
  leaf.__drawHitPath = function (canvas) { if (canvas)
10115
10125
  this.__drawRenderPath(canvas); };
10116
10126
 
@@ -10267,6 +10277,7 @@ var LeaferUI = (function (exports) {
10267
10277
  'pointerdown': this.onPointerDown,
10268
10278
  'mousedown': this.onMouseDown,
10269
10279
  'touchstart': this.onTouchStart,
10280
+ 'pointerleave': this.onPointerLeave,
10270
10281
  'contextmenu': this.onContextMenu,
10271
10282
  'wheel': this.onWheel,
10272
10283
  'gesturestart': this.onGesturestart,
@@ -10349,11 +10360,15 @@ var LeaferUI = (function (exports) {
10349
10360
  this.usePointer || (this.usePointer = true);
10350
10361
  this.pointerDown(PointerEventHelper.convert(e, this.getLocal(e)));
10351
10362
  }
10352
- onPointerMove(e) {
10363
+ onPointerMove(e, isLeave) {
10353
10364
  if (this.config.pointer.touch || this.useMultiTouch || this.preventWindowPointer(e))
10354
10365
  return;
10355
10366
  this.usePointer || (this.usePointer = true);
10356
- this.pointerMove(PointerEventHelper.convert(e, this.getLocal(e, true)));
10367
+ const data = PointerEventHelper.convert(e, this.getLocal(e, true));
10368
+ isLeave ? this.pointerHover(data) : this.pointerMove(data);
10369
+ }
10370
+ onPointerLeave(e) {
10371
+ this.onPointerMove(e, true);
10357
10372
  }
10358
10373
  onPointerUp(e) {
10359
10374
  if (this.downData)
@@ -11149,7 +11164,7 @@ var LeaferUI = (function (exports) {
11149
11164
  }
11150
11165
  else {
11151
11166
  if (!paint.patternTask) {
11152
- paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
11167
+ paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, undefined, undefined, function* () {
11153
11168
  paint.patternTask = null;
11154
11169
  if (canvas.bounds.hit(ui.__nowWorld))
11155
11170
  createPattern(ui, paint, pixelRatio);
@@ -11305,7 +11320,7 @@ var LeaferUI = (function (exports) {
11305
11320
  const end = shadow.length - 1;
11306
11321
  toOffsetOutBounds$1(bounds, offsetOutBounds$1);
11307
11322
  shadow.forEach((item, index) => {
11308
- other.setWorldShadow((offsetOutBounds$1.offsetX + item.x * scaleX), (offsetOutBounds$1.offsetY + item.y * scaleY), item.blur * scaleX, item.color);
11323
+ other.setWorldShadow((offsetOutBounds$1.offsetX + item.x * scaleX), (offsetOutBounds$1.offsetY + item.y * scaleY), item.blur * scaleX, ColorConvert.string(item.color));
11309
11324
  spreadScale = item.spread ? 1 + item.spread * 2 / (__layout.boxBounds.width + (__layout.strokeBoxSpread || 0) * 2) : 0;
11310
11325
  drawWorldShadow(other, offsetOutBounds$1, spreadScale, shape);
11311
11326
  copyBounds = bounds;
@@ -11381,7 +11396,7 @@ var LeaferUI = (function (exports) {
11381
11396
  other.copyWorld(shape.canvas, shapeBounds, bounds, 'source-out');
11382
11397
  copyBounds = bounds;
11383
11398
  }
11384
- other.fillWorld(copyBounds, item.color, 'source-in');
11399
+ other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
11385
11400
  if (ui.__worldFlipped) {
11386
11401
  current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
11387
11402
  }
@@ -11739,11 +11754,11 @@ var LeaferUI = (function (exports) {
11739
11754
  function layoutChar(drawData, style, width, _height) {
11740
11755
  const { rows } = drawData;
11741
11756
  const { textAlign, paraIndent, letterSpacing } = style;
11742
- let charX, addWordWidth, indentWidth, mode, wordChar;
11757
+ let charX, addWordWidth, indentWidth, mode, wordChar, wordsLength;
11743
11758
  rows.forEach(row => {
11744
11759
  if (row.words) {
11745
- indentWidth = paraIndent && row.paraStart ? paraIndent : 0;
11746
- addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
11760
+ indentWidth = paraIndent && row.paraStart ? paraIndent : 0, wordsLength = row.words.length;
11761
+ addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && wordsLength > 1) ? (width - row.width - indentWidth) / (wordsLength - 1) : 0;
11747
11762
  mode = (letterSpacing || row.isOverflow) ? CharMode : (addWordWidth > 0.01 ? WordMode : TextMode);
11748
11763
  if (row.isOverflow && !letterSpacing)
11749
11764
  row.textMode = true;
@@ -11755,7 +11770,7 @@ var LeaferUI = (function (exports) {
11755
11770
  row.x += indentWidth;
11756
11771
  charX = row.x;
11757
11772
  row.data = [];
11758
- row.words.forEach(word => {
11773
+ row.words.forEach((word, index) => {
11759
11774
  if (mode === WordMode) {
11760
11775
  wordChar = { char: '', x: charX };
11761
11776
  charX = toWordChar(word.data, charX, wordChar);
@@ -11765,7 +11780,7 @@ var LeaferUI = (function (exports) {
11765
11780
  else {
11766
11781
  charX = toChar(word.data, charX, row.data, row.isOverflow);
11767
11782
  }
11768
- if (addWordWidth && (!row.paraEnd || textAlign === 'both')) {
11783
+ if (addWordWidth && (!row.paraEnd || textAlign === 'both') && (index !== wordsLength - 1)) {
11769
11784
  charX += addWordWidth;
11770
11785
  row.width += addWordWidth;
11771
11786
  }
@@ -12192,3 +12207,4 @@ var LeaferUI = (function (exports) {
12192
12207
  return exports;
12193
12208
 
12194
12209
  })({});
12210
+ //# sourceMappingURL=web.js.map