leafer-draw 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.
package/dist/web.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Debug, LeaferCanvasBase, Platform, DataHelper, canvasSizeAttrs, ResizeEvent, canvasPatch, Creator, LeaferImage, defineKey, FileHelper, LeafList, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, Bounds, LeafBoundsHelper, LeafLevelList, LayoutEvent, Run, ImageManager, BoundsHelper, MatrixHelper, MathHelper, AlignHelper, ImageEvent, AroundHelper, PointHelper, Direction4 } from '@leafer/core';
1
+ import { Debug, LeaferCanvasBase, Platform, DataHelper, canvasSizeAttrs, ResizeEvent, canvasPatch, FileHelper, Creator, LeaferImage, defineKey, LeafList, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, LeafBoundsHelper, Bounds, 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';
@@ -259,7 +259,7 @@ if (userAgent.indexOf("Firefox") > -1) {
259
259
  Platform.intWheelDeltaY = true;
260
260
  Platform.syncDomFont = true;
261
261
  }
262
- else if (userAgent.indexOf("Safari") > -1 && userAgent.indexOf("Chrome") === -1) {
262
+ else if (userAgent.indexOf("AppleWebKit") > -1) {
263
263
  Platform.fullImageShadow = true;
264
264
  }
265
265
  if (userAgent.indexOf('Windows') > -1) {
@@ -528,7 +528,7 @@ class Layouter {
528
528
  }
529
529
  partLayout() {
530
530
  var _a;
531
- if (!((_a = this.__updatedList) === null || _a === undefined ? undefined : _a.length))
531
+ if (!((_a = this.__updatedList) === null || _a === void 0 ? void 0 : _a.length))
532
532
  return;
533
533
  const t = Run.start('PartLayout');
534
534
  const { target, __updatedList: updateList } = this;
@@ -1218,7 +1218,7 @@ function getPatternData(paint, box, image) {
1218
1218
  box = tempBox.set(box).shrink(paint.padding);
1219
1219
  if (paint.mode === 'strench')
1220
1220
  paint.mode = 'stretch';
1221
- const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
1221
+ const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
1222
1222
  const sameBox = box.width === width && box.height === height;
1223
1223
  const data = { mode };
1224
1224
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -1281,6 +1281,8 @@ function getPatternData(paint, box, image) {
1281
1281
  data.height = height;
1282
1282
  if (opacity)
1283
1283
  data.opacity = opacity;
1284
+ if (filters)
1285
+ data.filters = filters;
1284
1286
  if (repeat)
1285
1287
  data.repeat = typeof repeat === 'string' ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat';
1286
1288
  return data;
@@ -1383,7 +1385,7 @@ function createPattern(ui, paint, pixelRatio) {
1383
1385
  scaleX = abs$1(scaleX);
1384
1386
  scaleY = abs$1(scaleY);
1385
1387
  const { image, data } = paint;
1386
- let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform, repeat } = data;
1388
+ let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
1387
1389
  if (sx) {
1388
1390
  imageMatrix = get$1();
1389
1391
  copy$1(imageMatrix, transform);
@@ -1426,7 +1428,7 @@ function createPattern(ui, paint, pixelRatio) {
1426
1428
  }
1427
1429
  scale(imageMatrix, 1 / scaleX, 1 / scaleY);
1428
1430
  }
1429
- const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, opacity);
1431
+ const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, data.opacity, data.filters);
1430
1432
  const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || 'no-repeat'), imageMatrix, paint);
1431
1433
  paint.style = pattern;
1432
1434
  paint.patternId = id;
@@ -1502,7 +1504,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
1502
1504
  canvas.opacity *= data.opacity;
1503
1505
  if (data.transform)
1504
1506
  canvas.transform(data.transform);
1505
- canvas.drawImage(paint.image.view, 0, 0, data.width, data.height);
1507
+ canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height);
1506
1508
  canvas.restore();
1507
1509
  return true;
1508
1510
  }
@@ -1512,7 +1514,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
1512
1514
  }
1513
1515
  else {
1514
1516
  if (!paint.patternTask) {
1515
- paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, undefined, undefined, function* () {
1517
+ paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
1516
1518
  paint.patternTask = null;
1517
1519
  if (canvas.bounds.hit(ui.__nowWorld))
1518
1520
  createPattern(ui, paint, pixelRatio);