@leafer-ui/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.
@@ -1,7 +1,7 @@
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, Plugin, 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, 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
- import { InteractionBase, HitCanvasManager } from '@leafer-ui/core';
4
+ import { HitCanvasManager, InteractionBase } from '@leafer-ui/core';
5
5
  export * from '@leafer-ui/core';
6
6
  import { PaintImage, ColorConvert, PaintGradient, Export, Group, TextConvert, Paint, Effect } from '@leafer-ui/draw';
7
7
 
@@ -348,7 +348,7 @@ class Layouter {
348
348
  }
349
349
  partLayout() {
350
350
  var _a;
351
- if (!((_a = this.__updatedList) === null || _a === undefined ? undefined : _a.length))
351
+ if (!((_a = this.__updatedList) === null || _a === void 0 ? void 0 : _a.length))
352
352
  return;
353
353
  const t = Run.start('PartLayout');
354
354
  const { target, __updatedList: updateList } = this;
@@ -813,9 +813,10 @@ class Selector {
813
813
  this.finder = Creator.finder && Creator.finder();
814
814
  }
815
815
  getByPoint(hitPoint, hitRadius, options) {
816
- if (Platform.backgrounder && this.target)
817
- this.target.updateLayout();
818
- return this.picker.getByPoint(hitPoint, hitRadius, options);
816
+ const { target, picker } = this;
817
+ if (Platform.backgrounder)
818
+ target && target.updateLayout();
819
+ return picker.getByPoint(hitPoint, hitRadius, options);
819
820
  }
820
821
  getBy(condition, branch, one, options) {
821
822
  return this.finder ? this.finder.getBy(condition, branch, one, options) : Plugin.need('find');
@@ -1194,7 +1195,7 @@ function getPatternData(paint, box, image) {
1194
1195
  box = tempBox.set(box).shrink(paint.padding);
1195
1196
  if (paint.mode === 'strench')
1196
1197
  paint.mode = 'stretch';
1197
- const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
1198
+ const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
1198
1199
  const sameBox = box.width === width && box.height === height;
1199
1200
  const data = { mode };
1200
1201
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -1257,6 +1258,8 @@ function getPatternData(paint, box, image) {
1257
1258
  data.height = height;
1258
1259
  if (opacity)
1259
1260
  data.opacity = opacity;
1261
+ if (filters)
1262
+ data.filters = filters;
1260
1263
  if (repeat)
1261
1264
  data.repeat = typeof repeat === 'string' ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat';
1262
1265
  return data;
@@ -1359,7 +1362,7 @@ function createPattern(ui, paint, pixelRatio) {
1359
1362
  scaleX = abs$1(scaleX);
1360
1363
  scaleY = abs$1(scaleY);
1361
1364
  const { image, data } = paint;
1362
- let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform, repeat } = data;
1365
+ let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
1363
1366
  if (sx) {
1364
1367
  imageMatrix = get$1();
1365
1368
  copy$1(imageMatrix, transform);
@@ -1402,7 +1405,7 @@ function createPattern(ui, paint, pixelRatio) {
1402
1405
  }
1403
1406
  scale(imageMatrix, 1 / scaleX, 1 / scaleY);
1404
1407
  }
1405
- const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, opacity);
1408
+ const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, data.opacity, data.filters);
1406
1409
  const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || 'no-repeat'), imageMatrix, paint);
1407
1410
  paint.style = pattern;
1408
1411
  paint.patternId = id;
@@ -1478,7 +1481,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
1478
1481
  canvas.opacity *= data.opacity;
1479
1482
  if (data.transform)
1480
1483
  canvas.transform(data.transform);
1481
- canvas.drawImage(paint.image.view, 0, 0, data.width, data.height);
1484
+ canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height);
1482
1485
  canvas.restore();
1483
1486
  return true;
1484
1487
  }
@@ -1488,7 +1491,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
1488
1491
  }
1489
1492
  else {
1490
1493
  if (!paint.patternTask) {
1491
- paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, undefined, undefined, function* () {
1494
+ paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
1492
1495
  paint.patternTask = null;
1493
1496
  if (canvas.bounds.hit(ui.__nowWorld))
1494
1497
  createPattern(ui, paint, pixelRatio);