@leafer-draw/worker 1.3.1 → 1.3.2

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.
@@ -6007,7 +6007,7 @@ class LeafLevelList {
6007
6007
  }
6008
6008
  }
6009
6009
 
6010
- const version = "1.3.1";
6010
+ const version = "1.3.2";
6011
6011
 
6012
6012
  class LeaferCanvas extends LeaferCanvasBase {
6013
6013
  get allowBackgroundColor() { return true; }
@@ -6539,7 +6539,7 @@ class Renderer {
6539
6539
  partRender() {
6540
6540
  const { canvas, updateBlocks: list } = this;
6541
6541
  if (!list)
6542
- return debug$2.warn('PartRender: need update attr');
6542
+ return;
6543
6543
  this.mergeBlocks();
6544
6544
  list.forEach(block => { if (canvas.bounds.hit(block) && !block.isEmpty())
6545
6545
  this.clipRender(block); });
@@ -7239,7 +7239,7 @@ let UI = UI_1 = class UI extends Leaf {
7239
7239
  animate(_keyframe, _options, _type, _isTemp) {
7240
7240
  return Plugin.need('animate');
7241
7241
  }
7242
- killAnimate(_type, _killStyle) { }
7242
+ killAnimate(_type, _nextStyle) { }
7243
7243
  export(_filename, _options) {
7244
7244
  return Plugin.need('export');
7245
7245
  }
@@ -7735,8 +7735,6 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7735
7735
  this.created = true;
7736
7736
  }
7737
7737
  __onReady() {
7738
- if (this.ready)
7739
- return;
7740
7738
  this.ready = true;
7741
7739
  this.emitLeafer(LeaferEvent.BEFORE_READY);
7742
7740
  this.emitLeafer(LeaferEvent.READY);
@@ -7750,6 +7748,20 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7750
7748
  this.emitLeafer(LeaferEvent.VIEW_READY);
7751
7749
  WaitHelper.run(this.__viewReadyWait);
7752
7750
  }
7751
+ __onLayoutEnd() {
7752
+ const { grow, growWidth, growHeight } = this.config;
7753
+ if (grow) {
7754
+ let { width, height, pixelRatio } = this;
7755
+ const bounds = grow === 'box' ? this.worldBoxBounds : this.__world;
7756
+ if (growWidth !== false)
7757
+ width = Math.max(1, bounds.x + bounds.width);
7758
+ if (growHeight !== false)
7759
+ height = Math.max(1, bounds.y + bounds.height);
7760
+ this.__doResize({ width, height, pixelRatio });
7761
+ }
7762
+ if (!this.ready)
7763
+ this.__onReady();
7764
+ }
7753
7765
  __onNextRender() {
7754
7766
  if (this.viewReady) {
7755
7767
  WaitHelper.run(this.__nextRenderWait);
@@ -7843,10 +7855,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7843
7855
  const runId = Run.start('FirstCreate ' + this.innerName);
7844
7856
  this.once(LeaferEvent.START, () => Run.end(runId));
7845
7857
  this.once(LayoutEvent.START, () => this.updateLazyBounds());
7846
- this.once(LayoutEvent.END, () => this.__onReady());
7847
7858
  this.once(RenderEvent.START, () => this.__onCreated());
7848
7859
  this.once(RenderEvent.END, () => this.__onViewReady());
7849
- this.__eventIds.push(this.on_(WatchEvent.DATA, this.__onWatchData, this), this.on_(RenderEvent.NEXT, this.__onNextRender, this));
7860
+ this.__eventIds.push(this.on_(WatchEvent.DATA, this.__onWatchData, this), this.on_(LayoutEvent.END, this.__onLayoutEnd, this), this.on_(RenderEvent.NEXT, this.__onNextRender, this));
7850
7861
  }
7851
7862
  __removeListenEvents() {
7852
7863
  this.off_(this.__eventIds);
@@ -9805,7 +9816,7 @@ function layoutChar(drawData, style, width, _height) {
9805
9816
  rows.forEach(row => {
9806
9817
  if (row.words) {
9807
9818
  indentWidth = paraIndent && row.paraStart ? paraIndent : 0;
9808
- addWordWidth = (width && textAlign === 'justify' && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
9819
+ addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
9809
9820
  mode = (letterSpacing || row.isOverflow) ? CharMode : (addWordWidth > 0.01 ? WordMode : TextMode);
9810
9821
  if (row.isOverflow && !letterSpacing)
9811
9822
  row.textMode = true;
@@ -9827,7 +9838,7 @@ function layoutChar(drawData, style, width, _height) {
9827
9838
  else {
9828
9839
  charX = toChar(word.data, charX, row.data, row.isOverflow);
9829
9840
  }
9830
- if (!row.paraEnd && addWordWidth) {
9841
+ if (addWordWidth && (!row.paraEnd || textAlign === 'both')) {
9831
9842
  charX += addWordWidth;
9832
9843
  row.width += addWordWidth;
9833
9844
  }