Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ext.ux.desktop.Desktop shortcut 'restores' windows even if initially maximized #1640

Open
fabriciomurta opened this issue May 17, 2019 · 1 comment

Comments

Projects
None yet
1 participant
@fabriciomurta
Copy link
Contributor

commented May 17, 2019

Found: 4.8.1
Ext.NET forums' thread: Desktop window from short cut not getting maximized and if there is a TopBar its covering the top bar

This issue is similar to #1565, but triggers only and only if the window is bound to be displayed via a desktop shortcut.

To reproduce the issue, just add Maximized="true" to the GridWindow module (WebForms location, MVC location) in the Desktop example (WebForms, MVC).

Then, when opening the desktop's GridWindow icon (double click it), it will be easily noticed how the window goes from maximized to its would-be initial width-height ("restored" state).

The animation below ilustrates the scenario:
62644-desktop_wnd_maximized

@fabriciomurta

This comment has been minimized.

Copy link
Contributor Author

commented May 17, 2019

The least invasive override I could think of would disable the desktop's restoreWindow() method while the maximized window is about to be created:

Ext.define('gh1640', {
    override: 'Ext.ux.desktop.Desktop',
    onShortcutItemClick: function (dataView, record) {
        var me = this,
            module = me.app.getModule(record.data.module),
            win = module && module.createWindow(),
            restoreWindowFn;

        // Tamper away the 'restoreWindow' method if the window is
        // maximized, so that calls to it are "ignored" while opening
        // it, if window is to be initially maximized.
        if (win.maximized) {
            restoreWindowFn = me.restoreWindow;
            me.restoreWindow = Ext.emptyFn;
        }

        me.callParent(arguments);

        // Bind back restoreWindow() if it was moved away during the
        // open process.
        if (Ext.isFunction(restoreWindowFn)) {
            me.restoreWindow = restoreWindowFn;
        }
    }
});

Which is equivalent to remove the original method's restoreWindow() call in the condition win.maximized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.