@leafer-ui/worker 1.0.4 → 1.0.6

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
@@ -555,6 +555,12 @@ var LeaferUI = (function (exports) {
555
555
  to.y = t.y + sin$4(r) * distance;
556
556
  return to;
557
557
  },
558
+ toNumberPoints(originPoints) {
559
+ let points = originPoints;
560
+ if (typeof originPoints[0] === 'object')
561
+ points = [], originPoints.forEach(p => points.push(p.x, p.y));
562
+ return points;
563
+ },
558
564
  reset(t) {
559
565
  P$5.reset(t);
560
566
  }
@@ -1545,7 +1551,10 @@ var LeaferUI = (function (exports) {
1545
1551
 
1546
1552
  class LeafData {
1547
1553
  get __useNaturalRatio() { return true; }
1548
- get __isLinePath() { return this.path && this.path.length === 6; }
1554
+ get __isLinePath() {
1555
+ const { path } = this;
1556
+ return path && path.length === 6 && path[0] === 1;
1557
+ }
1549
1558
  get __blendMode() {
1550
1559
  if (this.eraser && this.eraser !== 'path')
1551
1560
  return 'destination-out';
@@ -2308,11 +2317,12 @@ var LeaferUI = (function (exports) {
2308
2317
 
2309
2318
  const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$3, PI: PI$2, sqrt: sqrt$1, pow } = Math;
2310
2319
  const { setPoint: setPoint$2, addPoint: addPoint$2 } = TwoPointBoundsHelper;
2311
- const { set } = PointHelper;
2320
+ const { set, toNumberPoints } = PointHelper;
2312
2321
  const { M: M$5, L: L$6, C: C$5, Q: Q$4, Z: Z$5 } = PathCommandMap;
2313
2322
  const tempPoint$2 = {};
2314
2323
  const BezierHelper = {
2315
- points(data, points, curve, close) {
2324
+ points(data, originPoints, curve, close) {
2325
+ let points = toNumberPoints(originPoints);
2316
2326
  data.push(M$5, points[0], points[1]);
2317
2327
  if (curve && points.length > 5) {
2318
2328
  let aX, aY, bX, bY, cX, cY, c1X, c1Y, c2X, c2Y;
@@ -2821,6 +2831,27 @@ var LeaferUI = (function (exports) {
2821
2831
  }
2822
2832
  return data;
2823
2833
  },
2834
+ objectToCanvasData(list) {
2835
+ const data = [];
2836
+ list.forEach(item => {
2837
+ switch (item.name) {
2838
+ case 'M':
2839
+ data.push(M$4, item.x, item.y);
2840
+ break;
2841
+ case 'L':
2842
+ data.push(L$5, item.x, item.y);
2843
+ break;
2844
+ case 'C':
2845
+ data.push(C$4, item.x1, item.y1, item.x2, item.y2, item.x, item.y);
2846
+ break;
2847
+ case 'Q':
2848
+ data.push(Q$3, item.x1, item.y1, item.x, item.y);
2849
+ break;
2850
+ case 'Z': data.push(Z$4);
2851
+ }
2852
+ });
2853
+ return data;
2854
+ },
2824
2855
  copyData(data, old, index, count) {
2825
2856
  for (let i = index, end = index + count; i < end; i++) {
2826
2857
  data.push(old[i]);
@@ -4758,6 +4789,7 @@ var LeaferUI = (function (exports) {
4758
4789
  }
4759
4790
  }
4760
4791
  RenderEvent.REQUEST = 'render.request';
4792
+ RenderEvent.CHILD_START = 'render.child_start';
4761
4793
  RenderEvent.START = 'render.start';
4762
4794
  RenderEvent.BEFORE = 'render.before';
4763
4795
  RenderEvent.RENDER = 'render';
@@ -4933,7 +4965,7 @@ var LeaferUI = (function (exports) {
4933
4965
  const debug$7 = Debug.get('setAttr');
4934
4966
  const LeafDataProxy = {
4935
4967
  __setAttr(name, newValue, checkFiniteNumber) {
4936
- if (this.leafer && this.leafer.created) {
4968
+ if (this.leaferIsCreated) {
4937
4969
  const oldValue = this.__.__getInput(name);
4938
4970
  if (checkFiniteNumber && !isFinite(newValue) && newValue !== undefined) {
4939
4971
  debug$7.warn(this.innerName, name, newValue);
@@ -5005,7 +5037,7 @@ var LeaferUI = (function (exports) {
5005
5037
 
5006
5038
  const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2 } = LeafHelper;
5007
5039
  const { updateBounds: updateBounds$1 } = BranchHelper;
5008
- const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$2, copy: copy$5 } = BoundsHelper;
5040
+ const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$5 } = BoundsHelper;
5009
5041
  const { toBounds: toBounds$2 } = PathBounds;
5010
5042
  const LeafBounds = {
5011
5043
  __updateWorldBounds() {
@@ -5088,7 +5120,7 @@ var LeaferUI = (function (exports) {
5088
5120
  const b = this.__layout.boxBounds;
5089
5121
  const data = this.__;
5090
5122
  if (data.__pathInputed) {
5091
- toBounds$2(data.__pathForRender, b);
5123
+ toBounds$2(data.path, b);
5092
5124
  }
5093
5125
  else {
5094
5126
  b.x = 0;
@@ -5100,7 +5132,7 @@ var LeaferUI = (function (exports) {
5100
5132
  __updateAutoLayout() {
5101
5133
  this.__layout.matrixChanged = true;
5102
5134
  if (this.isBranch) {
5103
- if (this.leafer && this.leafer.ready)
5135
+ if (this.leaferIsReady)
5104
5136
  this.leafer.layouter.addExtra(this);
5105
5137
  if (this.__.flow) {
5106
5138
  if (this.__layout.boxChanged)
@@ -5126,11 +5158,11 @@ var LeaferUI = (function (exports) {
5126
5158
  },
5127
5159
  __updateStrokeBounds() {
5128
5160
  const layout = this.__layout;
5129
- copyAndSpread$2(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
5161
+ copyAndSpread$1(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
5130
5162
  },
5131
5163
  __updateRenderBounds() {
5132
5164
  const layout = this.__layout;
5133
- layout.renderSpread > 0 ? copyAndSpread$2(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$5(layout.renderBounds, layout.strokeBounds);
5165
+ layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$5(layout.renderBounds, layout.strokeBounds);
5134
5166
  }
5135
5167
  };
5136
5168
 
@@ -5161,7 +5193,7 @@ var LeaferUI = (function (exports) {
5161
5193
  if (this.__worldOpacity) {
5162
5194
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
5163
5195
  this.__drawRenderPath(canvas);
5164
- this.__.windingRule ? canvas.clip(this.__.windingRule) : canvas.clip();
5196
+ this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
5165
5197
  }
5166
5198
  },
5167
5199
  __updateWorldOpacity() {
@@ -5235,6 +5267,8 @@ var LeaferUI = (function (exports) {
5235
5267
  get innerName() { return this.__.name || this.tag + this.innerId; }
5236
5268
  get __DataProcessor() { return LeafData; }
5237
5269
  get __LayoutProcessor() { return LeafLayout; }
5270
+ get leaferIsCreated() { return this.leafer && this.leafer.created; }
5271
+ get leaferIsReady() { return this.leafer && this.leafer.ready; }
5238
5272
  get isLeafer() { return false; }
5239
5273
  get isBranch() { return false; }
5240
5274
  get isBranchLeaf() { return false; }
@@ -5676,10 +5710,17 @@ var LeaferUI = (function (exports) {
5676
5710
  add(child, index) {
5677
5711
  if (child === this)
5678
5712
  return;
5713
+ const noIndex = index === undefined;
5714
+ if (!child.__) {
5715
+ if (child instanceof Array)
5716
+ return child.forEach(item => { this.add(item, index); noIndex || index++; });
5717
+ else
5718
+ child = UICreator.get(child.tag, child);
5719
+ }
5679
5720
  if (child.parent)
5680
5721
  child.parent.remove(child);
5681
5722
  child.parent = this;
5682
- index === undefined ? this.children.push(child) : this.children.splice(index, 0, child);
5723
+ noIndex ? this.children.push(child) : this.children.splice(index, 0, child);
5683
5724
  if (child.isBranch)
5684
5725
  this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
5685
5726
  child.__layout.boxChanged || child.__layout.boxChange();
@@ -5693,15 +5734,17 @@ var LeaferUI = (function (exports) {
5693
5734
  }
5694
5735
  this.__layout.affectChildrenSort && this.__layout.childrenSortChange();
5695
5736
  }
5696
- addMany(...children) {
5697
- children.forEach(child => this.add(child));
5698
- }
5737
+ addMany(...children) { this.add(children); }
5699
5738
  remove(child, destroy) {
5700
5739
  if (child) {
5701
- if (child.animationOut)
5702
- child.__runAnimation('out', () => this.__remove(child, destroy));
5740
+ if (child.__) {
5741
+ if (child.animationOut)
5742
+ child.__runAnimation('out', () => this.__remove(child, destroy));
5743
+ else
5744
+ this.__remove(child, destroy);
5745
+ }
5703
5746
  else
5704
- this.__remove(child, destroy);
5747
+ this.find(child).forEach(item => this.remove(item, destroy));
5705
5748
  }
5706
5749
  else if (child === undefined) {
5707
5750
  super.remove(null, destroy);
@@ -5919,7 +5962,7 @@ var LeaferUI = (function (exports) {
5919
5962
  }
5920
5963
  }
5921
5964
 
5922
- const version = "1.0.4";
5965
+ const version = "1.0.6";
5923
5966
 
5924
5967
  class LeaferCanvas extends LeaferCanvasBase {
5925
5968
  get allowBackgroundColor() { return true; }
@@ -6388,6 +6431,7 @@ var LeaferUI = (function (exports) {
6388
6431
  this.totalBounds = new Bounds();
6389
6432
  debug$5.log(target.innerName, '--->');
6390
6433
  try {
6434
+ target.app.emit(RenderEvent.CHILD_START, target);
6391
6435
  this.emitRender(RenderEvent.START);
6392
6436
  this.renderOnce(callback);
6393
6437
  this.emitRender(RenderEvent.END, this.totalBounds);
@@ -6685,7 +6729,7 @@ var LeaferUI = (function (exports) {
6685
6729
  if (child.isBranch) {
6686
6730
  if (hit || child.__ignoreHitWorld) {
6687
6731
  this.eachFind(child.children, child.__onlyHitMask);
6688
- if (child.isBranchLeaf && !this.findList.length)
6732
+ if (child.isBranchLeaf)
6689
6733
  this.hitChild(child, point);
6690
6734
  }
6691
6735
  }
@@ -6898,6 +6942,13 @@ var LeaferUI = (function (exports) {
6898
6942
 
6899
6943
  const TextConvert = {};
6900
6944
  const ColorConvert = {};
6945
+ const UnitConvert = {
6946
+ number(value, percentRefer) {
6947
+ if (typeof value === 'object')
6948
+ return value.type === 'percent' ? value.value * percentRefer : value.value;
6949
+ return value;
6950
+ }
6951
+ };
6901
6952
  const PathArrow = {};
6902
6953
  const Paint = {};
6903
6954
  const PaintImage = {};
@@ -6918,7 +6969,7 @@ var LeaferUI = (function (exports) {
6918
6969
  }
6919
6970
  };
6920
6971
 
6921
- const { parse } = PathConvert;
6972
+ const { parse, objectToCanvasData } = PathConvert;
6922
6973
  const emptyPaint = {};
6923
6974
  const debug$4 = Debug.get('UIData');
6924
6975
  class UIData extends LeafData {
@@ -6932,10 +6983,11 @@ var LeaferUI = (function (exports) {
6932
6983
  scaleX = -scaleX;
6933
6984
  return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
6934
6985
  }
6935
- else {
6986
+ else
6936
6987
  return strokeWidth;
6937
- }
6938
6988
  }
6989
+ get __hasStroke() { return this.stroke && this.strokeWidth; }
6990
+ get __clipAfterFill() { return (this.cornerRadius || this.__pathInputed); }
6939
6991
  get __autoWidth() { return !this._width; }
6940
6992
  get __autoHeight() { return !this._height; }
6941
6993
  get __autoSide() { return !this._width || !this._height; }
@@ -6952,9 +7004,8 @@ var LeaferUI = (function (exports) {
6952
7004
  this.__leaf.scaleX *= -1;
6953
7005
  debug$4.warn('width < 0, instead -scaleX ', this);
6954
7006
  }
6955
- else {
7007
+ else
6956
7008
  this._width = value;
6957
- }
6958
7009
  }
6959
7010
  setHeight(value) {
6960
7011
  if (value < 0) {
@@ -6962,9 +7013,8 @@ var LeaferUI = (function (exports) {
6962
7013
  this.__leaf.scaleY *= -1;
6963
7014
  debug$4.warn('height < 0, instead -scaleY', this);
6964
7015
  }
6965
- else {
7016
+ else
6966
7017
  this._height = value;
6967
- }
6968
7018
  }
6969
7019
  setFill(value) {
6970
7020
  if (this.__naturalWidth)
@@ -7005,9 +7055,10 @@ var LeaferUI = (function (exports) {
7005
7055
  }
7006
7056
  }
7007
7057
  setPath(value) {
7008
- if (typeof value === 'string') {
7058
+ const isString = typeof value === 'string';
7059
+ if (isString || (value && typeof value[0] === 'object')) {
7009
7060
  this.__setInput('path', value);
7010
- this._path = parse(value);
7061
+ this._path = isString ? parse(value) : objectToCanvasData(value);
7011
7062
  }
7012
7063
  else {
7013
7064
  if (this.__input)
@@ -7022,12 +7073,8 @@ var LeaferUI = (function (exports) {
7022
7073
  value = value.filter((item) => item.visible !== false);
7023
7074
  this._shadow = value.length ? value : null;
7024
7075
  }
7025
- else if (value) {
7026
- this._shadow = value.visible === false ? null : [value];
7027
- }
7028
- else {
7029
- this._shadow = null;
7030
- }
7076
+ else
7077
+ this._shadow = value && value.visible !== false ? [value] : null;
7031
7078
  }
7032
7079
  setInnerShadow(value) {
7033
7080
  this.__setInput('innerShadow', value);
@@ -7036,12 +7083,8 @@ var LeaferUI = (function (exports) {
7036
7083
  value = value.filter((item) => item.visible !== false);
7037
7084
  this._innerShadow = value.length ? value : null;
7038
7085
  }
7039
- else if (value) {
7040
- this._innerShadow = value.visible === false ? null : [value];
7041
- }
7042
- else {
7043
- this._innerShadow = null;
7044
- }
7086
+ else
7087
+ this._innerShadow = value && value.visible !== false ? [value] : null;
7045
7088
  }
7046
7089
  __computePaint() {
7047
7090
  const { fill, stroke } = this.__input;
@@ -7052,24 +7095,19 @@ var LeaferUI = (function (exports) {
7052
7095
  this.__needComputePaint = false;
7053
7096
  }
7054
7097
  }
7055
- const UnitConvert = {
7056
- number(value, percentRefer) {
7057
- if (typeof value === 'object')
7058
- return value.type === 'percent' ? value.value * percentRefer : value.value;
7059
- return value;
7060
- }
7061
- };
7062
7098
 
7063
7099
  class GroupData extends UIData {
7064
7100
  }
7065
7101
 
7066
7102
  class BoxData extends GroupData {
7067
7103
  get __boxStroke() { return !this.__pathInputed; }
7104
+ get __drawAfterFill() { return this.overflow === 'hide' && this.__clipAfterFill && this.__leaf.children.length; }
7105
+ get __clipAfterFill() { return this.__leaf.isOverflow || super.__clipAfterFill; }
7068
7106
  }
7069
7107
 
7070
7108
  class LeaferData extends GroupData {
7071
- __getInputData() {
7072
- const data = super.__getInputData();
7109
+ __getInputData(names, options) {
7110
+ const data = super.__getInputData(names, options);
7073
7111
  canvasSizeAttrs.forEach(key => delete data[key]);
7074
7112
  return data;
7075
7113
  }
@@ -7096,6 +7134,7 @@ var LeaferUI = (function (exports) {
7096
7134
  }
7097
7135
 
7098
7136
  class PathData extends UIData {
7137
+ get __pathInputed() { return 2; }
7099
7138
  }
7100
7139
 
7101
7140
  class PenData extends GroupData {
@@ -7142,16 +7181,18 @@ var LeaferUI = (function (exports) {
7142
7181
  delete data.fill;
7143
7182
  return data;
7144
7183
  }
7145
- __getInputData() {
7146
- const data = super.__getInputData();
7184
+ __getInputData(names, options) {
7185
+ const data = super.__getInputData(names, options);
7147
7186
  delete data.fill;
7148
7187
  return data;
7149
7188
  }
7150
7189
  }
7151
7190
 
7152
7191
  class CanvasData extends RectData {
7153
- __getInputData() {
7154
- const data = super.__getInputData();
7192
+ get __isCanvas() { return true; }
7193
+ get __drawAfterFill() { return true; }
7194
+ __getInputData(names, options) {
7195
+ const data = super.__getInputData(names, options);
7155
7196
  data.url = this.__leaf.canvas.toDataURL('image/png');
7156
7197
  return data;
7157
7198
  }
@@ -7178,16 +7219,12 @@ var LeaferUI = (function (exports) {
7178
7219
  let width = 0;
7179
7220
  const { shadow, innerShadow, blur, backgroundBlur } = this.__;
7180
7221
  if (shadow)
7181
- shadow.forEach(item => {
7182
- width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5);
7183
- });
7222
+ shadow.forEach(item => width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5));
7184
7223
  if (blur)
7185
7224
  width = Math.max(width, blur);
7186
7225
  let shapeWidth = width = Math.ceil(width);
7187
7226
  if (innerShadow)
7188
- innerShadow.forEach(item => {
7189
- shapeWidth = Math.max(shapeWidth, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5);
7190
- });
7227
+ innerShadow.forEach(item => shapeWidth = Math.max(shapeWidth, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5));
7191
7228
  if (backgroundBlur)
7192
7229
  shapeWidth = Math.max(shapeWidth, backgroundBlur);
7193
7230
  this.__layout.renderShapeSpread = shapeWidth;
@@ -7269,6 +7306,16 @@ var LeaferUI = (function (exports) {
7269
7306
  if (stroke && !ignoreStroke)
7270
7307
  this.__.__pixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
7271
7308
  }
7309
+ },
7310
+ __drawAfterFill(canvas, options) {
7311
+ if (this.__.__clipAfterFill) {
7312
+ canvas.save();
7313
+ this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
7314
+ this.__drawContent(canvas, options);
7315
+ canvas.restore();
7316
+ }
7317
+ else
7318
+ this.__drawContent(canvas, options);
7272
7319
  }
7273
7320
  };
7274
7321
  function drawFast(ui, canvas, options) {
@@ -7335,8 +7382,8 @@ var LeaferUI = (function (exports) {
7335
7382
  return pen;
7336
7383
  }
7337
7384
  get editConfig() { return undefined; }
7338
- get editOuter() { return this.__.__isLinePath ? 'LineEditTool' : 'EditTool'; }
7339
- get editInner() { return 'PathEditor'; }
7385
+ get editOuter() { return ''; }
7386
+ get editInner() { return ''; }
7340
7387
  constructor(data) {
7341
7388
  super(data);
7342
7389
  }
@@ -7347,9 +7394,8 @@ var LeaferUI = (function (exports) {
7347
7394
  Object.assign(this, data);
7348
7395
  this.lockNormalStyle = false;
7349
7396
  }
7350
- else {
7397
+ else
7351
7398
  Object.assign(this, data);
7352
- }
7353
7399
  }
7354
7400
  get(name) {
7355
7401
  return typeof name === 'string' ? this.__.__getInput(name) : this.__.__getInputData(name);
@@ -7395,12 +7441,7 @@ var LeaferUI = (function (exports) {
7395
7441
  this.__drawPathByData(canvas, this.__.path);
7396
7442
  }
7397
7443
  __drawPathByData(drawer, data) {
7398
- if (data) {
7399
- PathDrawer.drawPathByData(drawer, data);
7400
- }
7401
- else {
7402
- this.__drawPathByBox(drawer);
7403
- }
7444
+ data ? PathDrawer.drawPathByData(drawer, data) : this.__drawPathByBox(drawer);
7404
7445
  }
7405
7446
  __drawPathByBox(drawer) {
7406
7447
  const { x, y, width, height } = this.__layout.boxBounds;
@@ -7408,9 +7449,8 @@ var LeaferUI = (function (exports) {
7408
7449
  const { cornerRadius } = this.__;
7409
7450
  drawer.roundRect(x, y, width, height, typeof cornerRadius === 'number' ? [cornerRadius] : cornerRadius);
7410
7451
  }
7411
- else {
7452
+ else
7412
7453
  drawer.rect(x, y, width, height);
7413
- }
7414
7454
  }
7415
7455
  animate(_keyframe, _options, _type, _isTemp) {
7416
7456
  return needPlugin('animate');
@@ -7657,23 +7697,13 @@ var LeaferUI = (function (exports) {
7657
7697
  if (data.children) {
7658
7698
  const { children } = data;
7659
7699
  delete data.children;
7660
- if (!this.children) {
7661
- this.__setBranch();
7662
- }
7663
- else {
7664
- this.clear();
7665
- }
7700
+ this.children ? this.clear() : this.__setBranch();
7666
7701
  super.set(data, isTemp);
7667
- let child;
7668
- children.forEach(childData => {
7669
- child = childData.__ ? childData : UICreator.get(childData.tag, childData);
7670
- this.add(child);
7671
- });
7702
+ children.forEach(child => this.add(child));
7672
7703
  data.children = children;
7673
7704
  }
7674
- else {
7705
+ else
7675
7706
  super.set(data, isTemp);
7676
- }
7677
7707
  }
7678
7708
  toJSON(options) {
7679
7709
  const data = super.toJSON(options);
@@ -8093,10 +8123,9 @@ var LeaferUI = (function (exports) {
8093
8123
  registerUI()
8094
8124
  ], exports.Rect);
8095
8125
 
8096
- const rect$1 = exports.Rect.prototype;
8097
- const group$1 = exports.Group.prototype;
8126
+ const { copy: copy$3, add, includes: includes$1 } = BoundsHelper;
8127
+ const rect$1 = exports.Rect.prototype, group$1 = exports.Group.prototype;
8098
8128
  const childrenRenderBounds = {};
8099
- const { copy: copy$3, add, includes: includes$1, copyAndSpread: copyAndSpread$1 } = BoundsHelper;
8100
8129
  exports.Box = class Box extends exports.Group {
8101
8130
  get __tag() { return 'Box'; }
8102
8131
  get isBranchLeaf() { return true; }
@@ -8106,37 +8135,31 @@ var LeaferUI = (function (exports) {
8106
8135
  }
8107
8136
  __updateStrokeSpread() { return 0; }
8108
8137
  __updateRectRenderSpread() { return 0; }
8109
- __updateRenderSpread() {
8110
- return this.__updateRectRenderSpread() || -1;
8111
- }
8138
+ __updateRenderSpread() { return this.__updateRectRenderSpread() || -1; }
8112
8139
  __updateRectBoxBounds() { }
8113
- __updateBoxBounds(secondLayout) {
8140
+ __updateBoxBounds(_secondLayout) {
8114
8141
  const data = this.__;
8115
8142
  if (this.children.length) {
8116
8143
  if (data.__autoSide) {
8117
- if (this.leafer && this.leafer.ready)
8118
- this.leafer.layouter.addExtra(this);
8119
8144
  super.__updateBoxBounds();
8120
8145
  const { boxBounds } = this.__layout;
8121
8146
  if (!data.__autoSize) {
8122
- if (data.__autoWidth)
8123
- boxBounds.width += boxBounds.x, boxBounds.height = data.height, boxBounds.y = boxBounds.x = 0;
8124
- else
8125
- boxBounds.height += boxBounds.y, boxBounds.width = data.width, boxBounds.x = boxBounds.y = 0;
8147
+ if (data.__autoWidth) {
8148
+ boxBounds.width += boxBounds.x, boxBounds.x = 0;
8149
+ boxBounds.height = data.height, boxBounds.y = 0;
8150
+ }
8151
+ else {
8152
+ boxBounds.height += boxBounds.y, boxBounds.y = 0;
8153
+ boxBounds.width = data.width, boxBounds.x = 0;
8154
+ }
8126
8155
  }
8127
- if (secondLayout && data.flow && data.padding)
8128
- copyAndSpread$1(boxBounds, boxBounds, data.padding, false, data.__autoSize ? null : (data.__autoWidth ? 'width' : 'height'));
8129
8156
  this.__updateNaturalSize();
8130
8157
  }
8131
- else {
8158
+ else
8132
8159
  this.__updateRectBoxBounds();
8133
- }
8134
- if (data.flow)
8135
- this.__updateContentBounds();
8136
8160
  }
8137
- else {
8161
+ else
8138
8162
  this.__updateRectBoxBounds();
8139
- }
8140
8163
  }
8141
8164
  __updateStrokeBounds() { }
8142
8165
  __updateRenderBounds() {
@@ -8146,14 +8169,13 @@ var LeaferUI = (function (exports) {
8146
8169
  super.__updateRenderBounds();
8147
8170
  copy$3(childrenRenderBounds, renderBounds);
8148
8171
  this.__updateRectRenderBounds();
8149
- isOverflow = !includes$1(renderBounds, childrenRenderBounds) || !this.pathInputed || !this.__.cornerRadius;
8172
+ isOverflow = !includes$1(renderBounds, childrenRenderBounds);
8173
+ if (isOverflow && this.__.overflow !== 'hide')
8174
+ add(renderBounds, childrenRenderBounds);
8150
8175
  }
8151
- else {
8176
+ else
8152
8177
  this.__updateRectRenderBounds();
8153
- }
8154
- this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
8155
- if (!(this.__.__drawAfterFill = this.__.overflow === 'hide') && isOverflow)
8156
- add(renderBounds, childrenRenderBounds);
8178
+ !this.isOverflow !== !isOverflow && (this.isOverflow = isOverflow);
8157
8179
  }
8158
8180
  __updateRectRenderBounds() { }
8159
8181
  __updateRectChange() { }
@@ -8173,20 +8195,9 @@ var LeaferUI = (function (exports) {
8173
8195
  this.__renderGroup(canvas, options);
8174
8196
  }
8175
8197
  }
8176
- __drawAfterFill(canvas, options) {
8177
- const { length } = this.children;
8178
- if (this.isOverflow) {
8179
- canvas.save();
8180
- canvas.clip();
8181
- if (length)
8182
- this.__renderGroup(canvas, options);
8183
- canvas.restore();
8184
- }
8185
- else {
8186
- if (length)
8187
- this.__renderGroup(canvas, options);
8188
- }
8189
- if (this.__.stroke && length) {
8198
+ __drawContent(canvas, options) {
8199
+ this.__renderGroup(canvas, options);
8200
+ if (this.__.__hasStroke) {
8190
8201
  canvas.setWorld(this.__nowWorld);
8191
8202
  this.__drawRenderPath(canvas);
8192
8203
  }
@@ -8198,6 +8209,9 @@ var LeaferUI = (function (exports) {
8198
8209
  __decorate([
8199
8210
  dataType(false)
8200
8211
  ], exports.Box.prototype, "resizeChildren", void 0);
8212
+ __decorate([
8213
+ dataType(false)
8214
+ ], exports.Box.prototype, "textBox", void 0);
8201
8215
  __decorate([
8202
8216
  affectRenderBoundsType('show')
8203
8217
  ], exports.Box.prototype, "overflow", void 0);
@@ -8347,17 +8361,15 @@ var LeaferUI = (function (exports) {
8347
8361
  if (data.__useArrow)
8348
8362
  PathArrow.addArrows(this, false);
8349
8363
  }
8350
- else {
8364
+ else
8351
8365
  super.__updateRenderPath();
8352
- }
8353
8366
  }
8354
8367
  __updateBoxBounds() {
8355
8368
  if (this.points) {
8356
8369
  toBounds$1(this.__.__pathForRender, this.__layout.boxBounds);
8357
8370
  }
8358
- else {
8371
+ else
8359
8372
  super.__updateBoxBounds();
8360
- }
8361
8373
  }
8362
8374
  };
8363
8375
  __decorate([
@@ -8495,7 +8507,6 @@ var LeaferUI = (function (exports) {
8495
8507
  super(data);
8496
8508
  this.canvas = Creator.canvas(this.__);
8497
8509
  this.context = this.canvas.context;
8498
- this.__.__isCanvas = this.__.__drawAfterFill = true;
8499
8510
  if (data && data.url)
8500
8511
  this.drawImage(data.url);
8501
8512
  }
@@ -8508,8 +8519,7 @@ var LeaferUI = (function (exports) {
8508
8519
  });
8509
8520
  }
8510
8521
  draw(ui, offset, scale, rotation) {
8511
- ui.__layout.update();
8512
- const matrix = new Matrix(ui.__world).invert();
8522
+ const matrix = new Matrix(ui.worldTransform).invert();
8513
8523
  const m = new Matrix();
8514
8524
  if (offset)
8515
8525
  m.translate(offset.x, offset.y);
@@ -8524,17 +8534,9 @@ var LeaferUI = (function (exports) {
8524
8534
  paint() {
8525
8535
  this.forceRender();
8526
8536
  }
8527
- __drawAfterFill(canvas, _options) {
8528
- const { width, height, cornerRadius } = this.__, { view } = this.canvas;
8529
- if (cornerRadius || this.pathInputed) {
8530
- canvas.save();
8531
- canvas.clip();
8532
- canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
8533
- canvas.restore();
8534
- }
8535
- else {
8536
- canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
8537
- }
8537
+ __drawContent(canvas, _options) {
8538
+ const { width, height } = this.__, { view } = this.canvas;
8539
+ canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
8538
8540
  }
8539
8541
  __updateSize() {
8540
8542
  const { canvas } = this;
@@ -8578,7 +8580,6 @@ var LeaferUI = (function (exports) {
8578
8580
  const { copyAndSpread, includes, isSame: isSame$1, spread, setList } = BoundsHelper;
8579
8581
  exports.Text = class Text extends exports.UI {
8580
8582
  get __tag() { return 'Text'; }
8581
- get editInner() { return 'TextEditor'; }
8582
8583
  get textDrawData() {
8583
8584
  this.__layout.update();
8584
8585
  return this.__.__textDrawData;
@@ -8727,6 +8728,9 @@ var LeaferUI = (function (exports) {
8727
8728
  __decorate([
8728
8729
  boundsType('top')
8729
8730
  ], exports.Text.prototype, "verticalAlign", void 0);
8731
+ __decorate([
8732
+ boundsType(true)
8733
+ ], exports.Text.prototype, "autoSizeAlign", void 0);
8730
8734
  __decorate([
8731
8735
  boundsType('normal')
8732
8736
  ], exports.Text.prototype, "textWrap", void 0);
@@ -8741,7 +8745,6 @@ var LeaferUI = (function (exports) {
8741
8745
  get __tag() { return 'Path'; }
8742
8746
  constructor(data) {
8743
8747
  super(data);
8744
- this.__.__pathInputed = 2;
8745
8748
  }
8746
8749
  };
8747
8750
  __decorate([
@@ -8824,21 +8827,17 @@ var LeaferUI = (function (exports) {
8824
8827
  this.tree = this.addLeafer(tree);
8825
8828
  if (sky || editor)
8826
8829
  this.sky = this.addLeafer(sky || { type: 'draw', usePartRender: false });
8827
- if (editor) {
8828
- this.editor = Creator.editor(editor);
8829
- this.sky.add(this.editor);
8830
- }
8830
+ if (editor)
8831
+ this.sky.add(this.editor = Creator.editor(editor));
8831
8832
  }
8832
8833
  }
8833
8834
  __setApp() {
8834
8835
  const { canvas } = this;
8835
8836
  const { realCanvas, view } = this.config;
8836
- if (realCanvas || view === this.canvas.view || !canvas.parentView) {
8837
+ if (realCanvas || view === this.canvas.view || !canvas.parentView)
8837
8838
  this.realCanvas = true;
8838
- }
8839
- else {
8839
+ else
8840
8840
  canvas.unrealCanvas();
8841
- }
8842
8841
  this.leafer = this;
8843
8842
  this.watcher.disable();
8844
8843
  this.layouter.disable();
@@ -9244,10 +9243,7 @@ var LeaferUI = (function (exports) {
9244
9243
  leafer.getValidMove = function (moveX, moveY) {
9245
9244
  const { scroll, disabled } = this.app.config.move;
9246
9245
  if (scroll) {
9247
- if (Math.abs(moveX) > Math.abs(moveY))
9248
- moveY = 0;
9249
- else
9250
- moveX = 0;
9246
+ Math.abs(moveX) > Math.abs(moveY) ? moveY = 0 : moveX = 0;
9251
9247
  if (scroll === 'limit') {
9252
9248
  const { x, y, width, height } = new Bounds(this.__world).addPoint(this.zoomLayer);
9253
9249
  const right = x + width - this.width, bottom = y + height - this.height;
@@ -9447,9 +9443,10 @@ var LeaferUI = (function (exports) {
9447
9443
  this.dragData = getDragEventData(data, data, data);
9448
9444
  this.canAnimate = this.canDragOut = true;
9449
9445
  }
9450
- getList() {
9446
+ getList(realDraggable, hover) {
9451
9447
  const { proxy } = this.interaction.selector;
9452
- return this.dragging && (!proxy || !proxy.list.length) ? (exports.DragEvent.list || this.dragableList || emptyList) : emptyList;
9448
+ const hasProxyList = proxy && proxy.list.length, dragList = exports.DragEvent.list || this.draggableList || emptyList;
9449
+ return this.dragging && (hasProxyList ? (realDraggable ? emptyList : new LeafList(hover ? [...proxy.list, ...proxy.dragHoverExclude] : proxy.list)) : dragList);
9453
9450
  }
9454
9451
  checkDrag(data, canDrag) {
9455
9452
  const { interaction } = this;
@@ -9474,8 +9471,8 @@ var LeaferUI = (function (exports) {
9474
9471
  this.dragging = canDrag && PointerButton.left(data);
9475
9472
  if (this.dragging) {
9476
9473
  this.interaction.emit(exports.DragEvent.START, this.dragData);
9477
- this.getDragableList(this.dragData.path);
9478
- this.setDragStartPoints(this.realDragableList = this.getList());
9474
+ this.getDraggableList(this.dragData.path);
9475
+ this.setDragStartPoints(this.realDraggableList = this.getList(true));
9479
9476
  }
9480
9477
  }
9481
9478
  }
@@ -9483,12 +9480,12 @@ var LeaferUI = (function (exports) {
9483
9480
  this.dragStartPoints = {};
9484
9481
  list.forEach(leaf => this.dragStartPoints[leaf.innerId] = { x: leaf.x, y: leaf.y });
9485
9482
  }
9486
- getDragableList(path) {
9483
+ getDraggableList(path) {
9487
9484
  let leaf;
9488
9485
  for (let i = 0, len = path.length; i < len; i++) {
9489
9486
  leaf = path.list[i];
9490
- if ((leaf.__.draggable || leaf.__.editable) && leaf.__.hitSelf && !leaf.__.locked) {
9491
- this.dragableList = new LeafList(leaf);
9487
+ if ((leaf.draggable || leaf.editable) && leaf.hitSelf && !leaf.locked) {
9488
+ this.draggableList = new LeafList(leaf);
9492
9489
  break;
9493
9490
  }
9494
9491
  }
@@ -9513,7 +9510,7 @@ var LeaferUI = (function (exports) {
9513
9510
  }
9514
9511
  dragReal() {
9515
9512
  const { running } = this.interaction;
9516
- const list = this.realDragableList;
9513
+ const list = this.realDraggableList;
9517
9514
  if (list.length && running) {
9518
9515
  const { totalX, totalY } = this.dragData;
9519
9516
  list.forEach(leaf => leaf.draggable && leaf.move(exports.DragEvent.getValidMove(leaf, this.dragStartPoints[leaf.innerId], { x: totalX, y: totalY })));
@@ -9602,7 +9599,7 @@ var LeaferUI = (function (exports) {
9602
9599
  this.interaction.emit(exports.DragEvent.LEAVE, data, dragEnterPath);
9603
9600
  }
9604
9601
  dragReset() {
9605
- exports.DragEvent.list = exports.DragEvent.data = this.dragableList = this.dragData = this.downData = this.dragOverPath = this.dragEnterPath = null;
9602
+ exports.DragEvent.list = exports.DragEvent.data = this.draggableList = this.dragData = this.downData = this.dragOverPath = this.dragEnterPath = null;
9606
9603
  }
9607
9604
  checkDragOut(data) {
9608
9605
  const { interaction } = this;
@@ -9743,6 +9740,7 @@ var LeaferUI = (function (exports) {
9743
9740
  touch: {
9744
9741
  preventDefault: true
9745
9742
  },
9743
+ multiTouch: {},
9746
9744
  cursor: true,
9747
9745
  keyEvent: true
9748
9746
  };
@@ -9869,6 +9867,8 @@ var LeaferUI = (function (exports) {
9869
9867
  this.pointerUp(data);
9870
9868
  }
9871
9869
  multiTouch(data, list) {
9870
+ if (this.config.multiTouch.disabled)
9871
+ return;
9872
9872
  const { move, angle, scale, center } = MultiTouchHelper.getData(list);
9873
9873
  this.rotate(getRotateEventData(center, angle, data));
9874
9874
  this.zoom(getZoomEventData(center, scale, data));
@@ -10058,7 +10058,7 @@ var LeaferUI = (function (exports) {
10058
10058
  data = this.hoverData;
10059
10059
  if (!data)
10060
10060
  return;
10061
- this.findPath(data, { exclude: this.dragger.getList(), name: exports.PointerEvent.MOVE });
10061
+ this.findPath(data, { exclude: this.dragger.getList(false, true), name: exports.PointerEvent.MOVE });
10062
10062
  this.hoverData = data;
10063
10063
  }
10064
10064
  updateCursor(data) {
@@ -10080,7 +10080,7 @@ var LeaferUI = (function (exports) {
10080
10080
  const { path } = data;
10081
10081
  for (let i = 0, len = path.length; i < len; i++) {
10082
10082
  leaf = path.list[i];
10083
- cursor = leaf.syncEventer ? leaf.syncEventer.cursor : leaf.cursor;
10083
+ cursor = (leaf.syncEventer && leaf.syncEventer.cursor) || leaf.cursor;
10084
10084
  if (cursor)
10085
10085
  break;
10086
10086
  }
@@ -10262,7 +10262,7 @@ var LeaferUI = (function (exports) {
10262
10262
  if (isHitPixel) {
10263
10263
  const { renderBounds } = this.__layout;
10264
10264
  const size = Platform.image.hitCanvasSize;
10265
- const scale = h.hitScale = tempBounds$1.set(0, 0, size, size).getFitMatrix(renderBounds, 0.5).a;
10265
+ const scale = h.hitScale = tempBounds$1.set(0, 0, size, size).getFitMatrix(renderBounds).a;
10266
10266
  const { x, y, width, height } = tempBounds$1.set(renderBounds).scale(scale);
10267
10267
  h.resize({ width, height, pixelRatio: 1 });
10268
10268
  h.clear();
@@ -10318,15 +10318,14 @@ var LeaferUI = (function (exports) {
10318
10318
  return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
10319
10319
  };
10320
10320
 
10321
- const ui$1 = new exports.UI();
10322
- const rect = exports.Rect.prototype;
10323
- rect.__updateHitCanvas = function () {
10321
+ const ui$1 = exports.UI.prototype, rect = exports.Rect.prototype, box$1 = exports.Box.prototype;
10322
+ rect.__updateHitCanvas = box$1.__updateHitCanvas = function () {
10324
10323
  if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all')
10325
10324
  ui$1.__updateHitCanvas.call(this);
10326
10325
  else if (this.__hitCanvas)
10327
10326
  this.__hitCanvas = null;
10328
10327
  };
10329
- rect.__hitFill = function (inner) {
10328
+ rect.__hitFill = box$1.__hitFill = function (inner) {
10330
10329
  return this.__hitCanvas ? ui$1.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
10331
10330
  };
10332
10331
 
@@ -10825,9 +10824,10 @@ var LeaferUI = (function (exports) {
10825
10824
  onLoadError(ui, event, image.error);
10826
10825
  }
10827
10826
  else {
10828
- ignoreRender(ui, true);
10829
- if (firstUse)
10827
+ if (firstUse) {
10828
+ ignoreRender(ui, true);
10830
10829
  onLoad(ui, event);
10830
+ }
10831
10831
  leafPaint.loadId = image.load(() => {
10832
10832
  ignoreRender(ui, false);
10833
10833
  if (!ui.destroyed) {
@@ -10975,7 +10975,7 @@ var LeaferUI = (function (exports) {
10975
10975
  }
10976
10976
  if (allowPaint) {
10977
10977
  canvas.save();
10978
- canvas.clip();
10978
+ ui.windingRule ? canvas.clip(ui.windingRule) : canvas.clip();
10979
10979
  if (paint.blendMode)
10980
10980
  canvas.blendMode = paint.blendMode;
10981
10981
  if (data.opacity)
@@ -11439,11 +11439,12 @@ var LeaferUI = (function (exports) {
11439
11439
  const { Letter, Single, Before, After, Symbol, Break } = CharType;
11440
11440
  let word, row, wordWidth, rowWidth, realWidth;
11441
11441
  let char, charWidth, startCharSize, charSize, charType, lastCharType, langBreak, afterBreak, paraStart;
11442
- let textDrawData, rows = [], bounds;
11442
+ let textDrawData, rows = [], bounds, findMaxWidth;
11443
11443
  function createRows(drawData, content, style) {
11444
11444
  textDrawData = drawData;
11445
11445
  rows = drawData.rows;
11446
11446
  bounds = drawData.bounds;
11447
+ findMaxWidth = !bounds.width && !style.autoSizeAlign;
11447
11448
  const { __letterSpacing, paraIndent, textCase } = style;
11448
11449
  const { canvas } = Platform;
11449
11450
  const { width, height } = bounds;
@@ -11528,7 +11529,10 @@ var LeaferUI = (function (exports) {
11528
11529
  else {
11529
11530
  content.split('\n').forEach(content => {
11530
11531
  textDrawData.paraNumber++;
11531
- rows.push({ x: paraIndent || 0, text: content, width: canvas.measureText(content).width, paraStart: true });
11532
+ rowWidth = canvas.measureText(content).width;
11533
+ rows.push({ x: paraIndent || 0, text: content, width: rowWidth, paraStart: true });
11534
+ if (findMaxWidth)
11535
+ setMaxWidth();
11532
11536
  });
11533
11537
  }
11534
11538
  }
@@ -11559,10 +11563,16 @@ var LeaferUI = (function (exports) {
11559
11563
  row.width = rowWidth;
11560
11564
  if (bounds.width)
11561
11565
  trimRight(row);
11566
+ else if (findMaxWidth)
11567
+ setMaxWidth();
11562
11568
  rows.push(row);
11563
11569
  row = { words: [] };
11564
11570
  rowWidth = 0;
11565
11571
  }
11572
+ function setMaxWidth() {
11573
+ if (rowWidth > (textDrawData.maxWidth || 0))
11574
+ textDrawData.maxWidth = rowWidth;
11575
+ }
11566
11576
 
11567
11577
  const CharMode = 0;
11568
11578
  const WordMode = 1;
@@ -11634,34 +11644,32 @@ var LeaferUI = (function (exports) {
11634
11644
 
11635
11645
  function layoutText(drawData, style) {
11636
11646
  const { rows, bounds } = drawData;
11637
- const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing } = style;
11647
+ const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing, autoSizeAlign } = style;
11638
11648
  let { x, y, width, height } = bounds, realHeight = __lineHeight * rows.length + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
11639
11649
  let starY = __baseLine;
11640
11650
  if (__clipText && realHeight > height) {
11641
11651
  realHeight = Math.max(height, __lineHeight);
11642
11652
  drawData.overflow = rows.length;
11643
11653
  }
11644
- else {
11654
+ else if (height || autoSizeAlign) {
11645
11655
  switch (verticalAlign) {
11646
11656
  case 'middle':
11647
11657
  y += (height - realHeight) / 2;
11648
11658
  break;
11649
- case 'bottom':
11650
- y += (height - realHeight);
11659
+ case 'bottom': y += (height - realHeight);
11651
11660
  }
11652
11661
  }
11653
11662
  starY += y;
11654
- let row, rowX, rowWidth;
11663
+ let row, rowX, rowWidth, layoutWidth = (width || autoSizeAlign) ? width : drawData.maxWidth;
11655
11664
  for (let i = 0, len = rows.length; i < len; i++) {
11656
11665
  row = rows[i];
11657
11666
  row.x = x;
11658
11667
  if (row.width < width || (row.width > width && !__clipText)) {
11659
11668
  switch (textAlign) {
11660
11669
  case 'center':
11661
- row.x += (width - row.width) / 2;
11670
+ row.x += (layoutWidth - row.width) / 2;
11662
11671
  break;
11663
- case 'right':
11664
- row.x += width - row.width;
11672
+ case 'right': row.x += layoutWidth - row.width;
11665
11673
  }
11666
11674
  }
11667
11675
  if (row.paraStart && paraSpacing && i > 0)
@@ -11766,14 +11774,14 @@ var LeaferUI = (function (exports) {
11766
11774
  let height = style.__getInput('height') || 0;
11767
11775
  const { textDecoration, __font, __padding: padding } = style;
11768
11776
  if (padding) {
11769
- if (width) {
11777
+ if (width)
11778
+ x = padding[left], width -= (padding[right] + padding[left]);
11779
+ else if (!style.autoSizeAlign)
11770
11780
  x = padding[left];
11771
- width -= (padding[right] + padding[left]);
11772
- }
11773
- if (height) {
11781
+ if (height)
11782
+ y = padding[top], height -= (padding[top] + padding[bottom]);
11783
+ else if (!style.autoSizeAlign)
11774
11784
  y = padding[top];
11775
- height -= (padding[top] + padding[bottom]);
11776
- }
11777
11785
  }
11778
11786
  const drawData = {
11779
11787
  bounds: { x, y, width, height },
@@ -11793,22 +11801,20 @@ var LeaferUI = (function (exports) {
11793
11801
  return drawData;
11794
11802
  }
11795
11803
  function padAutoText(padding, drawData, style, width, height) {
11796
- if (!width) {
11804
+ if (!width && style.autoSizeAlign) {
11797
11805
  switch (style.textAlign) {
11798
11806
  case 'left':
11799
11807
  offsetText(drawData, 'x', padding[left]);
11800
11808
  break;
11801
- case 'right':
11802
- offsetText(drawData, 'x', -padding[right]);
11809
+ case 'right': offsetText(drawData, 'x', -padding[right]);
11803
11810
  }
11804
11811
  }
11805
- if (!height) {
11812
+ if (!height && style.autoSizeAlign) {
11806
11813
  switch (style.verticalAlign) {
11807
11814
  case 'top':
11808
11815
  offsetText(drawData, 'y', padding[top]);
11809
11816
  break;
11810
- case 'bottom':
11811
- offsetText(drawData, 'y', -padding[bottom]);
11817
+ case 'bottom': offsetText(drawData, 'y', -padding[bottom]);
11812
11818
  }
11813
11819
  }
11814
11820
  }