MacGapProject / MacGap1

Desktop WebKit wrapper for HTML/CSS/JS applications.
Other
3.55k stars 208 forks source link

How to set minimum width and minimum height? #115

Closed gobijan closed 10 years ago

gobijan commented 10 years ago

Hi, in node-webkit one can specify minimum width/height in a package.json file. How can one set a min-width / min-height for macgap? Cheers Bijan

gobijan commented 10 years ago

Okay I found two ways. One listening to the resize event:

    var config = {
        minWidth: 600,
        minHeight: 400
    };

    window.onresize = function () {
        if (window.outerWidth < config.minWidth) {
            macgap.window.resize({width: config.minWidth, height: window.outerHeight });
        }
        if (window.outerHeight < config.minHeight) {
            macgap.window.resize({width: window.outerWidth, height: config.minHeight });
        }
    };

And the other to just set the Minimum Size property in the xcode project (Window.xib).

I close this topic now.