锁定鼠标指针到其当前位置并使其不可见。
requestPointerLock() 允许鼠标无限移动而不会离开屏幕。调用 requestPointerLock() 会锁定 mouseX、mouseY、pmouseX 和 pmouseY 的值。movedX 和 movedY 会继续更新,并可用于获取自上一帧绘制以来鼠标移动的距离。调用 exitPointerLock() 会恢复更新鼠标系统变量。
注意:大多数浏览器在调用 requestPointerLock() 之前需要一个输入操作,例如点击。建议在如 doubleClicked() 等事件函数中调用 requestPointerLock()。
示例
This page is generated from the comments in src/events/mouse.js . Please feel free to edit it and submit a pull request!