@leafer-ui/image 1.0.0-rc.25 → 1.0.0-rc.26

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": "1.0.0-rc.25",
3
+ "version": "1.0.0-rc.26",
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.0.0-rc.25",
26
- "@leafer-ui/draw": "1.0.0-rc.25"
25
+ "@leafer/core": "1.0.0-rc.26",
26
+ "@leafer-ui/draw": "1.0.0-rc.26"
27
27
  },
28
28
  "devDependencies": {
29
- "@leafer/interface": "1.0.0-rc.25",
30
- "@leafer-ui/interface": "1.0.0-rc.25"
29
+ "@leafer/interface": "1.0.0-rc.26",
30
+ "@leafer-ui/interface": "1.0.0-rc.26"
31
31
  }
32
32
  }
package/src/data.ts CHANGED
@@ -11,14 +11,19 @@ const tempBox = new Bounds()
11
11
  const tempPoint = {} as IPointData
12
12
 
13
13
  export function createData(leafPaint: ILeafPaint, image: ILeaferImage, paint: IImagePaint, box: IBoundsData): void {
14
+ const { blendMode } = paint
15
+ if (blendMode) leafPaint.blendMode = blendMode
16
+ leafPaint.data = getPatternData(paint, box, image)
17
+ }
18
+
19
+ export function getPatternData(paint: IImagePaint, box: IBoundsData, image: ILeaferImage): ILeafPaintPatternData {
14
20
  let { width, height } = image
15
21
  if (paint.padding) box = tempBox.set(box).shrink(paint.padding)
16
22
 
17
- const { opacity, mode, align, offset, scale, size, rotation, blendMode, repeat } = paint
23
+ const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint
18
24
  const sameBox = box.width === width && box.height === height
19
- if (blendMode) leafPaint.blendMode = blendMode
20
25
 
21
- const data: ILeafPaintPatternData = leafPaint.data = { mode }
26
+ const data: ILeafPaintPatternData = { mode }
22
27
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90
23
28
  const swapWidth = swapSize ? height : width, swapHeight = swapSize ? width : height
24
29
 
@@ -81,4 +86,5 @@ export function createData(leafPaint: ILeafPaint, image: ILeaferImage, paint: II
81
86
  data.height = height
82
87
  if (opacity) data.opacity = opacity
83
88
  if (repeat) data.repeat = typeof repeat === 'string' ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat'
84
- }
89
+ return data
90
+ }
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { IPaintImageModule } from '@leafer-ui/interface'
2
2
 
3
3
  import { image } from './image'
4
- import { createData } from './data'
4
+ import { createData, getPatternData } from './data'
5
5
  import { fillOrFitMode, clipMode, repeatMode } from './mode'
6
6
  import { createPattern } from './pattern'
7
7
  import { checkImage } from './check'
@@ -10,11 +10,13 @@ import { recycleImage } from './recycle'
10
10
 
11
11
  export const PaintImageModule: IPaintImageModule = {
12
12
  image,
13
+ checkImage,
14
+ createPattern,
15
+ recycleImage,
16
+
13
17
  createData,
18
+ getPatternData,
14
19
  fillOrFitMode,
15
20
  clipMode,
16
- repeatMode,
17
- createPattern,
18
- checkImage,
19
- recycleImage
21
+ repeatMode
20
22
  }