@leafer-ui/miniapp 1.3.3 → 1.4.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.
package/dist/miniapp.cjs CHANGED
@@ -486,7 +486,7 @@ class Layouter {
486
486
  }
487
487
  partLayout() {
488
488
  var _a;
489
- if (!((_a = this.__updatedList) === null || _a === undefined ? undefined : _a.length))
489
+ if (!((_a = this.__updatedList) === null || _a === void 0 ? void 0 : _a.length))
490
490
  return;
491
491
  const t = core.Run.start('PartLayout');
492
492
  const { target, __updatedList: updateList } = this;
@@ -951,9 +951,10 @@ class Selector {
951
951
  this.finder = core.Creator.finder && core.Creator.finder();
952
952
  }
953
953
  getByPoint(hitPoint, hitRadius, options) {
954
- if (core.Platform.backgrounder && this.target)
955
- this.target.updateLayout();
956
- return this.picker.getByPoint(hitPoint, hitRadius, options);
954
+ const { target, picker } = this;
955
+ if (core.Platform.backgrounder)
956
+ target && target.updateLayout();
957
+ return picker.getByPoint(hitPoint, hitRadius, options);
957
958
  }
958
959
  getBy(condition, branch, one, options) {
959
960
  return this.finder ? this.finder.getBy(condition, branch, one, options) : core.Plugin.need('find');
@@ -1437,7 +1438,7 @@ function getPatternData(paint, box, image) {
1437
1438
  box = tempBox.set(box).shrink(paint.padding);
1438
1439
  if (paint.mode === 'strench')
1439
1440
  paint.mode = 'stretch';
1440
- const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
1441
+ const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
1441
1442
  const sameBox = box.width === width && box.height === height;
1442
1443
  const data = { mode };
1443
1444
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -1500,6 +1501,8 @@ function getPatternData(paint, box, image) {
1500
1501
  data.height = height;
1501
1502
  if (opacity)
1502
1503
  data.opacity = opacity;
1504
+ if (filters)
1505
+ data.filters = filters;
1503
1506
  if (repeat)
1504
1507
  data.repeat = typeof repeat === 'string' ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat';
1505
1508
  return data;
@@ -1602,7 +1605,7 @@ function createPattern(ui, paint, pixelRatio) {
1602
1605
  scaleX = abs$1(scaleX);
1603
1606
  scaleY = abs$1(scaleY);
1604
1607
  const { image, data } = paint;
1605
- let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform, repeat } = data;
1608
+ let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
1606
1609
  if (sx) {
1607
1610
  imageMatrix = get$1();
1608
1611
  copy$1(imageMatrix, transform);
@@ -1645,7 +1648,7 @@ function createPattern(ui, paint, pixelRatio) {
1645
1648
  }
1646
1649
  scale(imageMatrix, 1 / scaleX, 1 / scaleY);
1647
1650
  }
1648
- const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, opacity);
1651
+ const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, data.opacity, data.filters);
1649
1652
  const pattern = image.getPattern(canvas, repeat || (core.Platform.origin.noRepeat || 'no-repeat'), imageMatrix, paint);
1650
1653
  paint.style = pattern;
1651
1654
  paint.patternId = id;
@@ -1721,7 +1724,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
1721
1724
  canvas.opacity *= data.opacity;
1722
1725
  if (data.transform)
1723
1726
  canvas.transform(data.transform);
1724
- canvas.drawImage(paint.image.view, 0, 0, data.width, data.height);
1727
+ canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height);
1725
1728
  canvas.restore();
1726
1729
  return true;
1727
1730
  }
@@ -1731,7 +1734,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
1731
1734
  }
1732
1735
  else {
1733
1736
  if (!paint.patternTask) {
1734
- paint.patternTask = core.ImageManager.patternTasker.add(() => __awaiter(this, undefined, undefined, function* () {
1737
+ paint.patternTask = core.ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
1735
1738
  paint.patternTask = null;
1736
1739
  if (canvas.bounds.hit(ui.__nowWorld))
1737
1740
  createPattern(ui, paint, pixelRatio);
@@ -2321,11 +2324,11 @@ const TextMode = 2;
2321
2324
  function layoutChar(drawData, style, width, _height) {
2322
2325
  const { rows } = drawData;
2323
2326
  const { textAlign, paraIndent, letterSpacing } = style;
2324
- let charX, addWordWidth, indentWidth, mode, wordChar;
2327
+ let charX, addWordWidth, indentWidth, mode, wordChar, wordsLength;
2325
2328
  rows.forEach(row => {
2326
2329
  if (row.words) {
2327
- indentWidth = paraIndent && row.paraStart ? paraIndent : 0;
2328
- addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
2330
+ indentWidth = paraIndent && row.paraStart ? paraIndent : 0, wordsLength = row.words.length;
2331
+ addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && wordsLength > 1) ? (width - row.width - indentWidth) / (wordsLength - 1) : 0;
2329
2332
  mode = (letterSpacing || row.isOverflow) ? CharMode : (addWordWidth > 0.01 ? WordMode : TextMode);
2330
2333
  if (row.isOverflow && !letterSpacing)
2331
2334
  row.textMode = true;
@@ -2337,7 +2340,7 @@ function layoutChar(drawData, style, width, _height) {
2337
2340
  row.x += indentWidth;
2338
2341
  charX = row.x;
2339
2342
  row.data = [];
2340
- row.words.forEach(word => {
2343
+ row.words.forEach((word, index) => {
2341
2344
  if (mode === WordMode) {
2342
2345
  wordChar = { char: '', x: charX };
2343
2346
  charX = toWordChar(word.data, charX, wordChar);
@@ -2347,7 +2350,7 @@ function layoutChar(drawData, style, width, _height) {
2347
2350
  else {
2348
2351
  charX = toChar(word.data, charX, row.data, row.isOverflow);
2349
2352
  }
2350
- if (addWordWidth && (!row.paraEnd || textAlign === 'both')) {
2353
+ if (addWordWidth && (!row.paraEnd || textAlign === 'both') && (index !== wordsLength - 1)) {
2351
2354
  charX += addWordWidth;
2352
2355
  row.width += addWordWidth;
2353
2356
  }
@@ -2658,3 +2661,4 @@ Object.keys(core$1).forEach(function (k) {
2658
2661
  get: function () { return core$1[k]; }
2659
2662
  });
2660
2663
  });
2664
+ //# sourceMappingURL=miniapp.cjs.map