Skip to content

Commit 832f259

Browse files
sedghifloryst
authored andcommitted
fix(interactor): mouseEvent is not available in the worker
1 parent 09d7954 commit 832f259

File tree

1 file changed

+11
-1
lines changed
  • Sources/Rendering/Core/RenderWindowInteractor

1 file changed

+11
-1
lines changed

Sources/Rendering/Core/RenderWindowInteractor/index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,17 @@ const { vtkWarningMacro, vtkErrorMacro, normalizeWheel, vtkOnceErrorMacro } =
1111
// Global methods
1212
// ----------------------------------------------------------------------------
1313

14-
const EMPTY_MOUSE_EVENT = new MouseEvent('');
14+
let EMPTY_MOUSE_EVENT;
15+
if (typeof MouseEvent !== 'undefined') {
16+
EMPTY_MOUSE_EVENT = new MouseEvent('');
17+
} else {
18+
// Provide a fallback or handle differently for web worker context
19+
EMPTY_MOUSE_EVENT = {
20+
ctrlKey: false,
21+
altKey: false,
22+
shiftKey: false,
23+
};
24+
}
1525

1626
const deviceInputMap = {
1727
'xr-standard': [

0 commit comments

Comments
 (0)