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