@leafer-ui/gradient 2.0.5 → 2.0.7

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/gradient",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "@leafer-ui/gradient",
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.5",
26
- "@leafer-ui/draw": "2.0.5"
25
+ "@leafer/core": "2.0.7",
26
+ "@leafer-ui/draw": "2.0.7"
27
27
  },
28
28
  "devDependencies": {
29
- "@leafer/interface": "2.0.5",
30
- "@leafer-ui/interface": "2.0.5"
29
+ "@leafer/interface": "2.0.7",
30
+ "@leafer-ui/interface": "2.0.7"
31
31
  }
32
32
  }
package/src/conic.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { IPointData, IBoundsData } from '@leafer/interface'
2
- import { Platform, PointHelper, AroundHelper } from '@leafer/core'
2
+ import { Platform, PointHelper, AroundHelper, OneRadian } from '@leafer/core'
3
3
 
4
4
  import { IGradientPaint, ILeafPaint } from '@leafer-ui/interface'
5
5
 
@@ -15,12 +15,12 @@ const realTo = {} as IPointData
15
15
 
16
16
  export function conicGradient(paint: IGradientPaint, box: IBoundsData): ILeafPaint {
17
17
 
18
- let { from, to, type, opacity, stretch } = paint
18
+ let { from, to, type, opacity, rotation, stretch } = paint
19
19
 
20
20
  toPoint(from || 'center', box, realFrom)
21
21
  toPoint(to || 'bottom', box, realTo)
22
22
 
23
- const style = Platform.conicGradientSupport ? Platform.canvas.createConicGradient(0, realFrom.x, realFrom.y) : Platform.canvas.createRadialGradient(realFrom.x, realFrom.y, 0, realFrom.x, realFrom.y, getDistance(realFrom, realTo))
23
+ const style = Platform.conicGradientSupport ? Platform.canvas.createConicGradient(rotation ? rotation * OneRadian : 0, realFrom.x, realFrom.y) : Platform.canvas.createRadialGradient(realFrom.x, realFrom.y, 0, realFrom.x, realFrom.y, getDistance(realFrom, realTo))
24
24
  const data: ILeafPaint = { type, style }
25
25
 
26
26
  applyStops(data, style, paint.stops, opacity)
package/src/radial.ts CHANGED
@@ -32,7 +32,7 @@ export function radialGradient(paint: IGradientPaint, box: IBoundsData): ILeafPa
32
32
 
33
33
  }
34
34
 
35
- export function getTransform(box: IBoundsData, from: IPointData, to: IPointData, stretch: number, rotate90: boolean): IMatrixData {
35
+ export function getTransform(box: IBoundsData, from: IPointData, to: IPointData, stretch: number, rotate90?: boolean): IMatrixData {
36
36
  let transform: IMatrixData
37
37
  const { width, height } = box
38
38