@leafer-ui/image 2.0.2 → 2.0.3

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.0.2",
3
+ "version": "2.0.3",
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.0.2",
26
- "@leafer-ui/draw": "2.0.2"
25
+ "@leafer/core": "2.0.3",
26
+ "@leafer-ui/draw": "2.0.3"
27
27
  },
28
28
  "devDependencies": {
29
- "@leafer/interface": "2.0.2",
30
- "@leafer-ui/interface": "2.0.2"
29
+ "@leafer/interface": "2.0.3",
30
+ "@leafer-ui/interface": "2.0.3"
31
31
  }
32
32
  }
package/src/image.ts CHANGED
@@ -108,6 +108,9 @@ function checkSizeAndCreateData(ui: IUI, attrName: string, paint: IImagePaint, i
108
108
  const clip = (transform && !transform.onlyScale) || data.path || data.cornerRadius
109
109
  if (clip || (opacity && opacity < 1) || blendMode) leafPaint.complex = clip ? 2 : true
110
110
  }
111
+
112
+ if (paint.filter) PaintImage.applyFilter(leafPaint, image, paint.filter, ui)
113
+
111
114
  return true
112
115
  }
113
116
 
package/src/pattern.ts CHANGED
@@ -26,7 +26,7 @@ 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, data } = paint, { opacity, filters } = paint.originPaint as IImagePaint, { transform, gap } = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY)
29
+ const { image, data } = paint, { opacity } = paint.originPaint as IImagePaint, { transform, gap } = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY)
30
30
  let imageMatrix: IMatrixData, xGap: number, yGap: number, { width, height } = image
31
31
 
32
32
  if (fixScale) scaleX *= fixScale, scaleY *= fixScale
@@ -49,7 +49,7 @@ export function createPattern(paint: ILeafPaint, ui: IUI, canvas: ILeaferCanvas,
49
49
  scale(imageMatrix, 1 / scaleX, 1 / scaleY)
50
50
  }
51
51
 
52
- const imageCanvas = image.getCanvas(width, height, opacity, filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace)
52
+ const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace)
53
53
  const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || 'no-repeat'), imageMatrix, paint)
54
54
 
55
55
  paint.style = pattern
package/src/recycle.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { IBooleanMap, ILeaferImage, IObject } from '@leafer/interface'
2
2
  import { ImageManager, isArray } from '@leafer/core'
3
3
 
4
- import { IImagePaint, ILeafPaint, IPaintAttr, IUIData } from '@leafer-ui/interface'
4
+ import { IImagePaint, ILeafPaint, IPaintAttr, IUI, IUIData } from '@leafer-ui/interface'
5
+ import { PaintImage } from "@leafer-ui/draw"
5
6
 
6
7
 
7
8
  export function recycleImage(attrName: IPaintAttr, data: IUIData): IBooleanMap {
@@ -21,6 +22,7 @@ export function recycleImage(attrName: IPaintAttr, data: IUIData): IBooleanMap {
21
22
  if (!recycleMap) recycleMap = {}
22
23
  recycleMap[url] = true
23
24
  ImageManager.recyclePaint(paint)
25
+ if (data.__willDestroy && image.parent) PaintImage.recycleFilter(image, data.__leaf as IUI)
24
26
 
25
27
  // stop load
26
28
  if (image.loading) {