我的svg中有一个类似的use元素
<use x="47.46" y="44.64" cx="48" cy="45" id="9zh7" href="#msi_plane" class="markerpoint"></use>
我有一个悬停函数,它在悬停时转换.markrpoint类元素:-
$('.markerpoint').hover(
function() {
var mySnapElement = Snap(this);
mySnapElement.transform('s1.5');
}
function() {
mySnapElement.transform('s1');
}
)
对于svg的其他元素,Transform工作良好,比如<圆圈>或者<rect>但抛出<使用>标签
错误响应数据:-
snap.svg.js:2786 Uncaught TypeError: Cannot read properties of null (reading 'substring')
at Element.elproto.getBBox (snap.svg.js:2786)
at extractTransform (snap.svg.js:2834)
at Element.elproto.transform (snap.svg.js:2896)
at SVGUseElement.<anonymous> (main.js:1023)
at SVGUseElement.handle (jquery.min.js:2)
at SVGUseElement.dispatch (jquery.min.js:2)
at SVGUseElement.v.handle (jquery.min.js:2)
似乎是Snap.svg在处理<使用>
寻找破解或前进方向的建议
快速阅读源代码后,Snap.svg似乎不支持bare href,但需要使用xlink:href
href的使用在SVG 2中是新的,SVG 1.1只是xlink:href。