Stefania
Stefania

Reputation: 801

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

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?

Upvotes: 3

Views: 496

Answers (1)

JavierLerones
JavierLerones

Reputation: 171

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

Upvotes: 4

Related Questions