Skip to content
This repository has been archived by the owner on Jan 24, 2020. It is now read-only.

Commit

Permalink
More pointer lock focus cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Avaer Kazmer committed Jun 18, 2019
1 parent c0b4492 commit 46489ed
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -980,14 +980,15 @@
const {target} = m.data;
if (target === 'fakeXr') {
renderer.domElement.requestPointerLock();
for (let i = 0; i < 1000; i += 100) {
if (i > 0) {
setTimeout(() => {
renderer.domElement.setFocus();
}, i);
} else {
renderer.domElement.setFocus();
}
const _setFocus = () => {
renderer.domElement.setFocus();
_bringUiToTop();
};
_setFocus();
for (let i = 0; i < 100; i += 5) {
setTimeout(() => {
_setFocus();
}, i);
}

_bindEventTarget('xr');
Expand Down Expand Up @@ -1125,15 +1126,6 @@
window.addEventListener('minimize', e => {
uiIframe.hide();
});
window.document.addEventListener('pointerlockchange', e => {
if (window.document.pointerLockElement) {
for (let i = 0; i < 1000; i += 100) {
setTimeout(() => {
_bringUiToTop();
}, i);
}
}
});

// events

Expand Down

0 comments on commit 46489ed

Please sign in to comment.