@leafer-ui/image 2.1.5 → 2.1.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/image",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "description": "@leafer-ui/image",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,11 +22,11 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/core": "2.1.5",
26
- "@leafer-ui/draw": "2.1.5"
25
+ "@leafer/core": "2.1.6",
26
+ "@leafer-ui/draw": "2.1.6"
27
27
  },
28
28
  "devDependencies": {
29
- "@leafer/interface": "2.1.5",
30
- "@leafer-ui/interface": "2.1.5"
29
+ "@leafer/interface": "2.1.6",
30
+ "@leafer-ui/interface": "2.1.6"
31
31
  }
32
32
  }
package/src/data.ts CHANGED
@@ -66,8 +66,8 @@ export function getPatternData(paint: IImagePaint, box: IBoundsData, image: ILea
66
66
  }
67
67
  break
68
68
  case 'repeat':
69
- case 'brush':
70
69
  if (!sameBox || scaleX || rotation || skew) PaintImage.repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, align, paint.freeTransform)
70
+ case 'brush':
71
71
  if (!repeat) data.repeat = 'repeat'
72
72
  const count = isObject(repeat)
73
73
  if (gap || count) data.gap = getGapData(gap, count && repeat, tempImage.width, tempImage.height, box)
@@ -78,7 +78,7 @@ export function getPatternData(paint: IImagePaint, box: IBoundsData, image: ILea
78
78
  if (scaleX) PaintImage.fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation)
79
79
  }
80
80
 
81
- if (!data.transform) {
81
+ if (!data.transform && mode !== 'brush') {
82
82
  if (box.x || box.y) translate(data.transform = get(), box.x, box.y)
83
83
  }
84
84
 
package/src/pattern.ts CHANGED
@@ -26,9 +26,10 @@ export function createPattern(paint: ILeafPaint, ui: IUI, canvas: ILeaferCanvas,
26
26
  if (paint.patternId !== id && !ui.destroyed) {
27
27
  if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
28
28
 
29
- const { image, brush, data } = paint, { opacity } = paint.originPaint as IImagePaint, { transform, gap } = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY)
30
- let imageMatrix: IMatrixData, xGap: number, yGap: number, { width, height } = image
29
+ const { image, brush, data } = paint, { transform, gap } = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY)
30
+ let imageMatrix: IMatrixData, xGap: number, yGap: number, { width, height } = image, { opacity } = paint.originPaint as IImagePaint
31
31
 
32
+ if (brush || opacity === 1) opacity = undefined
32
33
  if (fixScale) scaleX *= fixScale, scaleY *= fixScale
33
34
 
34
35
  width *= scaleX