3

When a Chrome app window is moved to the edge of the screen using the mouse, the window can be moved partially outside of the screen.

enter image description here

However when trying to move a Chrome app window beyond the screen using the moveTo function it remains snapped to the edge of the screen.

enter image description here

Is there any other method which can be used to achieve this?

4

1 回答 1

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();
于 2013-10-24T20:55:55.380 回答