2013-10-24 38 views
3

部分移动到屏幕之外当使用鼠标将Chrome应用程序窗口移动到屏幕边缘时,窗口可以部分移动到屏幕之外。Chrome应用程序窗口无法使用moveTo

enter image description here

但是当试图使用moveTo功能,它仍然捕捉到屏幕边缘移动Chrome应用窗口超出屏幕。

enter image description here

是否有可用于实现这一目标的任何其他方法?

回答

4

尝试使用的setBounds()代替的moveTo(),为我的作品:

chrome.app.runtime.onLaunched.addListener(function() { 
    chrome.app.window.create('window.html', { 
    'bounds': { 
     'width': 400, 
     'height': 500 
    } 
    }, function(appwindow) { 
    appwindow.setBounds({left: -200, top: 200, width: 400, height: 500}); 
    }); 
}); 

你甚至都不需要传递的宽度和高度回:

appwindow.setBounds({ left: -200, top: 200 }); 

而对于在create()回调之外获得AppWindow对象,使用:

var appwindow = chrome.app.window.current(); 
+0

它工作得很好:) – Stefania