Commit 76d93bb5 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Merge remote branch 'origin/master'

parents 8652deb7 81f1e6e4
Loading
Loading
Loading
Loading
+31 −26
Original line number Diff line number Diff line
@@ -44,11 +44,6 @@ Ext.define('Docs.view.HoverMenuButton', {
            }, this);
        }

        this.menu = Ext.create('Docs.view.HoverMenu', {
            store: this.store,
            columnHeight: this.getColumnHeight()
        });

        this.callParent(arguments);
    },

@@ -61,8 +56,6 @@ Ext.define('Docs.view.HoverMenuButton', {
    onRender: function() {
        this.callParent(arguments);

        this.renderMenu();

        this.getEl().on({
            click: function() {
                this.fireEvent("click");
@@ -71,39 +64,46 @@ Ext.define('Docs.view.HoverMenuButton', {
            mouseout: this.deferHideMenu,
            scope: this
        });

        this.menu.getEl().on({
            mouseover: function() {
                clearTimeout(this.hideTimeout);
            },
            mouseout: this.deferHideMenu,
            scope: this
        });

    },

    onDestroy: function() {
        if (this.menu) {
            // clean up DOM
            this.menu.destroy();
            // remove from global menu list
            Ext.Array.remove(Docs.view.HoverMenuButton.menus, this.menu);
        }

        this.callParent(arguments);
    },

    renderMenu: function() {
        this.menu.getEl().setVisibilityMode(Ext.core.Element.DISPLAY);
        this.menu.hide();
        this.menu = Ext.create('Docs.view.HoverMenu', {
            store: this.store,
            columnHeight: this.getColumnHeight()
        });

        this.menu.getEl().addListener('click', function(e) {
        this.menu.getEl().on({
            click: function(e) {
                this.menu.hide();
                e.preventDefault();
        }, this);
            },
            mouseover: function() {
                clearTimeout(this.hideTimeout);
            },
            mouseout: this.deferHideMenu,
            scope: this
        });

        Docs.view.HoverMenuButton.menus.push(this.menu);
    },

    deferHideMenu: function() {
        // skip if nothing to hide
        if (!this.menu) {
            return;
        }

        clearTimeout(Docs.view.HoverMenuButton.showTimeout);
        this.hideTimeout = Ext.Function.defer(function() {
            this.menu.hide();
@@ -113,6 +113,11 @@ Ext.define('Docs.view.HoverMenuButton', {
    deferShowMenu: function() {
        clearTimeout(Docs.view.HoverMenuButton.showTimeout);
        Docs.view.HoverMenuButton.showTimeout = Ext.Function.defer(function() {
            // Create menu if needed
            if (!this.menu) {
                this.renderMenu();
            }

            // hide other menus
            Ext.Array.forEach(Docs.view.HoverMenuButton.menus, function(menu) {
                if (menu !== this.menu) {
+10 −0
Original line number Diff line number Diff line
@@ -237,6 +237,16 @@ Ext.define('Docs.view.cls.Toolbar', {
                        isSearch           && !re.test(m.get("label"))
                    );
                });
                // HACK!!!
                // In Ext JS 4.1 filtering the stores causes the menus
                // to become visible. But the visibility behaves badly
                // - one has to call #show first or #hide won't have
                // an effect.
                var menu = this.memberButtons[type].menu;
                if (menu && Ext.getVersion().version >= "4.1.0") {
                    menu.show();
                    menu.hide();
                }
            }
        }, this);
    },