@leafer-ui/paint 1.0.0-alpha.30 → 1.0.0-alpha.31

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/paint",
3
- "version": "1.0.0-alpha.30",
3
+ "version": "1.0.0-alpha.31",
4
4
  "description": "@leafer-ui/paint",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -19,7 +19,7 @@
19
19
  "leaferjs"
20
20
  ],
21
21
  "devDependencies": {
22
- "@leafer/interface": "1.0.0-alpha.30",
23
- "@leafer-ui/interface": "1.0.0-alpha.30"
22
+ "@leafer/interface": "1.0.0-alpha.31",
23
+ "@leafer-ui/interface": "1.0.0-alpha.31"
24
24
  }
25
25
  }
package/src/Fill.ts CHANGED
@@ -7,7 +7,6 @@ import { drawText } from './FillText'
7
7
  export function fill(ui: IUI, canvas: ILeaferCanvas, fill: string | object): void {
8
8
  canvas.fillStyle = fill
9
9
  ui.__.__font ? drawText(ui, canvas) : canvas.fill(ui.__.windingRule)
10
-
11
10
  }
12
11
 
13
12
  export function fills(ui: IUI, canvas: ILeaferCanvas, fills: ILeafPaint[]): void {
package/src/Shape.ts CHANGED
@@ -3,6 +3,7 @@ import { BoundsHelper } from '@leafer/math'
3
3
 
4
4
  import { IUI, ICachedShape } from '@leafer-ui/interface'
5
5
 
6
+ const { getSpread, getOuterOf, getByMove, getIntersectData } = BoundsHelper
6
7
 
7
8
  export function shape(ui: IUI, current: ILeaferCanvas, options: IRenderOptions): ICachedShape {
8
9
  const canvas = current.getSameCanvas()
@@ -15,8 +16,8 @@ export function shape(ui: IUI, current: ILeaferCanvas, options: IRenderOptions):
15
16
 
16
17
  if (!current.bounds.includes(__world, options.matrix)) {
17
18
 
18
- const { renderBoundsSpreadWidth } = ui.__layout
19
- const worldClipBounds = BoundsHelper.getIntersectData(renderBoundsSpreadWidth ? BoundsHelper.getSpread(current.bounds, renderBoundsSpreadWidth * __world.a) : current.bounds, __world, options.matrix)
19
+ const { shapeRenderSpreadWidth: spreadWidth } = ui.__layout
20
+ const worldClipBounds = getIntersectData(spreadWidth ? getSpread(current.bounds, spreadWidth * scaleX) : current.bounds, __world, options.matrix)
20
21
  matrix = current.bounds.getFitMatrix(worldClipBounds)
21
22
 
22
23
  if (matrix.a < 1) {
@@ -27,8 +28,8 @@ export function shape(ui: IUI, current: ILeaferCanvas, options: IRenderOptions):
27
28
  scaleY *= matrix.d
28
29
  }
29
30
 
30
- shapeBounds = BoundsHelper.getOuterOf(__world, matrix)
31
- bounds = BoundsHelper.getByMove(shapeBounds, -matrix.e, -matrix.f)
31
+ shapeBounds = getOuterOf(__world, matrix)
32
+ bounds = getByMove(shapeBounds, -matrix.e, -matrix.f)
32
33
 
33
34
  if (options.matrix) matrix.multiply(options.matrix)
34
35
  options = { ...options, matrix }
@@ -4,7 +4,7 @@ import { Platform, PointHelper, MatrixHelper } from '@leafer/core'
4
4
  import { applyStops } from './linear'
5
5
 
6
6
 
7
- const { set, getAngle } = PointHelper
7
+ const { set, getAngle, getDistance } = PointHelper
8
8
  const { get, rotateOf, scaleOf } = MatrixHelper
9
9
 
10
10
  const defaultFrom = { x: 0.5, y: 0.5 }
@@ -36,7 +36,7 @@ export function conicGradient(paint: IGradientPaint, box: IBoundsData): ILeafPai
36
36
  rotateOf(transform, realFrom, angle)
37
37
  }
38
38
 
39
- const style = Platform.canvas.createConicGradient(0, realFrom.x, realFrom.y)
39
+ 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))
40
40
  applyStops(style, paint.stops, opacity)
41
41
 
42
42
  return {