Closed Mouarius closed 6 months ago
Use Konva.Rect
for anchor
argument.
Use
Konva.Rect
foranchor
argument.
Thank you for your answer !
That's why I thought, but then, as I mentioned there is also an error with the type TransformerConfig
that expects a (anchor: Shape) => void
for the anchorStyleFunc
function.
Do you have the same error ?
I see what you mean now, I will change config to match that.
Perfect ! Thank you very much !
The error
Typescript throws an error when using the
cornerRadius
property of a variable typesShape<RectConfig>
:Error message :
Context
package.json
Description
I'm trying to use a custom styling function for
<Transformer>
anchors using theanchorStyleFunc
method property. According to the type definition of this property we should have :But according to the documentation for complex styling on the
Transformer
, the type of theanchor
property is an instance of aKonva.Rect
. As written in the provided example, we can callcornerRadius()
on it :But on the React counterpart, the type of
anchor
is not aKonva.Rect
instance, but aShape<ShapeConfig>
which prevents us from usingcornerRadius
.Maybe I'm using those properties the wrong way, or didn't understand correctly the whole library and types. But it seems wrong for me that we cannot call
cornerRadius
on aShape<RectConfig>
Note: I tried to type it to a
Konva.Rect
but then there is a conflict with the expected type of theanchorStyleFunc
Thank you very much for your help !
Minimal example
I've just made a code sandbox with a minimal example : here