@leafer-ui/worker 1.0.4 → 1.0.5

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.
@@ -4755,6 +4755,7 @@ class RenderEvent extends Event {
4755
4755
  }
4756
4756
  }
4757
4757
  RenderEvent.REQUEST = 'render.request';
4758
+ RenderEvent.CHILD_START = 'render.child_start';
4758
4759
  RenderEvent.START = 'render.start';
4759
4760
  RenderEvent.BEFORE = 'render.before';
4760
4761
  RenderEvent.RENDER = 'render';
@@ -4930,7 +4931,7 @@ const { isFinite } = Number;
4930
4931
  const debug$7 = Debug.get('setAttr');
4931
4932
  const LeafDataProxy = {
4932
4933
  __setAttr(name, newValue, checkFiniteNumber) {
4933
- if (this.leafer && this.leafer.created) {
4934
+ if (this.leaferIsCreated) {
4934
4935
  const oldValue = this.__.__getInput(name);
4935
4936
  if (checkFiniteNumber && !isFinite(newValue) && newValue !== undefined) {
4936
4937
  debug$7.warn(this.innerName, name, newValue);
@@ -5002,7 +5003,7 @@ const LeafMatrix = {
5002
5003
 
5003
5004
  const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2 } = LeafHelper;
5004
5005
  const { updateBounds: updateBounds$1 } = BranchHelper;
5005
- const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$2, copy: copy$5 } = BoundsHelper;
5006
+ const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$5 } = BoundsHelper;
5006
5007
  const { toBounds: toBounds$2 } = PathBounds;
5007
5008
  const LeafBounds = {
5008
5009
  __updateWorldBounds() {
@@ -5085,7 +5086,7 @@ const LeafBounds = {
5085
5086
  const b = this.__layout.boxBounds;
5086
5087
  const data = this.__;
5087
5088
  if (data.__pathInputed) {
5088
- toBounds$2(data.__pathForRender, b);
5089
+ toBounds$2(data.path, b);
5089
5090
  }
5090
5091
  else {
5091
5092
  b.x = 0;
@@ -5097,7 +5098,7 @@ const LeafBounds = {
5097
5098
  __updateAutoLayout() {
5098
5099
  this.__layout.matrixChanged = true;
5099
5100
  if (this.isBranch) {
5100
- if (this.leafer && this.leafer.ready)
5101
+ if (this.leaferIsReady)
5101
5102
  this.leafer.layouter.addExtra(this);
5102
5103
  if (this.__.flow) {
5103
5104
  if (this.__layout.boxChanged)
@@ -5123,11 +5124,11 @@ const LeafBounds = {
5123
5124
  },
5124
5125
  __updateStrokeBounds() {
5125
5126
  const layout = this.__layout;
5126
- copyAndSpread$2(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
5127
+ copyAndSpread$1(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
5127
5128
  },
5128
5129
  __updateRenderBounds() {
5129
5130
  const layout = this.__layout;
5130
- layout.renderSpread > 0 ? copyAndSpread$2(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$5(layout.renderBounds, layout.strokeBounds);
5131
+ layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$5(layout.renderBounds, layout.strokeBounds);
5131
5132
  }
5132
5133
  };
5133
5134
 
@@ -5232,6 +5233,8 @@ let Leaf = class Leaf {
5232
5233
  get innerName() { return this.__.name || this.tag + this.innerId; }
5233
5234
  get __DataProcessor() { return LeafData; }
5234
5235
  get __LayoutProcessor() { return LeafLayout; }
5236
+ get leaferIsCreated() { return this.leafer && this.leafer.created; }
5237
+ get leaferIsReady() { return this.leafer && this.leafer.ready; }
5235
5238
  get isLeafer() { return false; }
5236
5239
  get isBranch() { return false; }
5237
5240
  get isBranchLeaf() { return false; }
@@ -5673,6 +5676,7 @@ let Branch = class Branch extends Leaf {
5673
5676
  add(child, index) {
5674
5677
  if (child === this)
5675
5678
  return;
5679
+ child.__ || (child = UICreator.get(child.tag, child));
5676
5680
  if (child.parent)
5677
5681
  child.parent.remove(child);
5678
5682
  child.parent = this;
@@ -5695,10 +5699,14 @@ let Branch = class Branch extends Leaf {
5695
5699
  }
5696
5700
  remove(child, destroy) {
5697
5701
  if (child) {
5698
- if (child.animationOut)
5699
- child.__runAnimation('out', () => this.__remove(child, destroy));
5702
+ if (child.__) {
5703
+ if (child.animationOut)
5704
+ child.__runAnimation('out', () => this.__remove(child, destroy));
5705
+ else
5706
+ this.__remove(child, destroy);
5707
+ }
5700
5708
  else
5701
- this.__remove(child, destroy);
5709
+ this.find(child).forEach(item => this.remove(item, destroy));
5702
5710
  }
5703
5711
  else if (child === undefined) {
5704
5712
  super.remove(null, destroy);
@@ -5916,7 +5924,7 @@ class LeafLevelList {
5916
5924
  }
5917
5925
  }
5918
5926
 
5919
- const version = "1.0.4";
5927
+ const version = "1.0.5";
5920
5928
 
5921
5929
  class LeaferCanvas extends LeaferCanvasBase {
5922
5930
  get allowBackgroundColor() { return true; }
@@ -6385,6 +6393,7 @@ class Renderer {
6385
6393
  this.totalBounds = new Bounds();
6386
6394
  debug$5.log(target.innerName, '--->');
6387
6395
  try {
6396
+ target.app.emit(RenderEvent.CHILD_START, target);
6388
6397
  this.emitRender(RenderEvent.START);
6389
6398
  this.renderOnce(callback);
6390
6399
  this.emitRender(RenderEvent.END, this.totalBounds);
@@ -6682,7 +6691,7 @@ class Picker {
6682
6691
  if (child.isBranch) {
6683
6692
  if (hit || child.__ignoreHitWorld) {
6684
6693
  this.eachFind(child.children, child.__onlyHitMask);
6685
- if (child.isBranchLeaf && !this.findList.length)
6694
+ if (child.isBranchLeaf)
6686
6695
  this.hitChild(child, point);
6687
6696
  }
6688
6697
  }
@@ -7392,12 +7401,7 @@ let UI = UI_1 = class UI extends Leaf {
7392
7401
  this.__drawPathByData(canvas, this.__.path);
7393
7402
  }
7394
7403
  __drawPathByData(drawer, data) {
7395
- if (data) {
7396
- PathDrawer.drawPathByData(drawer, data);
7397
- }
7398
- else {
7399
- this.__drawPathByBox(drawer);
7400
- }
7404
+ data ? PathDrawer.drawPathByData(drawer, data) : this.__drawPathByBox(drawer);
7401
7405
  }
7402
7406
  __drawPathByBox(drawer) {
7403
7407
  const { x, y, width, height } = this.__layout.boxBounds;
@@ -7405,9 +7409,8 @@ let UI = UI_1 = class UI extends Leaf {
7405
7409
  const { cornerRadius } = this.__;
7406
7410
  drawer.roundRect(x, y, width, height, typeof cornerRadius === 'number' ? [cornerRadius] : cornerRadius);
7407
7411
  }
7408
- else {
7412
+ else
7409
7413
  drawer.rect(x, y, width, height);
7410
- }
7411
7414
  }
7412
7415
  animate(_keyframe, _options, _type, _isTemp) {
7413
7416
  return needPlugin('animate');
@@ -8090,10 +8093,9 @@ Rect = __decorate([
8090
8093
  registerUI()
8091
8094
  ], Rect);
8092
8095
 
8093
- const rect$1 = Rect.prototype;
8094
- const group$1 = Group.prototype;
8096
+ const { copy: copy$3, add, includes: includes$1 } = BoundsHelper;
8097
+ const rect$1 = Rect.prototype, group$1 = Group.prototype;
8095
8098
  const childrenRenderBounds = {};
8096
- const { copy: copy$3, add, includes: includes$1, copyAndSpread: copyAndSpread$1 } = BoundsHelper;
8097
8099
  let Box = class Box extends Group {
8098
8100
  get __tag() { return 'Box'; }
8099
8101
  get isBranchLeaf() { return true; }
@@ -8107,29 +8109,27 @@ let Box = class Box extends Group {
8107
8109
  return this.__updateRectRenderSpread() || -1;
8108
8110
  }
8109
8111
  __updateRectBoxBounds() { }
8110
- __updateBoxBounds(secondLayout) {
8112
+ __updateBoxBounds(_secondLayout) {
8111
8113
  const data = this.__;
8112
8114
  if (this.children.length) {
8113
8115
  if (data.__autoSide) {
8114
- if (this.leafer && this.leafer.ready)
8115
- this.leafer.layouter.addExtra(this);
8116
8116
  super.__updateBoxBounds();
8117
8117
  const { boxBounds } = this.__layout;
8118
8118
  if (!data.__autoSize) {
8119
- if (data.__autoWidth)
8120
- boxBounds.width += boxBounds.x, boxBounds.height = data.height, boxBounds.y = boxBounds.x = 0;
8121
- else
8122
- boxBounds.height += boxBounds.y, boxBounds.width = data.width, boxBounds.x = boxBounds.y = 0;
8119
+ if (data.__autoWidth) {
8120
+ boxBounds.width += boxBounds.x, boxBounds.x = 0;
8121
+ boxBounds.height = data.height, boxBounds.y = 0;
8122
+ }
8123
+ else {
8124
+ boxBounds.height += boxBounds.y, boxBounds.y = 0;
8125
+ boxBounds.width = data.width, boxBounds.x = 0;
8126
+ }
8123
8127
  }
8124
- if (secondLayout && data.flow && data.padding)
8125
- copyAndSpread$1(boxBounds, boxBounds, data.padding, false, data.__autoSize ? null : (data.__autoWidth ? 'width' : 'height'));
8126
8128
  this.__updateNaturalSize();
8127
8129
  }
8128
8130
  else {
8129
8131
  this.__updateRectBoxBounds();
8130
8132
  }
8131
- if (data.flow)
8132
- this.__updateContentBounds();
8133
8133
  }
8134
8134
  else {
8135
8135
  this.__updateRectBoxBounds();
@@ -8195,6 +8195,9 @@ __decorate([
8195
8195
  __decorate([
8196
8196
  dataType(false)
8197
8197
  ], Box.prototype, "resizeChildren", void 0);
8198
+ __decorate([
8199
+ dataType(false)
8200
+ ], Box.prototype, "textBox", void 0);
8198
8201
  __decorate([
8199
8202
  affectRenderBoundsType('show')
8200
8203
  ], Box.prototype, "overflow", void 0);
@@ -8724,6 +8727,9 @@ __decorate([
8724
8727
  __decorate([
8725
8728
  boundsType('top')
8726
8729
  ], Text.prototype, "verticalAlign", void 0);
8730
+ __decorate([
8731
+ boundsType(true)
8732
+ ], Text.prototype, "autoSizeAlign", void 0);
8727
8733
  __decorate([
8728
8734
  boundsType('normal')
8729
8735
  ], Text.prototype, "textWrap", void 0);
@@ -9444,9 +9450,10 @@ class Dragger {
9444
9450
  this.dragData = getDragEventData(data, data, data);
9445
9451
  this.canAnimate = this.canDragOut = true;
9446
9452
  }
9447
- getList() {
9453
+ getList(realDraggable, hover) {
9448
9454
  const { proxy } = this.interaction.selector;
9449
- return this.dragging && (!proxy || !proxy.list.length) ? (DragEvent.list || this.dragableList || emptyList) : emptyList;
9455
+ const hasProxyList = proxy && proxy.list.length, dragList = DragEvent.list || this.draggableList || emptyList;
9456
+ return this.dragging && (hasProxyList ? (realDraggable ? emptyList : new LeafList(hover ? [...proxy.list, ...proxy.dragHoverExclude] : proxy.list)) : dragList);
9450
9457
  }
9451
9458
  checkDrag(data, canDrag) {
9452
9459
  const { interaction } = this;
@@ -9471,8 +9478,8 @@ class Dragger {
9471
9478
  this.dragging = canDrag && PointerButton.left(data);
9472
9479
  if (this.dragging) {
9473
9480
  this.interaction.emit(DragEvent.START, this.dragData);
9474
- this.getDragableList(this.dragData.path);
9475
- this.setDragStartPoints(this.realDragableList = this.getList());
9481
+ this.getDraggableList(this.dragData.path);
9482
+ this.setDragStartPoints(this.realDraggableList = this.getList(true));
9476
9483
  }
9477
9484
  }
9478
9485
  }
@@ -9480,12 +9487,12 @@ class Dragger {
9480
9487
  this.dragStartPoints = {};
9481
9488
  list.forEach(leaf => this.dragStartPoints[leaf.innerId] = { x: leaf.x, y: leaf.y });
9482
9489
  }
9483
- getDragableList(path) {
9490
+ getDraggableList(path) {
9484
9491
  let leaf;
9485
9492
  for (let i = 0, len = path.length; i < len; i++) {
9486
9493
  leaf = path.list[i];
9487
- if ((leaf.__.draggable || leaf.__.editable) && leaf.__.hitSelf && !leaf.__.locked) {
9488
- this.dragableList = new LeafList(leaf);
9494
+ if ((leaf.draggable || leaf.editable) && leaf.hitSelf && !leaf.locked) {
9495
+ this.draggableList = new LeafList(leaf);
9489
9496
  break;
9490
9497
  }
9491
9498
  }
@@ -9510,7 +9517,7 @@ class Dragger {
9510
9517
  }
9511
9518
  dragReal() {
9512
9519
  const { running } = this.interaction;
9513
- const list = this.realDragableList;
9520
+ const list = this.realDraggableList;
9514
9521
  if (list.length && running) {
9515
9522
  const { totalX, totalY } = this.dragData;
9516
9523
  list.forEach(leaf => leaf.draggable && leaf.move(DragEvent.getValidMove(leaf, this.dragStartPoints[leaf.innerId], { x: totalX, y: totalY })));
@@ -9599,7 +9606,7 @@ class Dragger {
9599
9606
  this.interaction.emit(DragEvent.LEAVE, data, dragEnterPath);
9600
9607
  }
9601
9608
  dragReset() {
9602
- DragEvent.list = DragEvent.data = this.dragableList = this.dragData = this.downData = this.dragOverPath = this.dragEnterPath = null;
9609
+ DragEvent.list = DragEvent.data = this.draggableList = this.dragData = this.downData = this.dragOverPath = this.dragEnterPath = null;
9603
9610
  }
9604
9611
  checkDragOut(data) {
9605
9612
  const { interaction } = this;
@@ -9740,6 +9747,7 @@ const config = {
9740
9747
  touch: {
9741
9748
  preventDefault: true
9742
9749
  },
9750
+ multiTouch: {},
9743
9751
  cursor: true,
9744
9752
  keyEvent: true
9745
9753
  };
@@ -9866,6 +9874,8 @@ class InteractionBase {
9866
9874
  this.pointerUp(data);
9867
9875
  }
9868
9876
  multiTouch(data, list) {
9877
+ if (this.config.multiTouch.disabled)
9878
+ return;
9869
9879
  const { move, angle, scale, center } = MultiTouchHelper.getData(list);
9870
9880
  this.rotate(getRotateEventData(center, angle, data));
9871
9881
  this.zoom(getZoomEventData(center, scale, data));
@@ -10055,7 +10065,7 @@ class InteractionBase {
10055
10065
  data = this.hoverData;
10056
10066
  if (!data)
10057
10067
  return;
10058
- this.findPath(data, { exclude: this.dragger.getList(), name: PointerEvent.MOVE });
10068
+ this.findPath(data, { exclude: this.dragger.getList(false, true), name: PointerEvent.MOVE });
10059
10069
  this.hoverData = data;
10060
10070
  }
10061
10071
  updateCursor(data) {
@@ -10077,7 +10087,7 @@ class InteractionBase {
10077
10087
  const { path } = data;
10078
10088
  for (let i = 0, len = path.length; i < len; i++) {
10079
10089
  leaf = path.list[i];
10080
- cursor = leaf.syncEventer ? leaf.syncEventer.cursor : leaf.cursor;
10090
+ cursor = (leaf.syncEventer && leaf.syncEventer.cursor) || leaf.cursor;
10081
10091
  if (cursor)
10082
10092
  break;
10083
10093
  }
@@ -10259,7 +10269,7 @@ ui$2.__updateHitCanvas = function () {
10259
10269
  if (isHitPixel) {
10260
10270
  const { renderBounds } = this.__layout;
10261
10271
  const size = Platform.image.hitCanvasSize;
10262
- const scale = h.hitScale = tempBounds$1.set(0, 0, size, size).getFitMatrix(renderBounds, 0.5).a;
10272
+ const scale = h.hitScale = tempBounds$1.set(0, 0, size, size).getFitMatrix(renderBounds).a;
10263
10273
  const { x, y, width, height } = tempBounds$1.set(renderBounds).scale(scale);
10264
10274
  h.resize({ width, height, pixelRatio: 1 });
10265
10275
  h.clear();
@@ -10315,15 +10325,14 @@ ui$2.__hit = function (inner) {
10315
10325
  return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
10316
10326
  };
10317
10327
 
10318
- const ui$1 = new UI();
10319
- const rect = Rect.prototype;
10320
- rect.__updateHitCanvas = function () {
10328
+ const ui$1 = UI.prototype, rect = Rect.prototype, box$1 = Box.prototype;
10329
+ rect.__updateHitCanvas = box$1.__updateHitCanvas = function () {
10321
10330
  if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all')
10322
10331
  ui$1.__updateHitCanvas.call(this);
10323
10332
  else if (this.__hitCanvas)
10324
10333
  this.__hitCanvas = null;
10325
10334
  };
10326
- rect.__hitFill = function (inner) {
10335
+ rect.__hitFill = box$1.__hitFill = function (inner) {
10327
10336
  return this.__hitCanvas ? ui$1.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
10328
10337
  };
10329
10338
 
@@ -10822,9 +10831,10 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
10822
10831
  onLoadError(ui, event, image.error);
10823
10832
  }
10824
10833
  else {
10825
- ignoreRender(ui, true);
10826
- if (firstUse)
10834
+ if (firstUse) {
10835
+ ignoreRender(ui, true);
10827
10836
  onLoad(ui, event);
10837
+ }
10828
10838
  leafPaint.loadId = image.load(() => {
10829
10839
  ignoreRender(ui, false);
10830
10840
  if (!ui.destroyed) {
@@ -11436,11 +11446,12 @@ const { trimRight } = TextRowHelper;
11436
11446
  const { Letter, Single, Before, After, Symbol, Break } = CharType;
11437
11447
  let word, row, wordWidth, rowWidth, realWidth;
11438
11448
  let char, charWidth, startCharSize, charSize, charType, lastCharType, langBreak, afterBreak, paraStart;
11439
- let textDrawData, rows = [], bounds;
11449
+ let textDrawData, rows = [], bounds, findMaxWidth;
11440
11450
  function createRows(drawData, content, style) {
11441
11451
  textDrawData = drawData;
11442
11452
  rows = drawData.rows;
11443
11453
  bounds = drawData.bounds;
11454
+ findMaxWidth = !bounds.width && !style.autoSizeAlign;
11444
11455
  const { __letterSpacing, paraIndent, textCase } = style;
11445
11456
  const { canvas } = Platform;
11446
11457
  const { width, height } = bounds;
@@ -11525,7 +11536,10 @@ function createRows(drawData, content, style) {
11525
11536
  else {
11526
11537
  content.split('\n').forEach(content => {
11527
11538
  textDrawData.paraNumber++;
11528
- rows.push({ x: paraIndent || 0, text: content, width: canvas.measureText(content).width, paraStart: true });
11539
+ rowWidth = canvas.measureText(content).width;
11540
+ rows.push({ x: paraIndent || 0, text: content, width: rowWidth, paraStart: true });
11541
+ if (findMaxWidth)
11542
+ setMaxWidth();
11529
11543
  });
11530
11544
  }
11531
11545
  }
@@ -11556,10 +11570,16 @@ function addRow() {
11556
11570
  row.width = rowWidth;
11557
11571
  if (bounds.width)
11558
11572
  trimRight(row);
11573
+ else if (findMaxWidth)
11574
+ setMaxWidth();
11559
11575
  rows.push(row);
11560
11576
  row = { words: [] };
11561
11577
  rowWidth = 0;
11562
11578
  }
11579
+ function setMaxWidth() {
11580
+ if (rowWidth > (textDrawData.maxWidth || 0))
11581
+ textDrawData.maxWidth = rowWidth;
11582
+ }
11563
11583
 
11564
11584
  const CharMode = 0;
11565
11585
  const WordMode = 1;
@@ -11631,34 +11651,32 @@ function toChar(data, charX, rowData, isOverflow) {
11631
11651
 
11632
11652
  function layoutText(drawData, style) {
11633
11653
  const { rows, bounds } = drawData;
11634
- const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing } = style;
11654
+ const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing, autoSizeAlign } = style;
11635
11655
  let { x, y, width, height } = bounds, realHeight = __lineHeight * rows.length + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
11636
11656
  let starY = __baseLine;
11637
11657
  if (__clipText && realHeight > height) {
11638
11658
  realHeight = Math.max(height, __lineHeight);
11639
11659
  drawData.overflow = rows.length;
11640
11660
  }
11641
- else {
11661
+ else if (height || autoSizeAlign) {
11642
11662
  switch (verticalAlign) {
11643
11663
  case 'middle':
11644
11664
  y += (height - realHeight) / 2;
11645
11665
  break;
11646
- case 'bottom':
11647
- y += (height - realHeight);
11666
+ case 'bottom': y += (height - realHeight);
11648
11667
  }
11649
11668
  }
11650
11669
  starY += y;
11651
- let row, rowX, rowWidth;
11670
+ let row, rowX, rowWidth, layoutWidth = (width || autoSizeAlign) ? width : drawData.maxWidth;
11652
11671
  for (let i = 0, len = rows.length; i < len; i++) {
11653
11672
  row = rows[i];
11654
11673
  row.x = x;
11655
11674
  if (row.width < width || (row.width > width && !__clipText)) {
11656
11675
  switch (textAlign) {
11657
11676
  case 'center':
11658
- row.x += (width - row.width) / 2;
11677
+ row.x += (layoutWidth - row.width) / 2;
11659
11678
  break;
11660
- case 'right':
11661
- row.x += width - row.width;
11679
+ case 'right': row.x += layoutWidth - row.width;
11662
11680
  }
11663
11681
  }
11664
11682
  if (row.paraStart && paraSpacing && i > 0)
@@ -11763,14 +11781,14 @@ function getDrawData(content, style) {
11763
11781
  let height = style.__getInput('height') || 0;
11764
11782
  const { textDecoration, __font, __padding: padding } = style;
11765
11783
  if (padding) {
11766
- if (width) {
11784
+ if (width)
11785
+ x = padding[left], width -= (padding[right] + padding[left]);
11786
+ else if (!style.autoSizeAlign)
11767
11787
  x = padding[left];
11768
- width -= (padding[right] + padding[left]);
11769
- }
11770
- if (height) {
11788
+ if (height)
11789
+ y = padding[top], height -= (padding[top] + padding[bottom]);
11790
+ else if (!style.autoSizeAlign)
11771
11791
  y = padding[top];
11772
- height -= (padding[top] + padding[bottom]);
11773
- }
11774
11792
  }
11775
11793
  const drawData = {
11776
11794
  bounds: { x, y, width, height },
@@ -11790,22 +11808,20 @@ function getDrawData(content, style) {
11790
11808
  return drawData;
11791
11809
  }
11792
11810
  function padAutoText(padding, drawData, style, width, height) {
11793
- if (!width) {
11811
+ if (!width && style.autoSizeAlign) {
11794
11812
  switch (style.textAlign) {
11795
11813
  case 'left':
11796
11814
  offsetText(drawData, 'x', padding[left]);
11797
11815
  break;
11798
- case 'right':
11799
- offsetText(drawData, 'x', -padding[right]);
11816
+ case 'right': offsetText(drawData, 'x', -padding[right]);
11800
11817
  }
11801
11818
  }
11802
- if (!height) {
11819
+ if (!height && style.autoSizeAlign) {
11803
11820
  switch (style.verticalAlign) {
11804
11821
  case 'top':
11805
11822
  offsetText(drawData, 'y', padding[top]);
11806
11823
  break;
11807
- case 'bottom':
11808
- offsetText(drawData, 'y', -padding[bottom]);
11824
+ case 'bottom': offsetText(drawData, 'y', -padding[bottom]);
11809
11825
  }
11810
11826
  }
11811
11827
  }