【问题标题】:Set max_width , max_height 100% for Manifest nwjs为 Manifest nwjs 设置 max_width , max_height 100%
【发布时间】:2017-08-03 04:41:33
【问题描述】:

我想将我的应用程序的高度和高度设置为 1400 和 800 如果可能 但如果屏幕小于 1400 或 800 ,应用程序将打开全尺寸 不是全屏 我的意思是我想要一些像这样瘦的:

"window": {
    "title": "My App",
    "toolbar": false,
    "min_width": 1400,
    "min_height": 800,
    "max_width": 100%,
    "max_height": 100%,  
}

我知道我可以设置fullscreen : true

但我想要类似上面的东西或类似的东西fullsize : true

谢谢

【问题讨论】:

标签: package.json nwjs


【解决方案1】:

如果您查看文档http://docs.nwjs.io/en/latest/References/Screen/,实际上非常简单

Screen.Init() //initiate the screen
var screens = Screen.screens //get all screens. you may have more then one monitor....
var work_area = screens[0]. work_area //get the work area of the screen
var max_width = work_area.width //get the max width
var max_height = work_area.height //get the max height
//check if fullscreen should be entered
if(max_height < 800 || max-wdith < 1400){
     var win = nw.Window.get();
     win.enterFullscreen()
}

如果你有屏幕宽度,你基本上会在启动时检查。如果没有,你去全屏。我认为您也可以通过https://developer.chrome.com/apps/system_display 获取最大宽度和最大高度

【讨论】:

    猜你喜欢
    • 2012-04-07
    • 2020-01-21
    • 1970-01-01
    • 2012-05-19
    • 1970-01-01
    • 2012-06-10
    • 2016-04-08
    • 2013-05-14
    • 1970-01-01
    相关资源
    最近更新 更多