例如,我想将“我是一个中国人”文字中心指定到x y坐标。可以作如下设置
let text = new ZRender.Text({
style: {
text: '我是中国人',
fontSize: 12,
x: x,
y: y
}
})
text.attr({ style: { x: text.style.x-text.getBoundingRect().width/2, y: text.style.y-text.getBoundingRect().height/2 } })