@leafer/worker 1.6.6 → 1.6.7

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/worker.js CHANGED
@@ -6236,7 +6236,7 @@ var LeaferUI = (function (exports) {
6236
6236
  }
6237
6237
  }
6238
6238
 
6239
- const version = "1.6.6";
6239
+ const version = "1.6.7";
6240
6240
 
6241
6241
  class LeaferCanvas extends LeaferCanvasBase {
6242
6242
  get allowBackgroundColor() { return true; }
@@ -8929,7 +8929,7 @@ var LeaferUI = (function (exports) {
8929
8929
  const box = this.__box;
8930
8930
  if (box)
8931
8931
  box.__nowWorld = this.__nowWorld, box.__draw(canvas, options, originCanvas);
8932
- if (this.textEditing && !Export.running)
8932
+ if (this.textEditing && !options.exporting)
8933
8933
  return;
8934
8934
  super.__draw(canvas, options, originCanvas);
8935
8935
  }
@@ -14244,12 +14244,8 @@ ${filterStyle$1}
14244
14244
  style.justifyContent = verticalAlignMap[text.verticalAlign];
14245
14245
  style.lineHeight = (text.__.__lineHeight || 0) * textScale + 'px';
14246
14246
  style.letterSpacing = (text.__.__letterSpacing || 0) * textScale + 'px';
14247
- if (textWrap === 'none') {
14248
- style.whiteSpace = 'nowrap';
14249
- }
14250
- else if (textWrap === 'break') {
14251
- style.wordBreak = 'break-all';
14252
- }
14247
+ style.whiteSpace = (textWrap === 'none' || text.__.__autoWidth) ? 'nowrap' : 'normal';
14248
+ style.wordBreak = textWrap === 'break' ? 'break-all' : 'normal';
14253
14249
  style.textIndent = (text.paraIndent || 0) * textScale + 'px';
14254
14250
  style.padding = padding instanceof Array ? padding.map(item => item * textScale + 'px').join(' ') : (padding || 0) * textScale + 'px';
14255
14251
  style.textOverflow = textOverflow === 'show' ? '' : (textOverflow === 'hide' ? 'clip' : textOverflow);
@@ -14375,30 +14371,32 @@ ${filterStyle$1}
14375
14371
  textScale *= 12 / text.fontSize;
14376
14372
  }
14377
14373
  this.textScale = textScale;
14378
- let { x, y } = this.inBody ? text.app.clientBounds : text.app.tree.clientBounds;
14379
- if (!this.inBody)
14380
- x -= window.scrollX, y -= window.scrollY;
14381
14374
  let { width, height } = text, offsetX = 0, offsetY = 0;
14382
14375
  width *= textScale, height *= textScale;
14383
14376
  const data = text.__;
14384
- if (data.__autoWidth && data.autoSizeAlign) {
14377
+ if (data.__autoWidth) {
14385
14378
  width += 20;
14386
- switch (data.textAlign) {
14387
- case 'center':
14388
- offsetX = -width / 2;
14389
- break;
14390
- case 'right': offsetX = -width;
14379
+ if (data.autoSizeAlign) {
14380
+ switch (data.textAlign) {
14381
+ case 'center':
14382
+ offsetX = -width / 2;
14383
+ break;
14384
+ case 'right': offsetX = -width;
14385
+ }
14391
14386
  }
14392
14387
  }
14393
- if (data.__autoHeight && data.autoSizeAlign) {
14388
+ if (data.__autoHeight) {
14394
14389
  height += 20;
14395
- switch (data.verticalAlign) {
14396
- case 'middle':
14397
- offsetY = -height / 2;
14398
- break;
14399
- case 'bottom': offsetY = -height;
14390
+ if (data.autoSizeAlign) {
14391
+ switch (data.verticalAlign) {
14392
+ case 'middle':
14393
+ offsetY = -height / 2;
14394
+ break;
14395
+ case 'bottom': offsetY = -height;
14396
+ }
14400
14397
  }
14401
14398
  }
14399
+ const { x, y } = this.inBody ? text.app.clientBounds : text.app.tree.clientBounds;
14402
14400
  const { a, b, c, d, e, f } = new Matrix(text.worldTransform).scale(1 / textScale).translateInner(offsetX, offsetY);
14403
14401
  const { style } = this.editDom;
14404
14402
  style.transform = `matrix(${a},${b},${c},${d},${e},${f})`;
@@ -17991,7 +17989,7 @@ ${filterStyle$1}
17991
17989
  let { x, y, width, height } = new Bounds(renderBounds).scale(scaleData.scaleX, scaleData.scaleY);
17992
17990
  if (clip)
17993
17991
  x += clip.x, y += clip.y, width = clip.width, height = clip.height;
17994
- const renderOptions = { matrix: matrix.scale(1 / scaleData.scaleX, 1 / scaleData.scaleY).invert().translate(-x, -y).withScale(1 / scaleX * scaleData.scaleX, 1 / scaleY * scaleData.scaleY) };
17992
+ const renderOptions = { exporting: true, matrix: matrix.scale(1 / scaleData.scaleX, 1 / scaleData.scaleY).invert().translate(-x, -y).withScale(1 / scaleX * scaleData.scaleX, 1 / scaleY * scaleData.scaleY) };
17995
17993
  let canvas = Creator.canvas({ width: Math.floor(width), height: Math.floor(height), pixelRatio, smooth, contextSettings });
17996
17994
  let sliceLeaf;
17997
17995
  if (slice) {