Skip to content

Commit

Permalink
fix(WidgetManager): cross-renderer widget usage
Browse files Browse the repository at this point in the history
Widgets should not remain in an active state if interaction occurs
outside of the containing renderer.
  • Loading branch information
floryst committed Jan 10, 2025
1 parent 35a9338 commit af1ed62
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Sources/Widgets/Core/WidgetManager/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,17 @@ function vtkWidgetManager(publicAPI, model) {
}
}

const deactivateAllWidgets = () => {
let wantRender = false;
for (let i = 0; i < model.widgets.length; i++) {
const w = model.widgets[i];
wantRender ||= !!w.getActiveState();
w.deactivateAllHandles();
}

if (wantRender) model._interactor.render();
};

const handleEvent = async (callData, fromTouchEvent = false) => {
if (
!model.isAnimating &&
Expand All @@ -192,6 +203,8 @@ function vtkWidgetManager(publicAPI, model) {
const callID = Symbol('UpdateSelection');
model._currentUpdateSelectionCallID = callID;
await updateSelection(callData, fromTouchEvent, callID);
} else {
deactivateAllWidgets();
}
};

Expand Down

0 comments on commit af1ed62

Please sign in to comment.