leafer-ui 1.0.0-rc.2 → 1.0.0-rc.4

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/web.js CHANGED
@@ -650,7 +650,7 @@ var LeaferUI = (function (exports) {
650
650
  },
651
651
  getFitMatrix(t, put) {
652
652
  const scale = Math.min(1, Math.min(t.width / put.width, t.height / put.height));
653
- return new Matrix(scale, 0, 0, scale, -put.x * scale, -put.y * scale);
653
+ return new Matrix(scale, 0, 0, scale, -Math.ceil(put.x * scale), -Math.ceil(put.y * scale));
654
654
  },
655
655
  getSpread(t, spreadX, spreadY) {
656
656
  const n = {};
@@ -1051,6 +1051,9 @@ var LeaferUI = (function (exports) {
1051
1051
  }
1052
1052
  }
1053
1053
  },
1054
+ has(type) {
1055
+ return !!this.nameList[type];
1056
+ },
1054
1057
  get(type, ...params) {
1055
1058
  return new nameList[type](...params);
1056
1059
  }
@@ -4591,7 +4594,8 @@ var LeaferUI = (function (exports) {
4591
4594
  dragDistance: 2,
4592
4595
  swipeDistance: 20,
4593
4596
  ignoreMove: false
4594
- }
4597
+ },
4598
+ cursor: {}
4595
4599
  };
4596
4600
  this.tapCount = 0;
4597
4601
  this.downKeyMap = {};
