@leafer-ui/gradient 1.8.0 → 1.9.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.
Files changed (2) hide show
  1. package/package.json +5 -5
  2. package/src/linear.ts +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/gradient",
3
- "version": "1.8.0",
3
+ "version": "1.9.1",
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": "1.8.0",
26
- "@leafer-ui/draw": "1.8.0"
25
+ "@leafer/core": "1.9.1",
26
+ "@leafer-ui/draw": "1.9.1"
27
27
  },
28
28
  "devDependencies": {
29
- "@leafer/interface": "1.8.0",
30
- "@leafer-ui/interface": "1.8.0"
29
+ "@leafer/interface": "1.9.1",
30
+ "@leafer-ui/interface": "1.9.1"
31
31
  }
32
32
  }
package/src/linear.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { IObject, IBoundsData, IPointData } from '@leafer/interface'
2
- import { AroundHelper, Platform } from '@leafer/core'
2
+ import { AroundHelper, Platform, isString } from '@leafer/core'
3
3
 
4
4
  import { IGradientPaint, ILeafPaint, IColorStop, IColorString } from '@leafer-ui/interface'
5
5
  import { ColorConvert } from '@leafer-ui/draw'
@@ -30,7 +30,7 @@ export function applyStops(data: ILeafPaint, gradient: IObject, stops: IColorSto
30
30
  let stop: IColorStop | string, color: string, offset: number, isTransparent: boolean
31
31
  for (let i = 0, len = stops.length; i < len; i++) {
32
32
  stop = stops[i]
33
- if (typeof stop === 'string') offset = i / (len - 1), color = ColorConvert.string(stop, opacity)
33
+ if (isString(stop)) offset = i / (len - 1), color = ColorConvert.string(stop, opacity)
34
34
  else offset = stop.offset, color = ColorConvert.string(stop.color, opacity)
35
35
  gradient.addColorStop(offset, color)
36
36
  if (!isTransparent && hasTransparent(color)) isTransparent = true