@leafer-ui/miniapp 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 false; }
@@ -6522,6 +6530,7 @@ class Renderer {
6522
6530
  this.totalBounds = new Bounds();
6523
6531
  debug$5.log(target.innerName, '--->');
6524
6532
  try {
6533
+ target.app.emit(RenderEvent.CHILD_START, target);
6525
6534
  this.emitRender(RenderEvent.START);
6526
6535
  this.renderOnce(callback);
6527
6536
  this.emitRender(RenderEvent.END, this.totalBounds);
@@ -6819,7 +6828,7 @@ class Picker {
6819
6828
  if (child.isBranch) {
6820
6829
  if (hit || child.__ignoreHitWorld) {
6821
6830
  this.eachFind(child.children, child.__onlyHitMask);
6822
- if (child.isBranchLeaf && !this.findList.length)
6831
+ if (child.isBranchLeaf)
6823
6832
  this.hitChild(child, point);
6824
6833
  }
6825
6834
  }
@@ -7529,12 +7538,7 @@ let UI = UI_1 = class UI extends Leaf {
7529
7538
  this.__drawPathByData(canvas, this.__.path);
7530
7539
  }
7531
7540
  __drawPathByData(drawer, data) {
7532
- if (data) {
7533
- PathDrawer.drawPathByData(drawer, data);
7534
- }
7535
- else {
7536
- this.__drawPathByBox(drawer);
7537
- }
7541
+ data ? PathDrawer.drawPathByData(drawer, data) : this.__drawPathByBox(drawer);
7538
7542
  }
7539
7543
  __drawPathByBox(drawer) {
7540
7544
  const { x, y, width, height } = this.__layout.boxBounds;
@@ -7542,9 +7546,8 @@ let UI = UI_1 = class UI extends Leaf {
7542
7546
  const { cornerRadius } = this.__;
7543
7547
  drawer.roundRect(x, y, width, height, typeof cornerRadius === 'number' ? [cornerRadius] : cornerRadius);
7544
7548
  }
7545
- else {
7549
+ else
7546
7550
  drawer.rect(x, y, width, height);
7547
- }
7548
7551
  }
7549
7552
  animate(_keyframe, _options, _type, _isTemp) {
7550
7553
  return needPlugin('animate');
@@ -8227,10 +8230,9 @@ Rect = __decorate([
8227
8230
  registerUI()
8228
8231
  ], Rect);
8229
8232
 
8230
- const rect$1 = Rect.prototype;
8231
- const group$1 = Group.prototype;
8233
+ const { copy: copy$3, add, includes: includes$1 } = BoundsHelper;
8234
+ const rect$1 = Rect.prototype, group$1 = Group.prototype;
8232
8235
  const childrenRenderBounds = {};
8233
- const { copy: copy$3, add, includes: includes$1, copyAndSpread: copyAndSpread$1 } = BoundsHelper;
8234
8236
  let Box = class Box extends Group {
8235
8237
  get __tag() { return 'Box'; }
8236
8238
  get isBranchLeaf() { return true; }
@@ -8244,29 +8246,27 @@ let Box = class Box extends Group {
8244
8246
  return this.__updateRectRenderSpread() || -1;
8245
8247
  }
8246
8248
  __updateRectBoxBounds() { }
8247
- __updateBoxBounds(secondLayout) {
8249
+ __updateBoxBounds(_secondLayout) {
8248
8250
  const data = this.__;
8249
8251
  if (this.children.length) {
8250
8252
  if (data.__autoSide) {
8251
- if (this.leafer && this.leafer.ready)
8252
- this.leafer.layouter.addExtra(this);
8253
8253
  super.__updateBoxBounds();
8254
8254
  const { boxBounds } = this.__layout;
8255
8255
  if (!data.__autoSize) {
8256
- if (data.__autoWidth)
8257
- boxBounds.width += boxBounds.x, boxBounds.height = data.height, boxBounds.y = boxBounds.x = 0;
8258
- else
8259
- boxBounds.height += boxBounds.y, boxBounds.width = data.width, boxBounds.x = boxBounds.y = 0;
8256
+ if (data.__autoWidth) {
8257
+ boxBounds.width += boxBounds.x, boxBounds.x = 0;
8258
+ boxBounds.height = data.height, boxBounds.y = 0;
8259
+ }
8260
+ else {
8261
+ boxBounds.height += boxBounds.y, boxBounds.y = 0;
8262
+ boxBounds.width = data.width, boxBounds.x = 0;
8263
+ }
8260
8264
  }
8261
- if (secondLayout && data.flow && data.padding)
8262
- copyAndSpread$1(boxBounds, boxBounds, data.padding, false, data.__autoSize ? null : (data.__autoWidth ? 'width' : 'height'));
8263
8265
  this.__updateNaturalSize();
8264
8266
  }
8265
8267
  else {
8266
8268
  this.__updateRectBoxBounds();
8267
8269
  }
8268
- if (data.flow)
8269
- this.__updateContentBounds();
8270
8270
  }
8271
8271
  else {
8272
8272
  this.__updateRectBoxBounds();
@@ -8332,6 +8332,9 @@ __decorate([
8332
8332
  __decorate([
8333
8333
  dataType(false)
8334
8334
  ], Box.prototype, "resizeChildren", void 0);
8335
+ __decorate([
8336
+ dataType(false)
8337
+ ], Box.prototype, "textBox", void 0);
8335
8338
  __decorate([
8336
8339
  affectRenderBoundsType('show')
8337
8340
  ], Box.prototype, "overflow", void 0);
@@ -8861,6 +8864,9 @@ __decorate([
8861
8864
  __decorate([
8862
8865
  boundsType('top')
8863
8866
  ], Text.prototype, "verticalAlign", void 0);
8867
+ __decorate([
8868
+ boundsType(true)
8869
+ ], Text.prototype, "autoSizeAlign", void 0);
8864
8870
  __decorate([
8865
8871
  boundsType('normal')
8866
8872
  ], Text.prototype, "textWrap", void 0);
@@ -9581,9 +9587,10 @@ class Dragger {
9581
9587
  this.dragData = getDragEventData(data, data, data);
9582
9588
  this.canAnimate = this.canDragOut = true;
9583
9589
  }
9584
- getList() {
9590
+ getList(realDraggable, hover) {
9585
9591
  const { proxy } = this.interaction.selector;
9586
- return this.dragging && (!proxy || !proxy.list.length) ? (DragEvent.list || this.dragableList || emptyList) : emptyList;
9592
+ const hasProxyList = proxy && proxy.list.length, dragList = DragEvent.list || this.draggableList || emptyList;
9593
+ return this.dragging && (hasProxyList ? (realDraggable ? emptyList : new LeafList(hover ? [...proxy.list, ...proxy.dragHoverExclude] : proxy.list)) : dragList);
9587
9594
  }
9588
9595
  checkDrag(data, canDrag) {
9589
9596
  const { interaction } = this;
@@ -9608,8 +9615,8 @@ class Dragger {
9608
9615
  this.dragging = canDrag && PointerButton.left(data);
9609
9616
  if (this.dragging) {
9610
9617
  this.interaction.emit(DragEvent.START, this.dragData);
9611
- this.getDragableList(this.dragData.path);
9612
- this.setDragStartPoints(this.realDragableList = this.getList());
9618
+ this.getDraggableList(this.dragData.path);
9619
+ this.setDragStartPoints(this.realDraggableList = this.getList(true));
9613
9620
  }
9614
9621
  }
9615
9622
  }
@@ -9617,12 +9624,12 @@ class Dragger {
9617
9624
  this.dragStartPoints = {};
9618
9625
  list.forEach(leaf => this.dragStartPoints[leaf.innerId] = { x: leaf.x, y: leaf.y });
9619
9626
  }
9620
- getDragableList(path) {
9627
+ getDraggableList(path) {
9621
9628
  let leaf;
9622
9629
  for (let i = 0, len = path.length; i < len; i++) {
9623
9630
  leaf = path.list[i];
9624
- if ((leaf.__.draggable || leaf.__.editable) && leaf.__.hitSelf && !leaf.__.locked) {
9625
- this.dragableList = new LeafList(leaf);
9631
+ if ((leaf.draggable || leaf.editable) && leaf.hitSelf && !leaf.locked) {
9632
+ this.draggableList = new LeafList(leaf);
9626
9633
  break;
9627
9634
  }
9628
9635
  }
@@ -9647,7 +9654,7 @@ class Dragger {
9647
9654
  }
9648
9655
  dragReal() {
9649
9656
  const { running } = this.interaction;
9650
- const list = this.realDragableList;
9657
+ const list = this.realDraggableList;
9651
9658
  if (list.length && running) {
9652
9659
  const { totalX, totalY } = this.dragData;
9653
9660
  list.forEach(leaf => leaf.draggable && leaf.move(DragEvent.getValidMove(leaf, this.dragStartPoints[leaf.innerId], { x: totalX, y: totalY })));
@@ -9736,7 +9743,7 @@ class Dragger {
9736
9743
  this.interaction.emit(DragEvent.LEAVE, data, dragEnterPath);
9737
9744
  }
9738
9745
  dragReset() {
9739
- DragEvent.list = DragEvent.data = this.dragableList = this.dragData = this.downData = this.dragOverPath = this.dragEnterPath = null;
9746
+ DragEvent.list = DragEvent.data = this.draggableList = this.dragData = this.downData = this.dragOverPath = this.dragEnterPath = null;
9740
9747
  }
9741
9748
  checkDragOut(data) {
9742
9749
  const { interaction } = this;
@@ -9877,6 +9884,7 @@ const config = {
9877
9884
  touch: {
9878
9885
  preventDefault: true
9879
9886
  },
9887
+ multiTouch: {},
9880
9888
  cursor: true,
9881
9889
  keyEvent: true
9882
9890
  };
@@ -10003,6 +10011,8 @@ class InteractionBase {
10003
10011
  this.pointerUp(data);
10004
10012
  }
10005
10013
  multiTouch(data, list) {
10014
+ if (this.config.multiTouch.disabled)
10015
+ return;
10006
10016
  const { move, angle, scale, center } = MultiTouchHelper.getData(list);
10007
10017
  this.rotate(getRotateEventData(center, angle, data));
10008
10018
  this.zoom(getZoomEventData(center, scale, data));
@@ -10192,7 +10202,7 @@ class InteractionBase {
10192
10202
  data = this.hoverData;
10193
10203
  if (!data)
10194
10204
  return;
10195
- this.findPath(data, { exclude: this.dragger.getList(), name: PointerEvent.MOVE });
10205
+ this.findPath(data, { exclude: this.dragger.getList(false, true), name: PointerEvent.MOVE });
10196
10206
  this.hoverData = data;
10197
10207
  }
10198
10208
  updateCursor(data) {
@@ -10214,7 +10224,7 @@ class InteractionBase {
10214
10224
  const { path } = data;
10215
10225
  for (let i = 0, len = path.length; i < len; i++) {
10216
10226
  leaf = path.list[i];
10217
- cursor = leaf.syncEventer ? leaf.syncEventer.cursor : leaf.cursor;
10227
+ cursor = (leaf.syncEventer && leaf.syncEventer.cursor) || leaf.cursor;
10218
10228
  if (cursor)
10219
10229
  break;
10220
10230
  }
@@ -10396,7 +10406,7 @@ ui$2.__updateHitCanvas = function () {
10396
10406
  if (isHitPixel) {
10397
10407
  const { renderBounds } = this.__layout;
10398
10408
  const size = Platform.image.hitCanvasSize;
10399
- const scale = h.hitScale = tempBounds$1.set(0, 0, size, size).getFitMatrix(renderBounds, 0.5).a;
10409
+ const scale = h.hitScale = tempBounds$1.set(0, 0, size, size).getFitMatrix(renderBounds).a;
10400
10410
  const { x, y, width, height } = tempBounds$1.set(renderBounds).scale(scale);
10401
10411
  h.resize({ width, height, pixelRatio: 1 });
10402
10412
  h.clear();
@@ -10452,15 +10462,14 @@ ui$2.__hit = function (inner) {
10452
10462
  return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
10453
10463
  };
10454
10464
 
10455
- const ui$1 = new UI();
10456
- const rect = Rect.prototype;
10457
- rect.__updateHitCanvas = function () {
10465
+ const ui$1 = UI.prototype, rect = Rect.prototype, box$1 = Box.prototype;
10466
+ rect.__updateHitCanvas = box$1.__updateHitCanvas = function () {
10458
10467
  if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all')
10459
10468
  ui$1.__updateHitCanvas.call(this);
10460
10469
  else if (this.__hitCanvas)
10461
10470
  this.__hitCanvas = null;
10462
10471
  };
10463
- rect.__hitFill = function (inner) {
10472
+ rect.__hitFill = box$1.__hitFill = function (inner) {
10464
10473
  return this.__hitCanvas ? ui$1.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
10465
10474
  };
10466
10475
 
@@ -11064,9 +11073,10 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
11064
11073
  onLoadError(ui, event, image.error);
11065
11074
  }
11066
11075
  else {
11067
- ignoreRender(ui, true);
11068
- if (firstUse)
11076
+ if (firstUse) {
11077
+ ignoreRender(ui, true);
11069
11078
  onLoad(ui, event);
11079
+ }
11070
11080
  leafPaint.loadId = image.load(() => {
11071
11081
  ignoreRender(ui, false);
11072
11082
  if (!ui.destroyed) {
@@ -11678,11 +11688,12 @@ const { trimRight } = TextRowHelper;
11678
11688
  const { Letter, Single, Before, After, Symbol, Break } = CharType;
11679
11689
  let word, row, wordWidth, rowWidth, realWidth;
11680
11690
  let char, charWidth, startCharSize, charSize, charType, lastCharType, langBreak, afterBreak, paraStart;
11681
- let textDrawData, rows = [], bounds;
11691
+ let textDrawData, rows = [], bounds, findMaxWidth;
11682
11692
  function createRows(drawData, content, style) {
11683
11693
  textDrawData = drawData;
11684
11694
  rows = drawData.rows;
11685
11695
  bounds = drawData.bounds;
11696
+ findMaxWidth = !bounds.width && !style.autoSizeAlign;
11686
11697
  const { __letterSpacing, paraIndent, textCase } = style;
11687
11698
  const { canvas } = Platform;
11688
11699
  const { width, height } = bounds;
@@ -11767,7 +11778,10 @@ function createRows(drawData, content, style) {
11767
11778
  else {
11768
11779
  content.split('\n').forEach(content => {
11769
11780
  textDrawData.paraNumber++;
11770
- rows.push({ x: paraIndent || 0, text: content, width: canvas.measureText(content).width, paraStart: true });
11781
+ rowWidth = canvas.measureText(content).width;
11782
+ rows.push({ x: paraIndent || 0, text: content, width: rowWidth, paraStart: true });
11783
+ if (findMaxWidth)
11784
+ setMaxWidth();
11771
11785
  });
11772
11786
  }
11773
11787
  }
@@ -11798,10 +11812,16 @@ function addRow() {
11798
11812
  row.width = rowWidth;
11799
11813
  if (bounds.width)
11800
11814
  trimRight(row);
11815
+ else if (findMaxWidth)
11816
+ setMaxWidth();
11801
11817
  rows.push(row);
11802
11818
  row = { words: [] };
11803
11819
  rowWidth = 0;
11804
11820
  }
11821
+ function setMaxWidth() {
11822
+ if (rowWidth > (textDrawData.maxWidth || 0))
11823
+ textDrawData.maxWidth = rowWidth;
11824
+ }
11805
11825
 
11806
11826
  const CharMode = 0;
11807
11827
  const WordMode = 1;
@@ -11873,34 +11893,32 @@ function toChar(data, charX, rowData, isOverflow) {
11873
11893
 
11874
11894
  function layoutText(drawData, style) {
11875
11895
  const { rows, bounds } = drawData;
11876
- const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing } = style;
11896
+ const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing, autoSizeAlign } = style;
11877
11897
  let { x, y, width, height } = bounds, realHeight = __lineHeight * rows.length + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
11878
11898
  let starY = __baseLine;
11879
11899
  if (__clipText && realHeight > height) {
11880
11900
  realHeight = Math.max(height, __lineHeight);
11881
11901
  drawData.overflow = rows.length;
11882
11902
  }
11883
- else {
11903
+ else if (height || autoSizeAlign) {
11884
11904
  switch (verticalAlign) {
11885
11905
  case 'middle':
11886
11906
  y += (height - realHeight) / 2;
11887
11907
  break;
11888
- case 'bottom':
11889
- y += (height - realHeight);
11908
+ case 'bottom': y += (height - realHeight);
11890
11909
  }
11891
11910
  }
11892
11911
  starY += y;
11893
- let row, rowX, rowWidth;
11912
+ let row, rowX, rowWidth, layoutWidth = (width || autoSizeAlign) ? width : drawData.maxWidth;
11894
11913
  for (let i = 0, len = rows.length; i < len; i++) {
11895
11914
  row = rows[i];
11896
11915
  row.x = x;
11897
11916
  if (row.width < width || (row.width > width && !__clipText)) {
11898
11917
  switch (textAlign) {
11899
11918
  case 'center':
11900
- row.x += (width - row.width) / 2;
11919
+ row.x += (layoutWidth - row.width) / 2;
11901
11920
  break;
11902
- case 'right':
11903
- row.x += width - row.width;
11921
+ case 'right': row.x += layoutWidth - row.width;
11904
11922
  }
11905
11923
  }
11906
11924
  if (row.paraStart && paraSpacing && i > 0)
@@ -12005,14 +12023,14 @@ function getDrawData(content, style) {
12005
12023
  let height = style.__getInput('height') || 0;
12006
12024
  const { textDecoration, __font, __padding: padding } = style;
12007
12025
  if (padding) {
12008
- if (width) {
12026
+ if (width)
12027
+ x = padding[left], width -= (padding[right] + padding[left]);
12028
+ else if (!style.autoSizeAlign)
12009
12029
  x = padding[left];
12010
- width -= (padding[right] + padding[left]);
12011
- }
12012
- if (height) {
12030
+ if (height)
12031
+ y = padding[top], height -= (padding[top] + padding[bottom]);
12032
+ else if (!style.autoSizeAlign)
12013
12033
  y = padding[top];
12014
- height -= (padding[top] + padding[bottom]);
12015
- }
12016
12034
  }
12017
12035
  const drawData = {
12018
12036
  bounds: { x, y, width, height },
@@ -12032,22 +12050,20 @@ function getDrawData(content, style) {
12032
12050
  return drawData;
12033
12051
  }
12034
12052
  function padAutoText(padding, drawData, style, width, height) {
12035
- if (!width) {
12053
+ if (!width && style.autoSizeAlign) {
12036
12054
  switch (style.textAlign) {
12037
12055
  case 'left':
12038
12056
  offsetText(drawData, 'x', padding[left]);
12039
12057
  break;
12040
- case 'right':
12041
- offsetText(drawData, 'x', -padding[right]);
12058
+ case 'right': offsetText(drawData, 'x', -padding[right]);
12042
12059
  }
12043
12060
  }
12044
- if (!height) {
12061
+ if (!height && style.autoSizeAlign) {
12045
12062
  switch (style.verticalAlign) {
12046
12063
  case 'top':
12047
12064
  offsetText(drawData, 'y', padding[top]);
12048
12065
  break;
12049
- case 'bottom':
12050
- offsetText(drawData, 'y', -padding[bottom]);
12066
+ case 'bottom': offsetText(drawData, 'y', -padding[bottom]);
12051
12067
  }
12052
12068
  }
12053
12069
  }