@leafer-ui/miniapp 1.4.0 → 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.
@@ -1,4 +1,4 @@
1
- import { LeaferCanvasBase, Platform, canvasPatch, DataHelper, canvasSizeAttrs, ResizeEvent, Creator, LeaferImage, defineKey, FileHelper, LeafList, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, Bounds, LeafBoundsHelper, Debug, LeafLevelList, LayoutEvent, Run, ImageManager, BoundsHelper, Plugin, MatrixHelper, MathHelper, AlignHelper, ImageEvent, AroundHelper, PointHelper, Direction4 } from '@leafer/core';
1
+ import { LeaferCanvasBase, Platform, canvasPatch, DataHelper, canvasSizeAttrs, ResizeEvent, FileHelper, Creator, LeaferImage, defineKey, LeafList, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, LeafBoundsHelper, Bounds, Debug, LeafLevelList, LayoutEvent, Run, ImageManager, BoundsHelper, Plugin, MatrixHelper, MathHelper, AlignHelper, ImageEvent, AroundHelper, PointHelper, Direction4 } from '@leafer/core';
2
2
  export * from '@leafer/core';
3
3
  export { LeaferImage } from '@leafer/core';
4
4
  import { InteractionHelper, InteractionBase, HitCanvasManager } from '@leafer-ui/core';
@@ -487,7 +487,7 @@ class Layouter {
487
487
  }
488
488
  partLayout() {
489
489
  var _a;
490
- if (!((_a = this.__updatedList) === null || _a === undefined ? undefined : _a.length))
490
+ if (!((_a = this.__updatedList) === null || _a === void 0 ? void 0 : _a.length))
491
491
  return;
492
492
  const t = Run.start('PartLayout');
493
493
  const { target, __updatedList: updateList } = this;
@@ -952,9 +952,10 @@ class Selector {
952
952
  this.finder = Creator.finder && Creator.finder();
953
953
  }
954
954
  getByPoint(hitPoint, hitRadius, options) {
955
- if (Platform.backgrounder && this.target)
956
- this.target.updateLayout();
957
- return this.picker.getByPoint(hitPoint, hitRadius, options);
955
+ const { target, picker } = this;
956
+ if (Platform.backgrounder)
957
+ target && target.updateLayout();
958
+ return picker.getByPoint(hitPoint, hitRadius, options);
958
959
  }
959
960
  getBy(condition, branch, one, options) {
960
961
  return this.finder ? this.finder.getBy(condition, branch, one, options) : Plugin.need('find');
@@ -1438,7 +1439,7 @@ function getPatternData(paint, box, image) {
1438
1439
  box = tempBox.set(box).shrink(paint.padding);
1439
1440
  if (paint.mode === 'strench')
1440
1441
  paint.mode = 'stretch';
1441
- const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
1442
+ const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
1442
1443
  const sameBox = box.width === width && box.height === height;
1443
1444
  const data = { mode };
1444
1445
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -1501,6 +1502,8 @@ function getPatternData(paint, box, image) {
1501
1502
  data.height = height;
1502
1503
  if (opacity)
1503
1504
  data.opacity = opacity;
1505
+ if (filters)
1506
+ data.filters = filters;
1504
1507
  if (repeat)
1505
1508
  data.repeat = typeof repeat === 'string' ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat';
1506
1509
  return data;
@@ -1603,7 +1606,7 @@ function createPattern(ui, paint, pixelRatio) {
1603
1606
  scaleX = abs$1(scaleX);
1604
1607
  scaleY = abs$1(scaleY);
1605
1608
  const { image, data } = paint;
1606
- let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform, repeat } = data;
1609
+ let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
1607
1610
  if (sx) {
1608
1611
  imageMatrix = get$1();
1609
1612
  copy$1(imageMatrix, transform);
@@ -1646,7 +1649,7 @@ function createPattern(ui, paint, pixelRatio) {
1646
1649
  }
1647
1650
  scale(imageMatrix, 1 / scaleX, 1 / scaleY);
1648
1651
  }
1649
- const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, opacity);
1652
+ const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, data.opacity, data.filters);
1650
1653
  const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || 'no-repeat'), imageMatrix, paint);
1651
1654
  paint.style = pattern;
1652
1655
  paint.patternId = id;
@@ -1722,7 +1725,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
1722
1725
  canvas.opacity *= data.opacity;
1723
1726
  if (data.transform)
1724
1727
  canvas.transform(data.transform);
1725
- canvas.drawImage(paint.image.view, 0, 0, data.width, data.height);
1728
+ canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height);
1726
1729
  canvas.restore();
1727
1730
  return true;
1728
1731
  }
@@ -1732,7 +1735,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
1732
1735
  }
1733
1736
  else {
1734
1737
  if (!paint.patternTask) {
1735
- paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, undefined, undefined, function* () {
1738
+ paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
1736
1739
  paint.patternTask = null;
1737
1740
  if (canvas.bounds.hit(ui.__nowWorld))
1738
1741
  createPattern(ui, paint, pixelRatio);