@leafer-editor/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.
@@ -6233,7 +6233,7 @@ class LeafLevelList {
6233
6233
  }
6234
6234
  }
6235
6235
 
6236
- const version = "1.6.6";
6236
+ const version = "1.6.7";
6237
6237
 
6238
6238
  class LeaferCanvas extends LeaferCanvasBase {
6239
6239
  get allowBackgroundColor() { return true; }
@@ -8926,7 +8926,7 @@ let Text = class Text extends UI {
8926
8926
  const box = this.__box;
8927
8927
  if (box)
8928
8928
  box.__nowWorld = this.__nowWorld, box.__draw(canvas, options, originCanvas);
8929
- if (this.textEditing && !Export.running)
8929
+ if (this.textEditing && !options.exporting)
8930
8930
  return;
8931
8931
  super.__draw(canvas, options, originCanvas);
8932
8932
  }
@@ -15266,7 +15266,7 @@ const ExportModule = {
15266
15266
  let { x, y, width, height } = new Bounds(renderBounds).scale(scaleData.scaleX, scaleData.scaleY);
15267
15267
  if (clip)
15268
15268
  x += clip.x, y += clip.y, width = clip.width, height = clip.height;
15269
- const renderOptions = { matrix: matrix.scale(1 / scaleData.scaleX, 1 / scaleData.scaleY).invert().translate(-x, -y).withScale(1 / scaleX * scaleData.scaleX, 1 / scaleY * scaleData.scaleY) };
15269
+ 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) };
15270
15270
  let canvas = Creator.canvas({ width: Math.floor(width), height: Math.floor(height), pixelRatio, smooth, contextSettings });
15271
15271
  let sliceLeaf;
15272
15272
  if (slice) {
@@ -15435,12 +15435,8 @@ function updateStyle(textDom, text, textScale) {
15435
15435
  style.justifyContent = verticalAlignMap[text.verticalAlign];
15436
15436
  style.lineHeight = (text.__.__lineHeight || 0) * textScale + 'px';
15437
15437
  style.letterSpacing = (text.__.__letterSpacing || 0) * textScale + 'px';
15438
- if (textWrap === 'none') {
15439
- style.whiteSpace = 'nowrap';
15440
- }
15441
- else if (textWrap === 'break') {
15442
- style.wordBreak = 'break-all';
15443
- }
15438
+ style.whiteSpace = (textWrap === 'none' || text.__.__autoWidth) ? 'nowrap' : 'normal';
15439
+ style.wordBreak = textWrap === 'break' ? 'break-all' : 'normal';
15444
15440
  style.textIndent = (text.paraIndent || 0) * textScale + 'px';
15445
15441
  style.padding = padding instanceof Array ? padding.map(item => item * textScale + 'px').join(' ') : (padding || 0) * textScale + 'px';
15446
15442
  style.textOverflow = textOverflow === 'show' ? '' : (textOverflow === 'hide' ? 'clip' : textOverflow);
@@ -15566,30 +15562,32 @@ let TextEditor = class TextEditor extends InnerEditor {
15566
15562
  textScale *= 12 / text.fontSize;
15567
15563
  }
15568
15564
  this.textScale = textScale;
15569
- let { x, y } = this.inBody ? text.app.clientBounds : text.app.tree.clientBounds;
15570
- if (!this.inBody)
15571
- x -= window.scrollX, y -= window.scrollY;
15572
15565
  let { width, height } = text, offsetX = 0, offsetY = 0;
15573
15566
  width *= textScale, height *= textScale;
15574
15567
  const data = text.__;
15575
- if (data.__autoWidth && data.autoSizeAlign) {
15568
+ if (data.__autoWidth) {
15576
15569
  width += 20;
15577
- switch (data.textAlign) {
15578
- case 'center':
15579
- offsetX = -width / 2;
15580
- break;
15581
- case 'right': offsetX = -width;
15570
+ if (data.autoSizeAlign) {
15571
+ switch (data.textAlign) {
15572
+ case 'center':
15573
+ offsetX = -width / 2;
15574
+ break;
15575
+ case 'right': offsetX = -width;
15576
+ }
15582
15577
  }
15583
15578
  }
15584
- if (data.__autoHeight && data.autoSizeAlign) {
15579
+ if (data.__autoHeight) {
15585
15580
  height += 20;
15586
- switch (data.verticalAlign) {
15587
- case 'middle':
15588
- offsetY = -height / 2;
15589
- break;
15590
- case 'bottom': offsetY = -height;
15581
+ if (data.autoSizeAlign) {
15582
+ switch (data.verticalAlign) {
15583
+ case 'middle':
15584
+ offsetY = -height / 2;
15585
+ break;
15586
+ case 'bottom': offsetY = -height;
15587
+ }
15591
15588
  }
15592
15589
  }
15590
+ const { x, y } = this.inBody ? text.app.clientBounds : text.app.tree.clientBounds;
15593
15591
  const { a, b, c, d, e, f } = new Matrix(text.worldTransform).scale(1 / textScale).translateInner(offsetX, offsetY);
15594
15592
  const { style } = this.editDom;
15595
15593
  style.transform = `matrix(${a},${b},${c},${d},${e},${f})`;