Hi Ivan,
I've noticed, that you've added the scrolling to the last revision.
Thanks :)
But, there is a little problem: in 'select_node' function you are
testing, if event occurs and only then fire the '_fix_scroll'
function. But event occurs here only, if it was passed during
invocation of the 'select_node' as the third argument. In
documentation you've written, that the third argument is used
internally, so I didn't use it in my code. So, when somebody
calls .select_node(node); (e.g. when using the hotkeys plugin) the
event will be 'undefined' and so the '_fix_scroll' won't be triggered.
I'm not sure, why you are testing for the event inside the
'select_node', when not testing in 'hover_node', but there is probably
some reason ;). So I suggest to make fix in docs or remove the testing
condition in 'select_node' or change it some way ;)
Second thing: when tree has also horizontal scrollbar and if select
(programatically, of course ;) ) some node, below the visibility area,
then the tree is scrolled, but the selected node is behind the
horizontal scroll bar. It happens at least in FF 3.6, probably in
others browsers too.
Of course, width (height) of the scrollbar can be different, depend on
OS and user settings, but I've found someday little function to
calculate the width if you need it:
function scrollbarWidth() {
// source:
http://jdsharp.us/jQuery/minute/calculate-scrollbar-width.php
var
div, w1, w2;
div = $('<div style="width: 50px; height: 50px; overflow: hidden;
position: absolute; top: -200px; left: -200px;"><div style="height:
100px;"></div>');
$('body').append(div);
w1 = $('div', div).innerWidth();
div.css('overflow-y', 'scroll');
w2 = $('div', div).innerWidth();
$(div).remove();
return navigator.userAgent.toLowerCase().indexOf('chrome') > -1 ||
navigator.userAgent.toLowerCase().indexOf('safari') > -1
? 17
: w1 - w2;
}
I've changed it a little, to work with Chrome and Safari (for those
browsers script doesn't calculate the width, but returns '17', which
is default for Win XP).
Also, there would be nice, if you wrote, what is the default value for
every argument in every function, which is not mandatory.
Best regards,
ChrisRaven