@@ -4817,6 +4821,8 @@ var LeaferUI = (function (exports) {
4817
4821
  this.hoverData = data;
4818
4822
  }
4819
4823
  updateCursor(data) {
4824
+ if (this.config.cursor.stop)
4825
+ return;
4820
4826
  if (!data) {
4821
4827
  this.updateHoverData();
4822
4828
  data = this.hoverData;
@@ -4829,17 +4835,16 @@ var LeaferUI = (function (exports) {
4829
4835
  }
4830
4836
  else if (!data || this.dragger.dragging)
4831
4837
  return;
4832
- const path = data.path;
4833
4838
  let leaf;
4839
+ let cursor;
4840
+ const { path } = data;
4834
4841
  for (let i = 0, len = path.length; i < len; i++) {
4835
4842
  leaf = path.list[i];
4836
- if (leaf.cursor) {
4837
- const { cursor } = leaf;
4838
- this.setCursor(cursor === 'grab' ? (this.downData ? 'grabbing' : cursor) : cursor);
4839
- return;
4840
- }
4843
+ cursor = leaf.cursor;
4844
+ if (cursor)
4845
+ break;
4841
4846
  }
4842
- this.setCursor('default');
4847
+ this.setCursor(cursor);
4843
4848
  }
4844
4849
  setCursor(cursor) {
4845
4850
  this.cursor = cursor;
@@ -5161,6 +5166,8 @@ var LeaferUI = (function (exports) {
5161
5166
  this.on(type, listener, { once: true, capture });
5162
5167
  },
5163
5168
  emit(type, event, capture) {
5169
+ if (!event && EventCreator.has(type))
5170
+ event = EventCreator.get(type, { type, target: this, current: this });
5164
5171
  const map = __getListenerMap(this, capture);
5165
5172
  const list = map[type];
5166
5173
  if (list) {
@@ -5455,7 +5462,7 @@ var LeaferUI = (function (exports) {
5455
5462
  const tempCanvas = canvas.getSameCanvas(true);
5456
5463
  this.__draw(tempCanvas, options);
5457
5464
  const blendMode = this.__.isEraser ? 'destination-out' : this.__.blendMode;
5458
- if (options.matrix || this.__hasMirror) {
5465
+ if (this.__hasMirror || options.matrix) {
5459
5466
  canvas.copyWorldByReset(tempCanvas, null, null, blendMode);
5460
5467
  }
5461
5468
  else {
@@ -5524,7 +5531,12 @@ var LeaferUI = (function (exports) {
5524
5531
  this.__renderBranch(tempCanvas, options);
5525
5532
  canvas.opacity = this.__worldOpacity;
5526
5533
  const blendMode = this.__.isEraser ? 'destination-out' : this.__.blendMode;
5527
- options.matrix ? canvas.copyWorld(tempCanvas, null, null, blendMode) : canvas.copyWorld(tempCanvas, this.__world, this.__world, blendMode);
5534
+ if (this.__hasMirror || options.matrix) {
5535
+ canvas.copyWorld(tempCanvas, null, null, blendMode);
5536
+ }
5537
+ else {
5538
+ canvas.copyWorld(tempCanvas, this.__world, this.__world, blendMode);
5539
+ }
5528
5540
  tempCanvas.recycle();
5529
5541
  }
5530
5542
  else {
@@ -7423,7 +7435,7 @@ var LeaferUI = (function (exports) {
7423
7435
  if (typeof value === 'string' || !value) {
7424
7436
  if (this.__isFills) {
7425
7437
  this.__removeInput('fill');
7426
- Paint.recycleImage(this, 'fill');
7438
+ Paint.recycleImage('fill', this);
7427
7439
  this.__isFills = false;
7428
7440
  }
7429
7441
  this._fill = value;
@@ -7439,7 +7451,7 @@ var LeaferUI = (function (exports) {
7439
7451
  if (typeof value === 'string' || !value) {
7440
7452
  if (this.__isStrokes) {
7441
7453
  this.__removeInput('stroke');
7442
- Paint.recycleImage(this, 'stroke');
7454
+ Paint.recycleImage('stroke', this);
7443
7455
  this.__isStrokes = false;
7444
7456
  }
7445
7457
  this._stroke = value;
@@ -7691,11 +7703,11 @@ var LeaferUI = (function (exports) {
7691
7703
  const { fill, stroke, __drawAfterFill } = this.__;
7692
7704
  this.__drawRenderPath(canvas);
7693
7705
  if (fill)
7694
- Paint.fill(this, canvas, fill);
7706
+ Paint.fill(fill, this, canvas);
7695
7707
  if (__drawAfterFill)
7696
7708
  this.__drawAfterFill(canvas, options);
7697
7709
  if (stroke)
7698
- Paint.stroke(this, canvas, stroke);
7710
+ Paint.stroke(stroke, this, canvas, options);
7699
7711
  },
7700
7712
  __draw(canvas, options) {
7701
7713
  if (this.__.__complex) {
@@ -7707,40 +7719,40 @@ var LeaferUI = (function (exports) {
7707
7719
  if (shadow)
7708
7720
  Effect.shadow(this, canvas, shape, options);
7709
7721
  if (fill)
7710
- this.__.__isFills ? Paint.fills(this, canvas, fill) : Paint.fill(this, canvas, fill);
7722
+ this.__.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
7711
7723
  if (__drawAfterFill)
7712
7724
  this.__drawAfterFill(canvas, options);
7713
7725
  if (innerShadow)
7714
7726
  Effect.innerShadow(this, canvas, shape, options);
7715
7727
  if (stroke)
7716
- this.__.__isStrokes ? Paint.strokes(this, canvas, stroke) : Paint.stroke(this, canvas, stroke);
7728
+ this.__.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
7717
7729
  if (shape.worldCanvas)
7718
7730
  shape.worldCanvas.recycle();
7719
7731
  shape.canvas.recycle();
7720
7732
  }
7721
7733
  else {
7722
7734
  if (fill)
7723
- this.__.__isFills ? Paint.fills(this, canvas, fill) : Paint.fill(this, canvas, fill);
7735
+ this.__.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
7724
7736
  if (__drawAfterFill)
7725
7737
  this.__drawAfterFill(canvas, options);
7726
7738
  if (stroke)
7727
- this.__.__isStrokes ? Paint.strokes(this, canvas, stroke) : Paint.stroke(this, canvas, stroke);
7739
+ this.__.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
7728
7740
  }
7729
7741
  }
7730
7742
  else {
7731
7743
  this.__drawFast(canvas, options);
7732
7744
  }
7733
7745
  },
7734
- __renderShape(canvas, options) {
7746
+ __renderShape(canvas, renderOptions) {
7735
7747
  if (!this.__worldOpacity)
7736
7748
  return;
7737
- canvas.setWorld(this.__world, options.matrix);
7749
+ canvas.setWorld(this.__world, renderOptions.matrix);
7738
7750
  const { fill, stroke } = this.__;
7739
7751
  this.__drawRenderPath(canvas);
7740
7752
  if (fill)
7741
- Paint.fill(this, canvas, '#000000');
7753
+ Paint.fill('#000000', this, canvas);
7742
7754
  if (stroke)
7743
- Paint.stroke(this, canvas, '#000000');
7755
+ Paint.stroke('#000000', this, canvas, renderOptions);
7744
7756
  }
7745
7757
  };
7746
7758
 
@@ -7809,9 +7821,9 @@ var LeaferUI = (function (exports) {
7809
7821
  if (this.__.__input) {
7810
7822
  const { fill, stroke } = this.__.__input;
7811
7823
  if (fill)
7812
- Paint.compute(this, 'fill');
7824
+ Paint.compute('fill', this);
7813
7825
  if (stroke)
7814
- Paint.compute(this, 'stroke');
7826
+ Paint.compute('stroke', this);
7815
7827
  }
7816
7828
  }
7817
7829
  __updateRenderPath() {
@@ -7928,7 +7940,7 @@ var LeaferUI = (function (exports) {
7928
7940
  hitType()
7929
7941
  ], exports.UI.prototype, "hitRadius", void 0);
7930
7942
  __decorate([
7931
- cursorType('default')
7943
+ cursorType('')
7932
7944
  ], exports.UI.prototype, "cursor", void 0);
7933
7945
  __decorate([
7934
7946
  surfaceType()
@@ -8275,14 +8287,19 @@ var LeaferUI = (function (exports) {
8275
8287
  __updateRenderPath() {
8276
8288
  if (this.__.points && this.__.curve) {
8277
8289
  drawPoints$1(this.__.__pathForRender = [], this.__.points, this.__.curve, true);
8278
- this.__updateNaturalSize();
8279
8290
  }
8280
8291
  else {
8281
8292
  super.__updateRenderPath();
8282
8293
  }
8283
8294
  }
8284
8295
  __updateBoxBounds() {
8285
- this.__.points ? toBounds$2(this.__.path, this.__layout.boxBounds) : super.__updateBoxBounds();
8296
+ if (this.__.points) {
8297
+ toBounds$2(this.__.__pathForRender, this.__layout.boxBounds);
8298
+ this.__updateNaturalSize();
8299
+ }
8300
+ else {
8301
+ super.__updateBoxBounds();
8302
+ }
8286
8303
  }
8287
8304
  };
8288
8305
  __decorate([
@@ -8376,7 +8393,7 @@ var LeaferUI = (function (exports) {
8376
8393
  }
8377
8394
  __updateBoxBounds() {
8378
8395
  if (this.points) {
8379
- toBounds$1(this.__.path, this.__layout.boxBounds);
8396
+ toBounds$1(this.__.__pathForRender, this.__layout.boxBounds);
8380
8397
  this.__updateNaturalSize();
8381
8398
  }
8382
8399
  else {
@@ -9386,7 +9403,7 @@ var LeaferUI = (function (exports) {
9386
9403
  }
9387
9404
  }
9388
9405
 
9389
- function recycleImage(data, attrName) {
9406
+ function recycleImage(attrName, data) {
9390
9407
  const paints = (attrName === 'fill' ? data._fill : data._stroke);
9391
9408
  if (paints instanceof Array) {
9392
9409
  let image, recycleMap, input, url;
@@ -9431,11 +9448,11 @@ var LeaferUI = (function (exports) {
9431
9448
  }
9432
9449
  }
9433
9450
 
9434
- function fill(ui, canvas, fill) {
9451
+ function fill(fill, ui, canvas) {
9435
9452
  canvas.fillStyle = fill;
9436
9453
  ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
9437
9454
  }
9438
- function fills(ui, canvas, fills) {
9455
+ function fills(fills, ui, canvas) {
9439
9456
  let item;
9440
9457
  const { windingRule, __font } = ui.__;
9441
9458
  for (let i = 0, len = fills.length; i < len; i++) {
@@ -9466,32 +9483,37 @@ var LeaferUI = (function (exports) {
9466
9483
  }
9467
9484
  }
9468
9485
 
9469
- function strokeText(ui, canvas, stroke) {
9486
+ function strokeText(stroke, ui, canvas, renderOptions) {
9470
9487
  const { strokeAlign } = ui.__;
9471
9488
  const isStrokes = typeof stroke !== 'string';
9472
9489
  switch (strokeAlign) {
9473
9490
  case 'center':
9474
9491
  canvas.setStroke(isStrokes ? undefined : stroke, ui.__.strokeWidth, ui.__);
9475
- isStrokes ? drawStrokesStyle(ui, stroke, canvas, true) : drawTextStroke(ui, canvas);
9492
+ isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
9476
9493
  break;
9477
9494
  case 'inside':
9478
- drawAlignStroke(ui, canvas, stroke, 'inside', isStrokes);
9495
+ drawAlignStroke('inside', stroke, isStrokes, ui, canvas, renderOptions);
9479
9496
  break;
9480
9497
  case 'outside':
9481
- drawAlignStroke(ui, canvas, stroke, 'outside', isStrokes);
9498
+ drawAlignStroke('outside', stroke, isStrokes, ui, canvas, renderOptions);
9482
9499
  break;
9483
9500
  }
9484
9501
  }
9485
- function drawAlignStroke(ui, canvas, stroke, align, isStrokes) {
9502
+ function drawAlignStroke(align, stroke, isStrokes, ui, canvas, renderOptions) {
9486
9503
  const { strokeWidth, __font } = ui.__;
9487
9504
  const out = canvas.getSameCanvas(true);
9488
9505
  out.setStroke(isStrokes ? undefined : stroke, strokeWidth * 2, ui.__);
9489
9506
  out.font = __font;
9490
- isStrokes ? drawStrokesStyle(ui, stroke, out, true) : drawTextStroke(ui, out);
9507
+ isStrokes ? drawStrokesStyle(stroke, true, ui, out) : drawTextStroke(ui, out);
9491
9508
  out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
9492
9509
  fillText(ui, out);
9493
9510
  out.blendMode = 'normal';
9494
- canvas.copyWorldToInner(out, ui.__world, ui.__layout.renderBounds);
9511
+ if (ui.__hasMirror || renderOptions.matrix) {
9512
+ canvas.copyWorldByReset(out);
9513
+ }
9514
+ else {
9515
+ canvas.copyWorldToInner(out, ui.__world, ui.__layout.renderBounds);
9516
+ }
9495
9517
  out.recycle();
9496
9518
  }
9497
9519
  function drawTextStroke(ui, canvas) {
@@ -9511,7 +9533,7 @@ var LeaferUI = (function (exports) {
9511
9533
  canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
9512
9534
  }
9513
9535
  }
9514
- function drawStrokesStyle(ui, strokes, canvas, isText) {
9536
+ function drawStrokesStyle(strokes, isText, ui, canvas) {
9515
9537
  let item;
9516
9538
  for (let i = 0, len = strokes.length; i < len; i++) {
9517
9539
  item = strokes[i];
@@ -9531,13 +9553,13 @@ var LeaferUI = (function (exports) {
9531
9553
  }
9532
9554
  }
9533
9555
 
9534
- function stroke(ui, canvas, stroke) {
9556
+ function stroke(stroke, ui, canvas, renderOptions) {
9535
9557
  const options = ui.__;
9536
9558
  const { strokeWidth, strokeAlign, __font } = options;
9537
9559
  if (!strokeWidth)
9538
9560
  return;
9539
9561
  if (__font) {
9540
- strokeText(ui, canvas, stroke);
9562
+ strokeText(stroke, ui, canvas, renderOptions);
9541
9563
  }
9542
9564
  else {
9543
9565
  switch (strokeAlign) {
@@ -9559,31 +9581,36 @@ var LeaferUI = (function (exports) {
9559
9581
  out.stroke();
9560
9582
  options.windingRule ? out.clip(options.windingRule) : out.clip();
9561
9583
  out.clearWorld(ui.__layout.renderBounds);
9562
- canvas.copyWorldToInner(out, ui.__world, ui.__layout.renderBounds);
9584
+ if (ui.__hasMirror || renderOptions.matrix) {
9585
+ canvas.copyWorldByReset(out);
9586
+ }
9587
+ else {
9588
+ canvas.copyWorldToInner(out, ui.__world, ui.__layout.renderBounds);
9589
+ }
9563
9590
  out.recycle();
9564
9591
  break;
9565
9592
  }
9566
9593
  }
9567
9594
  }
9568
- function strokes(ui, canvas, strokes) {
9595
+ function strokes(strokes, ui, canvas, renderOptions) {
9569
9596
  const options = ui.__;
9570
9597
  const { strokeWidth, strokeAlign, __font } = options;
9571
9598
  if (!strokeWidth)
9572
9599
  return;
9573
9600
  if (__font) {
9574
- strokeText(ui, canvas, strokes);
9601
+ strokeText(strokes, ui, canvas, renderOptions);
9575
9602
  }
9576
9603
  else {
9577
9604
  switch (strokeAlign) {
9578
9605
  case 'center':
9579
9606
  canvas.setStroke(undefined, strokeWidth, options);
9580
- drawStrokesStyle(ui, strokes, canvas);
9607
+ drawStrokesStyle(strokes, false, ui, canvas);
9581
9608
  break;
9582
9609
  case 'inside':
9583
9610
  canvas.save();
9584
9611
  canvas.setStroke(undefined, strokeWidth * 2, options);
9585
9612
  options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
9586
- drawStrokesStyle(ui, strokes, canvas);
9613
+ drawStrokesStyle(strokes, false, ui, canvas);
9587
9614
  canvas.restore();
9588
9615
  break;
9589
9616
  case 'outside':
@@ -9591,10 +9618,15 @@ var LeaferUI = (function (exports) {
9591
9618
  const out = canvas.getSameCanvas(true);
9592
9619
  ui.__drawRenderPath(out);
9593
9620
  out.setStroke(undefined, strokeWidth * 2, ui.__);
9594
- drawStrokesStyle(ui, strokes, out);
9621
+ drawStrokesStyle(strokes, false, ui, out);
9595
9622
  options.windingRule ? out.clip(options.windingRule) : out.clip();
9596
9623
  out.clearWorld(renderBounds);
9597
- canvas.copyWorldToInner(out, ui.__world, renderBounds);
9624
+ if (ui.__hasMirror || renderOptions.matrix) {
9625
+ canvas.copyWorldByReset(out);
9626
+ }
9627
+ else {
9628
+ canvas.copyWorldToInner(out, ui.__world, renderBounds);
9629
+ }
9598
9630
  out.recycle();
9599
9631
  break;
9600
9632
  }
@@ -9726,21 +9758,21 @@ var LeaferUI = (function (exports) {
9726
9758
  }
9727
9759
 
9728
9760
  let recycleMap;
9729
- function compute(ui, attrName) {
9761
+ function compute(attrName, ui) {
9730
9762
  const value = [];
9731
9763
  let item;
9732
9764
  let paints = ui.__.__input[attrName];
9733
9765
  if (!(paints instanceof Array))
9734
9766
  paints = [paints];
9735
- recycleMap = recycleImage(ui.__, attrName);
9767
+ recycleMap = recycleImage(attrName, ui.__);
9736
9768
  for (let i = 0, len = paints.length; i < len; i++) {
9737
- item = getLeafPaint(ui, paints[i], attrName);
9769
+ item = getLeafPaint(attrName, paints[i], ui);
9738
9770
  if (item)
9739
9771
  value.push(item);
9740
9772
  }
9741
9773
  ui.__['_' + attrName] = value.length ? value : undefined;
9742
9774
  }
9743
- function getLeafPaint(ui, paint, attrName) {
9775
+ function getLeafPaint(attrName, paint, ui) {
9744
9776
  if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
9745
9777
  return undefined;
9746
9778
  const { boxBounds } = ui.__layout;
@@ -9778,7 +9810,7 @@ var LeaferUI = (function (exports) {
9778
9810
  const { copy, toOffsetOutBounds: toOffsetOutBounds$1 } = BoundsHelper;
9779
9811
  const tempBounds = {};
9780
9812
  const offsetOutBounds$1 = {};
9781
- function shadow(ui, current, shape, _options) {
9813
+ function shadow(ui, current, shape, renderOptions) {
9782
9814
  let copyBounds, spreadScale;
9783
9815
  const { __world, __layout } = ui;
9784
9816
  const { shadow } = ui.__;
@@ -9800,7 +9832,7 @@ var LeaferUI = (function (exports) {
9800
9832
  }
9801
9833
  worldCanvas ? other.copyWorld(worldCanvas, __world, __world, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
9802
9834
  }
9803
- if (ui.__hasMirror) {
9835
+ if (ui.__hasMirror || renderOptions.matrix) {
9804
9836
  current.copyWorldByReset(other, copyBounds, __world, item.blendMode);
9805
9837
  }
9806
9838
  else {
@@ -9840,7 +9872,7 @@ var LeaferUI = (function (exports) {
9840
9872
 
9841
9873
  const { toOffsetOutBounds } = BoundsHelper;
9842
9874
  const offsetOutBounds = {};
9843
- function innerShadow(ui, current, shape, _options) {
9875
+ function innerShadow(ui, current, shape, renderOptions) {
9844
9876
  let copyBounds, spreadScale;
9845
9877
  const { __world, __layout: __layout } = ui;
9846
9878
  const { innerShadow } = ui.__;
@@ -9864,7 +9896,7 @@ var LeaferUI = (function (exports) {
9864
9896
  copyBounds = bounds;
9865
9897
  }
9866
9898
  other.fillWorld(copyBounds, item.color, 'source-in');
9867
- if (ui.__hasMirror) {
9899
+ if (ui.__hasMirror || renderOptions.matrix) {
9868
9900
  current.copyWorldByReset(other, copyBounds, __world, item.blendMode);
9869
9901
  }
9870
9902
  else {
@@ -10002,7 +10034,7 @@ var LeaferUI = (function (exports) {
10002
10034
  const { trimRight } = TextRowHelper;
10003
10035
  const { Letter, Single, Before, After, Symbol, Break } = CharType;
10004
10036
  let word, row, wordWidth, rowWidth, realWidth;
10005
- let char, charWidth, charType, lastCharType, langBreak, afterBreak, paraStart;
10037
+ let char, charWidth, startCharSize, charSize, charType, lastCharType, langBreak, afterBreak, paraStart;
10006
10038
  let textDrawData, rows = [], bounds;
10007
10039
  function createRows(drawData, content, style) {
10008
10040
  textDrawData = drawData;
@@ -10015,7 +10047,7 @@ var LeaferUI = (function (exports) {
10015
10047
  if (charMode) {
10016
10048
  paraStart = true;
10017
10049
  lastCharType = null;
10018
- wordWidth = rowWidth = 0;
10050
+ startCharSize = charWidth = charSize = wordWidth = rowWidth = 0;
10019
10051
  word = { data: [] }, row = { words: [] };
10020
10052
  for (let i = 0, len = content.length; i < len; i++) {
10021
10053
  char = content[i];
@@ -10031,8 +10063,11 @@ var LeaferUI = (function (exports) {
10031
10063
  if (charType === Letter && textCase !== 'none')
10032
10064
  char = getTextCase(char, textCase, !wordWidth);
10033
10065
  charWidth = canvas.measureText(char).width;
10034
- if (__letterSpacing)
10066
+ if (__letterSpacing) {
10067
+ if (__letterSpacing < 0)
10068
+ charSize = charWidth;
10035
10069
  charWidth += __letterSpacing;
10070
+ }
10036
10071
  langBreak = (charType === Single && (lastCharType === Single || lastCharType === Letter)) || (lastCharType === Single && charType !== After);
10037
10072
  afterBreak = ((charType === Before || charType === Single) && (lastCharType === Symbol || lastCharType === After));
10038
10073
  realWidth = paraStart && paraIndent ? width - paraIndent : width;
@@ -10082,6 +10117,8 @@ var LeaferUI = (function (exports) {
10082
10117
  }
10083
10118
  }
10084
10119
  function addChar(char, width) {
10120
+ if (charSize && !startCharSize)
10121
+ startCharSize = charSize;
10085
10122
  word.data.push({ char, width });
10086
10123
  wordWidth += width;
10087
10124
  }
@@ -10098,6 +10135,11 @@ var LeaferUI = (function (exports) {
10098
10135
  row.paraStart = true;
10099
10136
  paraStart = false;
10100
10137
  }
10138
+ if (charSize) {
10139
+ row.startCharSize = startCharSize;
10140
+ row.endCharSize = charSize;
10141
+ startCharSize = 0;
10142
+ }
10101
10143
  row.width = rowWidth;
10102
10144
  if (bounds.width)
10103
10145
  trimRight(row);
@@ -10171,7 +10213,7 @@ var LeaferUI = (function (exports) {
10171
10213
 
10172
10214
  function layoutText(drawData, style) {
10173
10215
  const { rows, bounds } = drawData;
10174
- const { __lineHeight, __baseLine, textAlign, verticalAlign, paraSpacing, textOverflow } = style;
10216
+ const { __lineHeight, __baseLine, __letterSpacing, textAlign, verticalAlign, paraSpacing, textOverflow } = style;
10175
10217
  let { x, y, width, height } = bounds, realHeight = __lineHeight * rows.length + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
10176
10218
  let starY = __baseLine;
10177
10219
  if (textOverflow !== 'show' && realHeight > height) {
@@ -10188,7 +10230,7 @@ var LeaferUI = (function (exports) {
10188
10230
  }
10189
10231
  }
10190
10232
  starY += y;
10191
- let row;
10233
+ let row, rowX, rowWidth;
10192
10234
  for (let i = 0, len = rows.length; i < len; i++) {
10193
10235
  row = rows[i];
10194
10236
  row.x = x;
@@ -10207,20 +10249,22 @@ var LeaferUI = (function (exports) {
10207
10249
  row.isOverflow = true;
10208
10250
  drawData.overflow = i + 1;
10209
10251
  }
10210
- if (row.width < 0) {
10211
- const charWidth = row.words[0].data[0].width;
10212
- const rowX = row.x + row.width;
10213
- if (rowX < bounds.x)
10214
- bounds.x = rowX - charWidth;
10215
- if (-row.width > bounds.width)
10216
- bounds.width = -row.width + style.fontSize + charWidth;
10217
- }
10218
- else {
10219
- if (row.x < bounds.x)
10220
- bounds.x = row.x;
10221
- if (row.width > bounds.width)
10222
- bounds.width = row.width;
10252
+ rowX = row.x;
10253
+ rowWidth = row.width;
10254
+ if (__letterSpacing < 0) {
10255
+ if (row.width < 0) {
10256
+ rowWidth = -row.width + style.fontSize + __letterSpacing;
10257
+ rowX -= rowWidth;
10258
+ rowWidth += style.fontSize;
10259
+ }
10260
+ else {
10261
+ rowWidth -= __letterSpacing;
10262
+ }
10223
10263
  }
10264
+ if (rowX < bounds.x)
10265
+ bounds.x = rowX;
10266
+ if (rowWidth > bounds.width)
10267
+ bounds.width = rowWidth;
10224
10268
  }
10225
10269
  bounds.y = y;
10226
10270
  bounds.height = realHeight;
@@ -10272,10 +10316,9 @@ var LeaferUI = (function (exports) {
10272
10316
  if (typeof content !== 'string')
10273
10317
  content = String(content);
10274
10318
  let x = 0, y = 0;
10275
- let { width, height, padding } = style;
10276
- const { textDecoration, textOverflow, __font } = style;
10277
- if (!width)
10278
- width = 0;
10319
+ let width = style.__getInput('width') || 0;
10320
+ let height = style.__getInput('height') || 0;
10321
+ const { textDecoration, textOverflow, __font, padding } = style;
10279
10322
  if (padding) {
10280
10323
  const [top, right, bottom, left] = MathHelper.fourNumber(padding);
10281
10324
  if (width) {