@leafer-ui/image 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/package.json +5 -5
- package/src/check.ts +1 -1
- package/src/data.ts +2 -1
- package/src/pattern.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/image",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
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": "1.4.
|
|
26
|
-
"@leafer-ui/draw": "1.4.
|
|
25
|
+
"@leafer/core": "1.4.1",
|
|
26
|
+
"@leafer-ui/draw": "1.4.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@leafer/interface": "1.4.
|
|
30
|
-
"@leafer-ui/interface": "1.4.
|
|
29
|
+
"@leafer/interface": "1.4.1",
|
|
30
|
+
"@leafer-ui/interface": "1.4.1"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/src/check.ts
CHANGED
|
@@ -40,7 +40,7 @@ export function checkImage(ui: IUI, canvas: ILeaferCanvas, paint: ILeafPaint, al
|
|
|
40
40
|
if (paint.blendMode) canvas.blendMode = paint.blendMode
|
|
41
41
|
if (data.opacity) canvas.opacity *= data.opacity
|
|
42
42
|
if (data.transform) canvas.transform(data.transform)
|
|
43
|
-
canvas.drawImage(paint.image.
|
|
43
|
+
canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height)
|
|
44
44
|
canvas.restore()
|
|
45
45
|
return true
|
|
46
46
|
} else {
|
package/src/data.ts
CHANGED
|
@@ -23,7 +23,7 @@ export function getPatternData(paint: IImagePaint, box: IBoundsData, image: ILea
|
|
|
23
23
|
if (paint.padding) box = tempBox.set(box).shrink(paint.padding)
|
|
24
24
|
if (paint.mode === 'strench' as string) paint.mode = 'stretch' // 兼容代码,后续可移除
|
|
25
25
|
|
|
26
|
-
const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint
|
|
26
|
+
const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint
|
|
27
27
|
const sameBox = box.width === width && box.height === height
|
|
28
28
|
|
|
29
29
|
const data: ILeafPaintPatternData = { mode }
|
|
@@ -86,6 +86,7 @@ export function getPatternData(paint: IImagePaint, box: IBoundsData, image: ILea
|
|
|
86
86
|
data.width = width
|
|
87
87
|
data.height = height
|
|
88
88
|
if (opacity) data.opacity = opacity
|
|
89
|
+
if (filters) data.filters = filters
|
|
89
90
|
if (repeat) data.repeat = typeof repeat === 'string' ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat'
|
|
90
91
|
return data
|
|
91
92
|
}
|
package/src/pattern.ts
CHANGED
|
@@ -18,7 +18,7 @@ export function createPattern(ui: IUI, paint: ILeafPaint, pixelRatio: number): b
|
|
|
18
18
|
scaleY = abs(scaleY)
|
|
19
19
|
|
|
20
20
|
const { image, data } = paint
|
|
21
|
-
let imageScale: number, imageMatrix: IMatrixData, { width, height, scaleX: sx, scaleY: sy,
|
|
21
|
+
let imageScale: number, imageMatrix: IMatrixData, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data
|
|
22
22
|
|
|
23
23
|
if (sx) {
|
|
24
24
|
imageMatrix = get()
|
|
@@ -68,7 +68,7 @@ export function createPattern(ui: IUI, paint: ILeafPaint, pixelRatio: number): b
|
|
|
68
68
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY)
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, opacity)
|
|
71
|
+
const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, data.opacity, data.filters)
|
|
72
72
|
const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || 'no-repeat'), imageMatrix, paint)
|
|
73
73
|
|
|
74
74
|
paint.style = pattern
|