Skip to content

Commit 1d56bbb

Browse files
committed
fix(WidgetManager): cross-renderer widget usage
Widgets should not remain in an active state if interaction occurs outside of the containing renderer.
1 parent d3a7db9 commit 1d56bbb

File tree

1 file changed

+13
-0
lines changed
  • Sources/Widgets/Core/WidgetManager

1 file changed

+13
-0
lines changed

Sources/Widgets/Core/WidgetManager/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,17 @@ function vtkWidgetManager(publicAPI, model) {
183183
}
184184
}
185185

186+
const deactivateAllWidgets = () => {
187+
let wantRender = false;
188+
for (let i = 0; i < model.widgets.length; i++) {
189+
const w = model.widgets[i];
190+
wantRender ||= !!w.getActiveState();
191+
w.deactivateAllHandles();
192+
}
193+
194+
if (wantRender) model._interactor.render();
195+
};
196+
186197
const handleEvent = async (callData, fromTouchEvent = false) => {
187198
if (
188199
!model.isAnimating &&
@@ -192,6 +203,8 @@ function vtkWidgetManager(publicAPI, model) {
192203
const callID = Symbol('UpdateSelection');
193204
model._currentUpdateSelectionCallID = callID;
194205
await updateSelection(callData, fromTouchEvent, callID);
206+
} else {
207+
deactivateAllWidgets();
195208
}
196209
};
197210

0 commit comments

Comments
 (0)