[英]React-Konva Text Alignment and Wrapping not working
I am unable to align my text to center on my canvas, nor can I get the text to wrap to a new line when the length exceeds the length of the canvas. 我无法将我的文本对齐到画布的中心,或者当长度超过画布的长度时也无法将文本换行。
import { Layer, Stage, Text } from 'react-konva';
render() {
return (
<Stage height={500} width={500}>
<Layer>
<Text fontSize={60} text="`HEYYYYYYYYYYYYYYYYYYYYYYY`"
wrap="char" align="center" />
</Layer>
</Stage>
)
}
It works just fine. 它工作正常。 Width of a text is not limited by canvas size.
文本的宽度不受画布大小的限制。 Instead it is limited by its own
width
property. 相反,它受其自己的
width
属性限制。
If you don't set width it will be unlimited. 如果您不设置宽度,它将没有限制。
<Text
fontSize={60}
text="HEYYYYYYYYYYYYYYYYYYYYYYY"
wrap="char"
align="center"
width={700}
/>
http://jsbin.com/dolegimuvi/1/edit?js,output http://jsbin.com/dolegimuvi/1/edit?js,output
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.