@leafer-draw/worker 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.
package/dist/worker.cjs CHANGED
@@ -346,7 +346,7 @@ class Layouter {
346
346
  }
347
347
  partLayout() {
348
348
  var _a;
349
- if (!((_a = this.__updatedList) === null || _a === undefined ? undefined : _a.length))
349
+ if (!((_a = this.__updatedList) === null || _a === void 0 ? void 0 : _a.length))
350
350
  return;
351
351
  const t = core.Run.start('PartLayout');
352
352
  const { target, __updatedList: updateList } = this;
@@ -1036,7 +1036,7 @@ function getPatternData(paint, box, image) {
1036
1036
  box = tempBox.set(box).shrink(paint.padding);
1037
1037
  if (paint.mode === 'strench')
1038
1038
  paint.mode = 'stretch';
1039
- const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
1039
+ const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
1040
1040
  const sameBox = box.width === width && box.height === height;
1041
1041
  const data = { mode };
1042
1042
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -1099,6 +1099,8 @@ function getPatternData(paint, box, image) {
1099
1099
  data.height = height;
1100
1100
  if (opacity)
1101
1101
  data.opacity = opacity;
1102
+ if (filters)
1103
+ data.filters = filters;
1102
1104
  if (repeat)
1103
1105
  data.repeat = typeof repeat === 'string' ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat';
1104
1106
  return data;
@@ -1201,7 +1203,7 @@ function createPattern(ui, paint, pixelRatio) {
1201
1203
  scaleX = abs$1(scaleX);
1202
1204
  scaleY = abs$1(scaleY);
1203
1205
  const { image, data } = paint;
1204
- let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform, repeat } = data;
1206
+ let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
1205
1207
  if (sx) {
1206
1208
  imageMatrix = get$1();
1207
1209
  copy$1(imageMatrix, transform);
@@ -1244,7 +1246,7 @@ function createPattern(ui, paint, pixelRatio) {
1244
1246
  }
1245
1247
  scale(imageMatrix, 1 / scaleX, 1 / scaleY);
1246
1248
  }
1247
- const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, opacity);
1249
+ const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, data.opacity, data.filters);
1248
1250
  const pattern = image.getPattern(canvas, repeat || (core.Platform.origin.noRepeat || 'no-repeat'), imageMatrix, paint);
1249
1251
  paint.style = pattern;
1250
1252
  paint.patternId = id;
@@ -1320,7 +1322,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
1320
1322
  canvas.opacity *= data.opacity;
1321
1323
  if (data.transform)
1322
1324
  canvas.transform(data.transform);
1323
- canvas.drawImage(paint.image.view, 0, 0, data.width, data.height);
1325
+ canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height);
1324
1326
  canvas.restore();
1325
1327
  return true;
1326
1328
  }
@@ -1330,7 +1332,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
1330
1332
  }
1331
1333
  else {
1332
1334
  if (!paint.patternTask) {
1333
- paint.patternTask = core.ImageManager.patternTasker.add(() => __awaiter(this, undefined, undefined, function* () {
1335
+ paint.patternTask = core.ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
1334
1336
  paint.patternTask = null;
1335
1337
  if (canvas.bounds.hit(ui.__nowWorld))
1336
1338
  createPattern(ui, paint, pixelRatio);