@leafer/worker 1.6.5 → 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.5";
6236
+ const version = "1.6.7";
6237
6237
 
6238
6238
  class LeaferCanvas extends LeaferCanvasBase {
6239
6239
  get allowBackgroundColor() { return true; }
@@ -7529,7 +7529,7 @@ const UIRender = {
7529
7529
  __drawAfterFill(canvas, options) {
7530
7530
  if (this.__.__clipAfterFill) {
7531
7531
  canvas.save();
7532
- canvas.clipUI();
7532
+ canvas.clipUI(this);
7533
7533
  this.__drawContent(canvas, options);
7534
7534
  canvas.restore();
7535
7535
  }
@@ -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
  }
@@ -14241,12 +14241,8 @@ function updateStyle$1(textDom, text, textScale) {
14241
14241
  style.justifyContent = verticalAlignMap[text.verticalAlign];
14242
14242
  style.lineHeight = (text.__.__lineHeight || 0) * textScale + 'px';
14243
14243
  style.letterSpacing = (text.__.__letterSpacing || 0) * textScale + 'px';
14244
- if (textWrap === 'none') {
14245
- style.whiteSpace = 'nowrap';
14246
- }
14247
- else if (textWrap === 'break') {
14248
- style.wordBreak = 'break-all';
14249
- }
14244
+ style.whiteSpace = (textWrap === 'none' || text.__.__autoWidth) ? 'nowrap' : 'normal';
14245
+ style.wordBreak = textWrap === 'break' ? 'break-all' : 'normal';
14250
14246
  style.textIndent = (text.paraIndent || 0) * textScale + 'px';
14251
14247
  style.padding = padding instanceof Array ? padding.map(item => item * textScale + 'px').join(' ') : (padding || 0) * textScale + 'px';
14252
14248
  style.textOverflow = textOverflow === 'show' ? '' : (textOverflow === 'hide' ? 'clip' : textOverflow);
@@ -14372,30 +14368,32 @@ let TextEditor = class TextEditor extends InnerEditor {
14372
14368
  textScale *= 12 / text.fontSize;
14373
14369
  }
14374
14370
  this.textScale = textScale;
14375
- let { x, y } = this.inBody ? text.app.clientBounds : text.app.tree.clientBounds;
14376
- if (!this.inBody)
14377
- x -= window.scrollX, y -= window.scrollY;
14378
14371
  let { width, height } = text, offsetX = 0, offsetY = 0;
14379
14372
  width *= textScale, height *= textScale;
14380
14373
  const data = text.__;
14381
- if (data.__autoWidth && data.autoSizeAlign) {
14374
+ if (data.__autoWidth) {
14382
14375
  width += 20;
14383
- switch (data.textAlign) {
14384
- case 'center':
14385
- offsetX = -width / 2;
14386
- break;
14387
- case 'right': offsetX = -width;
14376
+ if (data.autoSizeAlign) {
14377
+ switch (data.textAlign) {
14378
+ case 'center':
14379
+ offsetX = -width / 2;
14380
+ break;
14381
+ case 'right': offsetX = -width;
14382
+ }
14388
14383
  }
14389
14384
  }
14390
- if (data.__autoHeight && data.autoSizeAlign) {
14385
+ if (data.__autoHeight) {
14391
14386
  height += 20;
14392
- switch (data.verticalAlign) {
14393
- case 'middle':
14394
- offsetY = -height / 2;
14395
- break;
14396
- case 'bottom': offsetY = -height;
14387
+ if (data.autoSizeAlign) {
14388
+ switch (data.verticalAlign) {
14389
+ case 'middle':
14390
+ offsetY = -height / 2;
14391
+ break;
14392
+ case 'bottom': offsetY = -height;
14393
+ }
14397
14394
  }
14398
14395
  }
14396
+ const { x, y } = this.inBody ? text.app.clientBounds : text.app.tree.clientBounds;
14399
14397
  const { a, b, c, d, e, f } = new Matrix(text.worldTransform).scale(1 / textScale).translateInner(offsetX, offsetY);
14400
14398
  const { style } = this.editDom;
14401
14399
  style.transform = `matrix(${a},${b},${c},${d},${e},${f})`;
@@ -17988,7 +17986,7 @@ const ExportModule = {
17988
17986
  let { x, y, width, height } = new Bounds(renderBounds).scale(scaleData.scaleX, scaleData.scaleY);
17989
17987
  if (clip)
17990
17988
  x += clip.x, y += clip.y, width = clip.width, height = clip.height;
17991
- const renderOptions = { matrix: matrix.scale(1 / scaleData.scaleX, 1 / scaleData.scaleY).invert().translate(-x, -y).withScale(1 / scaleX * scaleData.scaleX, 1 / scaleY * scaleData.scaleY) };
17989
+ 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) };
17992
17990
  let canvas = Creator.canvas({ width: Math.floor(width), height: Math.floor(height), pixelRatio, smooth, contextSettings });
17993
17991
  let sliceLeaf;
17994
17992
  if (slice) {