@leafer-draw/miniapp 2.1.11 → 2.2.0

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.
@@ -817,6 +817,11 @@ const PointHelper = {
817
817
  toOuterOf(t, matrix, to) {
818
818
  toOuterPoint$3(matrix, t, to);
819
819
  },
820
+ toVertical(t, rotation, verticalDistance, to) {
821
+ const r = rotation * OneRadian;
822
+ t.x += -Math.sin(r) * verticalDistance;
823
+ t.y += Math.cos(r) * verticalDistance;
824
+ },
820
825
  getCenter(t, to) {
821
826
  return {
822
827
  x: t.x + (to.x - t.x) / 2,
@@ -6985,7 +6990,7 @@ class LeafLevelList {
6985
6990
  }
6986
6991
  }
6987
6992
 
6988
- const version = "2.1.11";
6993
+ const version = "2.2.0";
6989
6994
 
6990
6995
  class LeaferCanvas extends LeaferCanvasBase {
6991
6996
  get allowBackgroundColor() {
@@ -9588,7 +9593,7 @@ let Text = class Text extends UI {
9588
9593
  data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize || 12}px ${fontFamily || "caption"}`;
9589
9594
  stintSet$1(data, "__padding", padding && MathHelper.fourNumber(padding));
9590
9595
  stintSet$1(data, "__clipText", textOverflow !== "show" && !data.__autoSize);
9591
- stintSet$1(data, "__isCharMode", width || height || data.__letterSpacing || textCase !== "none");
9596
+ stintSet$1(data, "__isCharMode", width || height || data.__letterSpacing || data.motionText || textCase !== "none");
9592
9597
  data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === "") ? data.placeholder : data.text, this.__);
9593
9598
  }
9594
9599
  __updateBoxBounds() {
@@ -9613,7 +9618,7 @@ let Text = class Text extends UI {
9613
9618
  this.__updateNaturalSize();
9614
9619
  } else super.__updateBoxBounds();
9615
9620
  if (italic) b.width += fontSize * .16;
9616
- DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
9621
+ DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds) && !data.motionText);
9617
9622
  if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
9618
9623
  }
9619
9624
  __updateRenderSpread() {
@@ -9798,7 +9803,8 @@ function fillPathOrText(ui, canvas, renderOptions) {
9798
9803
  ui.__.__font ? Paint.fillText(ui, canvas, renderOptions) : ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill();
9799
9804
  }
9800
9805
 
9801
- function fillText(ui, canvas, _renderOptions) {
9806
+ function fillText(ui, canvas, renderOptions) {
9807
+ if (ui.motionText) return Paint.fillMotionText(ui, canvas, renderOptions);
9802
9808
  const data = ui.__, {rows: rows, decorationY: decorationY} = data.__textDrawData;
9803
9809
  if (data.__isPlacehold && data.placeholderColor) canvas.fillStyle = data.placeholderColor;
9804
9810
  let row;
@@ -11160,7 +11166,8 @@ const TextMode = 2;
11160
11166
 
11161
11167
  function layoutChar(drawData, style, width, _height) {
11162
11168
  const {rows: rows} = drawData;
11163
- const {textAlign: textAlign, paraIndent: paraIndent, __letterSpacing: __letterSpacing} = style;
11169
+ const {textAlign: textAlign, paraIndent: paraIndent} = style;
11170
+ const useLetter = style.__letterSpacing || style.motionText;
11164
11171
  const justifyLast = width && textAlign.includes("both");
11165
11172
  const justify = justifyLast || width && textAlign.includes("justify");
11166
11173
  const justifyLetter = justify && textAlign.includes("letter");
@@ -11173,8 +11180,8 @@ function layoutChar(drawData, style, width, _height) {
11173
11180
  remainingWidth = width - row.width - indentWidth;
11174
11181
  if (justifyLetter) addLetterWidth = remainingWidth / (row.words.reduce((total, item) => total + item.data.length, 0) - 1); else addWordWidth = wordsLength > 1 ? remainingWidth / (wordsLength - 1) : 0;
11175
11182
  }
11176
- mode = __letterSpacing || row.isOverflow || justifyLetter ? CharMode : addWordWidth ? WordMode : TextMode;
11177
- if (row.isOverflow && !__letterSpacing) row.textMode = true;
11183
+ mode = useLetter || row.isOverflow || justifyLetter ? CharMode : addWordWidth ? WordMode : TextMode;
11184
+ if (row.isOverflow && !useLetter) row.textMode = true;
11178
11185
  if (mode === TextMode) {
11179
11186
  row.x += indentWidth;
11180
11187
  toTextChar$1(row);
@@ -11375,6 +11382,7 @@ function getDrawData(content, style) {
11375
11382
  let width = style.__getInput("width") || 0;
11376
11383
  let height = style.__getInput("height") || 0;
11377
11384
  const {__padding: padding} = style;
11385
+ if (style.motionText) width = height = 0;
11378
11386
  if (padding) {
11379
11387
  if (width) x = padding[left], width -= padding[right] + padding[left], !width && (width = .01); else if (!style.autoSizeAlign) x = padding[left];
11380
11388
  if (height) y = padding[top], height -= padding[top] + padding[bottom], !height && (height = .01); else if (!style.autoSizeAlign) y = padding[top];