@leafer-draw/miniapp 1.4.0 → 1.4.2

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, 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, 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 { PaintImage, ColorConvert, PaintGradient, Export, Group, TextConvert, Paint, Effect } from '@leafer-ui/draw';
@@ -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 = Run.start('PartLayout');
492
492
  const { target, __updatedList: updateList } = this;
@@ -1176,7 +1176,7 @@ function getPatternData(paint, box, image) {
1176
1176
  box = tempBox.set(box).shrink(paint.padding);
1177
1177
  if (paint.mode === 'strench')
1178
1178
  paint.mode = 'stretch';
1179
- const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
1179
+ const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
1180
1180
  const sameBox = box.width === width && box.height === height;
1181
1181
  const data = { mode };
1182
1182
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -1239,6 +1239,8 @@ function getPatternData(paint, box, image) {
1239
1239
  data.height = height;
1240
1240
  if (opacity)
1241
1241
  data.opacity = opacity;
1242
+ if (filters)
1243
+ data.filters = filters;
1242
1244
  if (repeat)
1243
1245
  data.repeat = typeof repeat === 'string' ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat';
1244
1246
  return data;
@@ -1341,7 +1343,7 @@ function createPattern(ui, paint, pixelRatio) {
1341
1343
  scaleX = abs$1(scaleX);
1342
1344
  scaleY = abs$1(scaleY);
1343
1345
  const { image, data } = paint;
1344
- let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform, repeat } = data;
1346
+ let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
1345
1347
  if (sx) {
1346
1348
  imageMatrix = get$1();
1347
1349
  copy$1(imageMatrix, transform);
@@ -1384,7 +1386,7 @@ function createPattern(ui, paint, pixelRatio) {
1384
1386
  }
1385
1387
  scale(imageMatrix, 1 / scaleX, 1 / scaleY);
1386
1388
  }
1387
- const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, opacity);
1389
+ const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, data.opacity, data.filters);
1388
1390
  const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || 'no-repeat'), imageMatrix, paint);
1389
1391
  paint.style = pattern;
1390
1392
  paint.patternId = id;
@@ -1460,7 +1462,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
1460
1462
  canvas.opacity *= data.opacity;
1461
1463
  if (data.transform)
1462
1464
  canvas.transform(data.transform);
1463
- canvas.drawImage(paint.image.view, 0, 0, data.width, data.height);
1465
+ canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height);
1464
1466
  canvas.restore();
1465
1467
  return true;
1466
1468
  }
@@ -1470,7 +1472,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
1470
1472
  }
1471
1473
  else {
1472
1474
  if (!paint.patternTask) {
1473
- paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, undefined, undefined, function* () {
1475
+ paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
1474
1476
  paint.patternTask = null;
1475
1477
  if (canvas.bounds.hit(ui.__nowWorld))
1476
1478
  createPattern(ui, paint, pixelRatio);