konvajs / konva

Konva.js is an HTML5 Canvas JavaScript framework that extends the 2d context by enabling canvas interactivity for desktop and mobile applications.
http://konvajs.org/
Other
11.07k stars 896 forks source link

Update `fill` type to accept `CanvasGradient` #1772

Closed squoddam closed 1 month ago

squoddam commented 1 month ago

Currently fill property, defined in ShapeConfig, only allows for strings to be passed. But despite that it is actually possible to pass CanvasGradient to the fill, and it renders correctly (codesandbox demo)

This PR adds CanvasGradient as one of possible values of fill, the same way it is done for stroke: https://github.com/konvajs/konva/blob/68b4ea3cb65f7ebd838f7e420958d26b59088f0f/src/Shape.ts#L60

lavrton commented 1 month ago

Good. Can you also update the shape.fill() method type?

lavrton commented 1 month ago

Thanks. I will make a release a bit later.