@leafer-draw/worker 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, Creator, LeaferImage, defineKey, FileHelper, LeafList, DataHelper, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, Bounds, LeafBoundsHelper, Debug, LeafLevelList, LayoutEvent, Run, ImageManager, ResizeEvent, BoundsHelper, MatrixHelper, MathHelper, AlignHelper, ImageEvent, AroundHelper, PointHelper, Direction4 } from '@leafer/core';
1
+ import { LeaferCanvasBase, Platform, canvasPatch, FileHelper, Creator, LeaferImage, defineKey, LeafList, DataHelper, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, LeafBoundsHelper, Bounds, Debug, LeafLevelList, LayoutEvent, Run, ImageManager, ResizeEvent, 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';
@@ -347,7 +347,7 @@ class Layouter {
347
347
  }
348
348
  partLayout() {
349
349
  var _a;
350
- if (!((_a = this.__updatedList) === null || _a === undefined ? undefined : _a.length))
350
+ if (!((_a = this.__updatedList) === null || _a === void 0 ? void 0 : _a.length))
351
351
  return;
352
352
  const t = Run.start('PartLayout');
353
353
  const { target, __updatedList: updateList } = this;
@@ -1037,7 +1037,7 @@ function getPatternData(paint, box, image) {
1037
1037
  box = tempBox.set(box).shrink(paint.padding);
1038
1038
  if (paint.mode === 'strench')
1039
1039
  paint.mode = 'stretch';
1040
- const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
1040
+ const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
1041
1041
  const sameBox = box.width === width && box.height === height;
1042
1042
  const data = { mode };
1043
1043
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -1100,6 +1100,8 @@ function getPatternData(paint, box, image) {
1100
1100
  data.height = height;
1101
1101
  if (opacity)
1102
1102
  data.opacity = opacity;
1103
+ if (filters)
1104
+ data.filters = filters;
1103
1105
  if (repeat)
1104
1106
  data.repeat = typeof repeat === 'string' ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat';
1105
1107
  return data;
@@ -1202,7 +1204,7 @@ function createPattern(ui, paint, pixelRatio) {
1202
1204
  scaleX = abs$1(scaleX);
1203
1205
  scaleY = abs$1(scaleY);
1204
1206
  const { image, data } = paint;
1205
- let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform, repeat } = data;
1207
+ let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
1206
1208
  if (sx) {
1207
1209
  imageMatrix = get$1();
1208
1210
  copy$1(imageMatrix, transform);
@@ -1245,7 +1247,7 @@ function createPattern(ui, paint, pixelRatio) {
1245
1247
  }
1246
1248
  scale(imageMatrix, 1 / scaleX, 1 / scaleY);
1247
1249
  }
1248
- const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, opacity);
1250
+ const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, data.opacity, data.filters);
1249
1251
  const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || 'no-repeat'), imageMatrix, paint);
1250
1252
  paint.style = pattern;
1251
1253
  paint.patternId = id;
@@ -1321,7 +1323,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
1321
1323
  canvas.opacity *= data.opacity;
1322
1324
  if (data.transform)
1323
1325
  canvas.transform(data.transform);
1324
- canvas.drawImage(paint.image.view, 0, 0, data.width, data.height);
1326
+ canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height);
1325
1327
  canvas.restore();
1326
1328
  return true;
1327
1329
  }
@@ -1331,7 +1333,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
1331
1333
  }
1332
1334
  else {
1333
1335
  if (!paint.patternTask) {
1334
- paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, undefined, undefined, function* () {
1336
+ paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
1335
1337
  paint.patternTask = null;
1336
1338
  if (canvas.bounds.hit(ui.__nowWorld))
1337
1339
  createPattern(ui, paint, pixelRatio);