Reputation: 17269
I have something like this:
<Stage>
<Layer>
<Rect />
<Text
ref={this.text}
draggable
align="center"
/>
</Layer>
</Stage>
The text is aligned in the center, but I need to align it vertically. How can I do this?
I know with plain canvas you can do textBaseline="center"
, but what's the equivalent for Konva?
Upvotes: 2
Views: 2405
Reputation: 20363
From Konva v2.3.0
you can use verticalAlign
property:
<Text
x={20}
y={20}
width={150}
height={50}
text="vertical align"
verticalAlign="middle"
/>
https://codesandbox.io/s/4xorl71m77
Upvotes: 2