无法使用moveTo将Chrome应用程序窗口部分移出屏幕 [英] Chrome app window cannot be moved partially outside of screen using moveTo

查看:348
本文介绍了无法使用moveTo将Chrome应用程序窗口部分移出屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用鼠标将Chrome应用程序窗口移动到屏幕边缘时,该窗口可以部分移动到屏幕外部.

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.

但是,当尝试使用moveTo功能将Chrome应用程序窗口移出屏幕之外时,它仍会吸附在屏幕边缘.

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?

推荐答案

尝试使用setBounds()代替moveTo(),这对我有用:

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

要在create()回调之外获取AppWindow对象,请使用:

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

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

这篇关于无法使用moveTo将Chrome应用程序窗口部分移出屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