@leafer-editor/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.
package/dist/worker.js CHANGED
@@ -6236,7 +6236,7 @@ var LeaferUI = (function (exports) {
6236
6236
  }
6237
6237
  }
6238
6238
 
6239
- const version = "1.6.5";
6239
+ const version = "1.6.7";
6240
6240
 
6241
6241
  class LeaferCanvas extends LeaferCanvasBase {
6242
6242
  get allowBackgroundColor() { return true; }
@@ -7532,7 +7532,7 @@ var LeaferUI = (function (exports) {
7532
7532
  __drawAfterFill(canvas, options) {
7533
7533
  if (this.__.__clipAfterFill) {
7534
7534
  canvas.save();
7535
- canvas.clipUI();
7535
+ canvas.clipUI(this);
7536
7536
  this.__drawContent(canvas, options);
7537
7537
  canvas.restore();
7538
7538
  }
@@ -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
  }
@@ -15269,7 +15269,7 @@ ${filterStyle}
15269
15269
  let { x, y, width, height } = new Bounds(renderBounds).scale(scaleData.scaleX, scaleData.scaleY);
15270
15270
  if (clip)
15271
15271
  x += clip.x, y += clip.y, width = clip.width, height = clip.height;
15272
- const renderOptions = { matrix: matrix.scale(1 / scaleData.scaleX, 1 / scaleData.scaleY).invert().translate(-x, -y).withScale(1 / scaleX * scaleData.scaleX, 1 / scaleY * scaleData.scaleY) };
15272
+ 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) };
15273
15273
  let canvas = Creator.canvas({ width: Math.floor(width), height: Math.floor(height), pixelRatio, smooth, contextSettings });
15274
15274
  let sliceLeaf;
15275
15275
  if (slice) {
@@ -15438,12 +15438,8 @@ ${filterStyle}
15438
15438
  style.justifyContent = verticalAlignMap[text.verticalAlign];
15439
15439
  style.lineHeight = (text.__.__lineHeight || 0) * textScale + 'px';
15440
15440
  style.letterSpacing = (text.__.__letterSpacing || 0) * textScale + 'px';
15441
- if (textWrap === 'none') {
15442
- style.whiteSpace = 'nowrap';
15443
- }
15444
- else if (textWrap === 'break') {
15445
- style.wordBreak = 'break-all';
15446
- }
15441
+ style.whiteSpace = (textWrap === 'none' || text.__.__autoWidth) ? 'nowrap' : 'normal';
15442
+ style.wordBreak = textWrap === 'break' ? 'break-all' : 'normal';
15447
15443
  style.textIndent = (text.paraIndent || 0) * textScale + 'px';
15448
15444
  style.padding = padding instanceof Array ? padding.map(item => item * textScale + 'px').join(' ') : (padding || 0) * textScale + 'px';
15449
15445
  style.textOverflow = textOverflow === 'show' ? '' : (textOverflow === 'hide' ? 'clip' : textOverflow);
@@ -15569,30 +15565,32 @@ ${filterStyle}
15569
15565
  textScale *= 12 / text.fontSize;
15570
15566
  }
15571
15567
  this.textScale = textScale;
15572
- let { x, y } = this.inBody ? text.app.clientBounds : text.app.tree.clientBounds;
15573
- if (!this.inBody)
15574
- x -= window.scrollX, y -= window.scrollY;
15575
15568
  let { width, height } = text, offsetX = 0, offsetY = 0;
15576
15569
  width *= textScale, height *= textScale;
15577
15570
  const data = text.__;
15578
- if (data.__autoWidth && data.autoSizeAlign) {
15571
+ if (data.__autoWidth) {
15579
15572
  width += 20;
15580
- switch (data.textAlign) {
15581
- case 'center':
15582
- offsetX = -width / 2;
15583
- break;
15584
- case 'right': offsetX = -width;
15573
+ if (data.autoSizeAlign) {
15574
+ switch (data.textAlign) {
15575
+ case 'center':
15576
+ offsetX = -width / 2;
15577
+ break;
15578
+ case 'right': offsetX = -width;
15579
+ }
15585
15580
  }
15586
15581
  }
15587
- if (data.__autoHeight && data.autoSizeAlign) {
15582
+ if (data.__autoHeight) {
15588
15583
  height += 20;
15589
- switch (data.verticalAlign) {
15590
- case 'middle':
15591
- offsetY = -height / 2;
15592
- break;
15593
- case 'bottom': offsetY = -height;
15584
+ if (data.autoSizeAlign) {
15585
+ switch (data.verticalAlign) {
15586
+ case 'middle':
15587
+ offsetY = -height / 2;
15588
+ break;
15589
+ case 'bottom': offsetY = -height;
15590
+ }
15594
15591
  }
15595
15592
  }
15593
+ const { x, y } = this.inBody ? text.app.clientBounds : text.app.tree.clientBounds;
15596
15594
  const { a, b, c, d, e, f } = new Matrix(text.worldTransform).scale(1 / textScale).translateInner(offsetX, offsetY);
15597
15595
  const { style } = this.editDom;
15598
15596
  style.transform = `matrix(${a},${b},${c},${d},${e},${f})`;