问题
I am trying to create circular menu with wheelnav.js library.
Even though it seems to work I get thousands of errors in chrome console.
Error: attribute d: Expected number, "M,0,0".
Error: attribute dy: Expected length, "NaN".
During my own debugging I managed to find the same causes that people list in these threads:
https://github.com/DmitryBaranovskiy/raphael/issues/593
https://github.com/DmitryBaranovskiy/raphael/issues/620
https://github.com/fperucic/treant-js/issues/73
Even though these threads are quite old, they are still opened and I couldn't find there soulution to my problem. I couldn't even find an elegant method to overwrite raphaels' functions.
var icons = {
'section_sign': '\u00A7\n',
'key': '\uf084\n',
'cogs': '\uf085\n',
};
var items = [ {title: icons.key + 'Security&\nPasswords'},
{title: icons.cogs + 'Settings&\nDevice'},
{title: icons.section_sign + 'Rules&\nLaw'} ];
var piemenu = new wheelnav('main_menu');
piemenu.initWheel(items.map(function(item){
return item.title;
}));
piemenu.createWheel();
JSFiddle
Any ideas?
Thanks for help :)
回答1:
wheelnav.js uses a modified Raphael.js
https://cdn.jsdelivr.net/npm/wheelnav@1.7.1/js/dist/raphael.min.js
Here is an error-free JSFiddle: https://jsfiddle.net/npg80xqm
You can find the fixed bugs here: https://github.com/softwaretailoring/wheelnav/commits/master/js/required/raphael.js
来源:https://stackoverflow.com/questions/53726921/error-tspan-attribute-dy-expected-length-nan-error-path-attribute-d