Chrome app window cannot be moved partially outside of screen using moveTo

Deadly 提交于 2019-12-10 09:47:18

问题


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.

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.

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


回答1:


Try using setBounds() instead of moveTo(), that works for me:

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});
  });
});

You don't even need to pass the width and height back:

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

And to get the AppWindow object outside of the create() callback, use:

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


来源:https://stackoverflow.com/questions/19561502/chrome-app-window-cannot-be-moved-partially-outside-of-screen-using-moveto

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!