Skip to content

Commit 73ab82f

Browse files
committed
fix(RWInteractor): async requestPointerLock
1 parent 307ce44 commit 73ab82f

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

Sources/Interaction/Manipulators/MouseCameraTrackballFirstPersonManipulator/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ function vtkMouseCameraTrackballFirstPersonManipulator(publicAPI, model) {
2525

2626
if (model.usePointerLock && !interactor.isPointerLocked()) {
2727
Object.assign(internal, { interactor, renderer });
28-
interactor.requestPointerLock();
29-
publicAPI.startPointerLockInteraction();
28+
Promise.resolve(interactor.requestPointerLock()).then(() => {
29+
publicAPI.startPointerLockInteraction();
30+
});
3031
}
3132
};
3233

Sources/Interaction/Manipulators/MouseRangeManipulator/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,9 @@ function vtkMouseRangeManipulator(publicAPI, model) {
256256
// we don't interfere with other events such as doubleClick,
257257
// for this reason we don't call this from `onButtonDown`
258258
if (model.usePointerLock && !interactor.isPointerLocked()) {
259-
interactor.requestPointerLock();
260-
publicAPI.startPointerLockEvent(interactor, renderer);
259+
Promise.resolve(interactor.requestPointerLock()).then(() => {
260+
publicAPI.startPointerLockEvent(interactor, renderer);
261+
});
261262
}
262263

263264
if (!position) {

Sources/Rendering/Core/RenderWindowInteractor/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ export interface vtkRenderWindowInteractor extends vtkObject {
11981198
/**
11991199
*
12001200
*/
1201-
requestPointerLock(): void;
1201+
requestPointerLock(): Promise<void> | undefined;
12021202

12031203
/**
12041204
*

Sources/Rendering/Core/RenderWindowInteractor/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,9 @@ function vtkRenderWindowInteractor(publicAPI, model) {
478478
//----------------------------------------------------------------------
479479
publicAPI.requestPointerLock = () => {
480480
if (model.container) {
481-
model.container.requestPointerLock();
481+
return model.container.requestPointerLock();
482482
}
483+
return undefined;
483484
};
484485

485486
//----------------------------------------------------------------------

0 commit comments

Comments
 (0)