2013-10-24 43 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