@leafer-ui/miniapp 1.4.2 → 1.5.1

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.
@@ -2388,13 +2388,14 @@ function toChar(data, charX, rowData, isOverflow) {
2388
2388
  }
2389
2389
 
2390
2390
  function layoutText(drawData, style) {
2391
- const { rows, bounds } = drawData;
2391
+ const { rows, bounds } = drawData, countRows = rows.length;
2392
2392
  const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing, autoSizeAlign } = style;
2393
- let { x, y, width, height } = bounds, realHeight = __lineHeight * rows.length + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
2393
+ let { x, y, width, height } = bounds, realHeight = __lineHeight * countRows + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
2394
2394
  let starY = __baseLine;
2395
2395
  if (__clipText && realHeight > height) {
2396
2396
  realHeight = Math.max(height, __lineHeight);
2397
- drawData.overflow = rows.length;
2397
+ if (countRows > 1)
2398
+ drawData.overflow = countRows;
2398
2399
  }
2399
2400
  else if (height || autoSizeAlign) {
2400
2401
  switch (verticalAlign) {
@@ -2406,7 +2407,7 @@ function layoutText(drawData, style) {
2406
2407
  }
2407
2408
  starY += y;
2408
2409
  let row, rowX, rowWidth, layoutWidth = (width || autoSizeAlign) ? width : drawData.maxWidth;
2409
- for (let i = 0, len = rows.length; i < len; i++) {
2410
+ for (let i = 0, len = countRows; i < len; i++) {
2410
2411
  row = rows[i];
2411
2412
  row.x = x;
2412
2413
  if (row.width < width || (row.width > width && !__clipText)) {
@@ -2475,7 +2476,7 @@ function clipText(drawData, style, x, width) {
2475
2476
  if (i === end && charRight < right) {
2476
2477
  break;
2477
2478
  }
2478
- else if (charRight < right && char.char !== ' ') {
2479
+ else if ((charRight < right && char.char !== ' ') || !i) {
2479
2480
  row.data.splice(i + 1);
2480
2481
  row.width -= char.width;
2481
2482
  break;
@@ -2614,29 +2615,5 @@ try {
2614
2615
  }
2615
2616
  catch (_a) { }
2616
2617
 
2617
- const systemInfo = wx.getSystemInfoSync();
2618
- const platform = systemInfo.platform;
2619
- if (platform === 'ios') {
2620
- LeaferImage.prototype.getPattern = function (canvas, repeat, transform, paint) {
2621
- const pattern = Platform.canvas.createPattern(this.view, repeat);
2622
- const { width, height } = canvas;
2623
- if (this.width !== width || this.height !== height) {
2624
- if (!transform)
2625
- transform = MatrixHelper.get();
2626
- MatrixHelper.scale(transform, width / this.width, height / this.height);
2627
- }
2628
- try {
2629
- if (transform && pattern.setTransform) {
2630
- pattern.setTransform(transform);
2631
- transform = null;
2632
- }
2633
- }
2634
- catch (_a) { }
2635
- if (paint)
2636
- paint.transform = transform;
2637
- return pattern;
2638
- };
2639
- }
2640
-
2641
2618
  export { Interaction, Layouter, LeaferCanvas, Picker, Renderer, Selector, Watcher, useCanvas };
2642
2619
  //# sourceMappingURL=miniapp.esm.js.map