alibaba/structure-view

Click Tree view, scroll the selected item to the middle of the view

gabrielhao opened this issue · 0 comments

I noticed when tree view item is clicked, if the item is in the current view, there is no scroll. However, still need to scan the whole view to find the item.
I'd propose to scroll the selected item to middle of the view, unless it's already scrolled down to the bottom.

I guess the code is here:

if ((elemTop < viewTop) || (elemBottom > viewBottom)) ret.distance = scrollTop + elemTop - viewTop;