@leafer-ui/image 1.12.3 → 2.0.0
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 +2 -2
- package/src/data.ts +3 -2
- package/src/image.ts +1 -1
- package/src/pattern.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/image",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
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": "
|
|
26
|
-
"@leafer-ui/draw": "
|
|
25
|
+
"@leafer/core": "2.0.0",
|
|
26
|
+
"@leafer-ui/draw": "2.0.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@leafer/interface": "
|
|
30
|
-
"@leafer-ui/interface": "
|
|
29
|
+
"@leafer/interface": "2.0.0",
|
|
30
|
+
"@leafer-ui/interface": "2.0.0"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/src/check.ts
CHANGED
|
@@ -7,9 +7,9 @@ import { PaintImage } from "@leafer-ui/draw"
|
|
|
7
7
|
|
|
8
8
|
export function checkImage(paint: ILeafPaint, drawImage: boolean, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): boolean {
|
|
9
9
|
const { scaleX, scaleY } = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions)
|
|
10
|
-
const { image, data, originPaint } = paint, { exporting } = renderOptions
|
|
10
|
+
const { image, data, originPaint } = paint, { exporting, snapshot } = renderOptions
|
|
11
11
|
|
|
12
|
-
if (!data || (paint.patternId === scaleX + '-' + scaleY && !exporting)) {
|
|
12
|
+
if (!data || (paint.patternId === scaleX + '-' + scaleY && !exporting) || snapshot) {
|
|
13
13
|
return false // 生成图案中
|
|
14
14
|
} else {
|
|
15
15
|
|
package/src/data.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IBoundsData, IGap, ILeaferImage, IPointData, IPointGap, IScaleData } from '@leafer/interface'
|
|
2
|
-
import { MatrixHelper, MathHelper, Bounds, AlignHelper, BoundsHelper, PointHelper, isObject, isString } from '@leafer/core'
|
|
2
|
+
import { MatrixHelper, MathHelper, Bounds, AlignHelper, BoundsHelper, PointHelper, isObject, isString, isNumber } from '@leafer/core'
|
|
3
3
|
|
|
4
4
|
import { IImagePaint, ILeafPaint, ILeafPaintPatternData } from '@leafer-ui/interface'
|
|
5
5
|
import { PaintImage } from "@leafer-ui/draw"
|
|
@@ -19,7 +19,7 @@ export function getPatternData(paint: IImagePaint, box: IBoundsData, image: ILea
|
|
|
19
19
|
if (paint.mode === 'strench' as string) paint.mode = 'stretch' // 兼容代码,后续可移除
|
|
20
20
|
|
|
21
21
|
const { width, height } = image
|
|
22
|
-
const { opacity, mode, align, offset, scale, size, rotation, skew, clipSize, repeat, gap, filters } = paint
|
|
22
|
+
const { opacity, mode, align, offset, scale, size, rotation, skew, clipSize, repeat, gap, filters, interlace } = paint
|
|
23
23
|
const sameBox = box.width === width && box.height === height
|
|
24
24
|
|
|
25
25
|
const data: ILeafPaintPatternData = { mode }
|
|
@@ -89,6 +89,7 @@ export function getPatternData(paint: IImagePaint, box: IBoundsData, image: ILea
|
|
|
89
89
|
if (opacity && opacity < 1) data.opacity = opacity
|
|
90
90
|
if (filters) data.filters = filters
|
|
91
91
|
if (repeat) data.repeat = isString(repeat) ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat'
|
|
92
|
+
if (interlace) data.interlace = (isNumber(interlace) || interlace.type === 'percent') ? { type: 'x', offset: interlace } : interlace
|
|
92
93
|
return data
|
|
93
94
|
}
|
|
94
95
|
|
package/src/image.ts
CHANGED
|
@@ -66,7 +66,7 @@ export function image(ui: IUI, attrName: string, paint: IImagePaint, boxBounds:
|
|
|
66
66
|
onLoadError(ui, event, error)
|
|
67
67
|
leafPaint.loadId = undefined
|
|
68
68
|
},
|
|
69
|
-
paint.lod && image.getThumbSize()
|
|
69
|
+
paint.lod && image.getThumbSize(paint.lod)
|
|
70
70
|
)
|
|
71
71
|
|
|
72
72
|
if (ui.placeholderColor) {
|
package/src/pattern.ts
CHANGED
|
@@ -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, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth)
|
|
52
|
+
const imageCanvas = image.getCanvas(width, height, data.opacity, data.filters, 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
|