我正在使用svg.js创建内部带有文本并居中的圆圈
let draw = SVG('main');
// this is for the text
draw.plain(ele.ticket_id).attr({
x: posX,
y: posY,
fill: '#fff',
'alignment-baseline': 'central',
'text-anchor': 'middle'
})
.font({
size: Number((radius/2) * .5).toFixed(2)
});
// and this creates the circle
circle.animate(500, 'quadIn').attr({
fill: '#f06',
id: element.ticket_id,
class: element.status,
cx: posX,
cy: posY
});
但是我不确定如何用标签将圆圈或文本包裹起来,以便使其可单击。我在svg.js文档中没有看到任何示例。
答案 0 :(得分:0)
好的,因此只需在其元素上添加一个linkTo(url-here)