@leafer-ui/worker 1.3.0 → 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.0";
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$3.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); });
@@ -7395,7 +7395,7 @@ let UI = UI_1 = class UI extends Leaf {
7395
7395
  animate(_keyframe, _options, _type, _isTemp) {
7396
7396
  return Plugin.need('animate');
7397
7397
  }
7398
- killAnimate(_type, _killStyle) { }
7398
+ killAnimate(_type, _nextStyle) { }
7399
7399
  export(_filename, _options) {
7400
7400
  return Plugin.need('export');
7401
7401
  }
@@ -7891,8 +7891,6 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7891
7891
  this.created = true;
7892
7892
  }
7893
7893
  __onReady() {
7894
- if (this.ready)
7895
- return;
7896
7894
  this.ready = true;
7897
7895
  this.emitLeafer(LeaferEvent.BEFORE_READY);
7898
7896
  this.emitLeafer(LeaferEvent.READY);
@@ -7906,6 +7904,20 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7906
7904
  this.emitLeafer(LeaferEvent.VIEW_READY);
7907
7905
  WaitHelper.run(this.__viewReadyWait);
7908
7906
  }
7907
+ __onLayoutEnd() {
7908
+ const { grow, growWidth, growHeight } = this.config;
7909
+ if (grow) {
7910
+ let { width, height, pixelRatio } = this;
7911
+ const bounds = grow === 'box' ? this.worldBoxBounds : this.__world;
7912
+ if (growWidth !== false)
7913
+ width = Math.max(1, bounds.x + bounds.width);
7914
+ if (growHeight !== false)
7915
+ height = Math.max(1, bounds.y + bounds.height);
7916
+ this.__doResize({ width, height, pixelRatio });
7917
+ }
7918
+ if (!this.ready)
7919
+ this.__onReady();
7920
+ }
7909
7921
  __onNextRender() {
7910
7922
  if (this.viewReady) {
7911
7923
  WaitHelper.run(this.__nextRenderWait);
@@ -7999,10 +8011,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7999
8011
  const runId = Run.start('FirstCreate ' + this.innerName);
8000
8012
  this.once(LeaferEvent.START, () => Run.end(runId));
8001
8013
  this.once(LayoutEvent.START, () => this.updateLazyBounds());
8002
- this.once(LayoutEvent.END, () => this.__onReady());
8003
8014
  this.once(RenderEvent.START, () => this.__onCreated());
8004
8015
  this.once(RenderEvent.END, () => this.__onViewReady());
8005
- this.__eventIds.push(this.on_(WatchEvent.DATA, this.__onWatchData, this), this.on_(RenderEvent.NEXT, this.__onNextRender, this));
8016
+ this.__eventIds.push(this.on_(WatchEvent.DATA, this.__onWatchData, this), this.on_(LayoutEvent.END, this.__onLayoutEnd, this), this.on_(RenderEvent.NEXT, this.__onNextRender, this));
8006
8017
  }
8007
8018
  __removeListenEvents() {
8008
8019
  this.off_(this.__eventIds);
@@ -11249,7 +11260,7 @@ function layoutChar(drawData, style, width, _height) {
11249
11260
  rows.forEach(row => {
11250
11261
  if (row.words) {
11251
11262
  indentWidth = paraIndent && row.paraStart ? paraIndent : 0;
11252
- addWordWidth = (width && textAlign === 'justify' && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
11263
+ addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
11253
11264
  mode = (letterSpacing || row.isOverflow) ? CharMode : (addWordWidth > 0.01 ? WordMode : TextMode);
11254
11265
  if (row.isOverflow && !letterSpacing)
11255
11266
  row.textMode = true;
@@ -11271,7 +11282,7 @@ function layoutChar(drawData, style, width, _height) {
11271
11282
  else {
11272
11283
  charX = toChar(word.data, charX, row.data, row.isOverflow);
11273
11284
  }
11274
- if (!row.paraEnd && addWordWidth) {
11285
+ if (addWordWidth && (!row.paraEnd || textAlign === 'both')) {
11275
11286
  charX += addWordWidth;
11276
11287
  row.width += addWordWidth;
11277
11288
  }