捕获的浏览器窗口外的鼠标的位置? [英] Capturing mouse position outside of browser window?

查看:266
本文介绍了捕获的浏览器窗口外的鼠标的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个主要障碍(使用WebGL和类似)在浏览器中创建身临其境的体验是一组放置在鼠标控制限制。

One major barrier to creating immersive experiences in the browser (using WebGL and similar) is the set of limitations placed on mouse control.

有关实例的第一人称射击游戏控制方案基本上要求程序抢鼠标和重新中心它以便允许在该光标任何方向的无限运动。这是一个禁忌,因为它会给Web程序员太多的控制。希望有一天,我们会看到一个插件,它允许一个站点请求允许将鼠标移动到允许这种行为。

For instance a first person shooter control scheme essentially requires the program to grab the mouse and re-center it so as to allow infinite movement in any direction for the cursor. This is a no-no because it would give the web programmer too much control. Hopefully one day we will see a plugin that allows a site to request permission to move the mouse to allow this behavior.

不过,我认为有改善的事情没有去那么远一些方法。我想知道如果有可能允许访问鼠标位置,一旦鼠标移动窗口的关闭(焦点仍在窗口)?

However I think there are some ways to improve things without going that far. I am wondering if it's possible to allow access to the mouse position once the mouse moves off of the window (focus is still on window)?

我打得使用谷歌浏览这个游戏: HTTP://www.chromeexperiments .COM /细节/ X翼/?F =

I was playing this game using Google Chrome: http://www.chromeexperiments.com/detail/x-wing/?f=

和我的最大的问题是,要得到一个角落,我一定要妥善保管我的鼠标在浏览器窗口的角落。如果我推到窗口我的船会留在鼠标的最后一个窗口的位置是,这是不完全在角落里。我会崩溃到墙上。

and my biggest issue was that to get to a corner, I have to carefully keep my mouse on the corner of the browser window. If I push it off the window my ship would stay where the mouse's last window position was, which is not exactly in the corner. And I would crash into the wall.

要加以改善,浏览器应该能够接收鼠标更新,当鼠标在窗口之外。在这种类型的游戏的情况下,如果鼠标离开窗口应该继续更新位置发送给浏览器。

To make this better, the browser should be able to receive mouse updates when the mouse is outside of the window. In the context of this type of game if the mouse leaves the window it should continue to send updated positions to the browser.

对此有任何规定?

推荐答案

这真的好像不是让开发商重新定位光标一个大得多的安全问题。答案是否定的,有没有这样的事情。并有可能将永远不会是一个。对不起!

That really seems like a far bigger security issue than allowing the developer to reposition the cursor. The answer is no, there's no such thing. And there probably won't ever be one. Sorry!

更新:我是,当然,谈论的窗口,将是一个问题外捕获。这很可能存在将永远是锁定鼠标,询问用户的权限后,也许一个API。正如nickf指出,他们已经工作了 - http://dvcs.w3.org/hg/webevents/raw-file/default/mouse-lock.html

Update: I was, of course, talking about the capturing outside the window that would be a problem. It's very likely that there will ever be an API that locks the mouse, maybe after asking the user's permission. As nickf pointed out, they're already working on it - http://dvcs.w3.org/hg/webevents/raw-file/default/mouse-lock.html

这篇关于捕获的浏览器窗口外的鼠标的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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