Skip to content

Commit f207f82

Browse files
committed
fix(RenderWindowInteractor): pointer lock element
Pointer lock element should be the interaction container, not the canvas. This is to support the ManyRenderers example use-case.
1 parent fb883e8 commit f207f82

File tree

1 file changed

+5
-3
lines changed
  • Sources/Rendering/Core/RenderWindowInteractor

1 file changed

+5
-3
lines changed

Sources/Rendering/Core/RenderWindowInteractor/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,15 +421,17 @@ function vtkRenderWindowInteractor(publicAPI, model) {
421421

422422
//----------------------------------------------------------------------
423423
publicAPI.requestPointerLock = () => {
424-
const canvas = publicAPI.getView().getCanvas();
425-
canvas.requestPointerLock();
424+
if (model.container) {
425+
model.container.requestPointerLock();
426+
}
426427
};
427428

428429
//----------------------------------------------------------------------
429430
publicAPI.exitPointerLock = () => document.exitPointerLock();
430431

431432
//----------------------------------------------------------------------
432-
publicAPI.isPointerLocked = () => !!document.pointerLockElement;
433+
publicAPI.isPointerLocked = () =>
434+
!!model.container && document.pointerLockElement === model.container;
433435

434436
//----------------------------------------------------------------------
435437
publicAPI.handlePointerLockChange = () => {

0 commit comments

Comments
 (0)