Commit 4f98a404 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Fix scrolling to hidden members.

When search directs to specific member that happens to be hidden
we now first show and expand it, and only after that scroll to it.
Expanding it first allows us to scroll it more correctly especially
in case when dealing with members at the very end of the page that
would otherwise be halfway hidden at the bottom.
parent c3990f9c
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -38,14 +38,19 @@ Ext.define('Docs.view.cls.Overview', {
        var el = (typeof query == 'string') ? Ext.get(Ext.query(query)[0]) : query;
        if (el) {
            var isMember = el.hasCls("member");

            // first make the element visible and expanded.
            // For example a private member might be hidden initially so we can't scroll to it.
            el.show();
            if (isMember && el.down(".expandable")) {
                el.addCls('open');
            }

            var scrollOffset = el.getY() - (isMember ? 165 : 155) + (offset || 0);
            var docContent = this.getEl().down('.x-panel-body');
            var currentScroll = docContent.getScroll()['top'];
            docContent.scrollTo('top', currentScroll + scrollOffset);

            if (isMember && el.down(".expandable")) {
                el.addCls('open');
            }
            el.highlight();
        }
    },