Closed dannyrb closed 1 year ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
👢 💨 🤖
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Since we have moved to cornerstone3D I will close this, thanks
Tool abstraction for vtk.js
Context
react-vtkjs-viewport
has slowly grown to include more and more features. We're now at the point where we need the ability to change "tool" bindings based on user input, or the context in which the viewer is currently being used.Currently, we accomplish this be leveraging:
RenderWindowInteractor
(Interactor) -->InteractorStyleXXX
(InteractorStyle) --> ManipulatorsWhere
RenderWindowInteractor
normalizes browser interactions and exposes those normalized events to anInteractorStyle
. Interactor styles can then optionally handle each of those events. @JamesAPetts has pointed to theInteractorStyleManipulator
as a good example.We can only have one
InteractorStyle
, and we're currently extending and swapping them out depending on which behaviors we would like to have active. We have the ability to modify manipulators on theInteractorStyle
even after it's set; where manipulators or sort of like "one-button tools".(I'm stating this in the hopes that someone corrects me if I've missed the mark.)
Discussion
It has been suggested that the current pattern mirrors that of
cornerstone-tools@2
, where listeners for behaviors/tools would compete with each other. We could model our changes to make the same enhancements we accomplished incornerstone-tools@3
by:RenderWindowInteractor
as our "event listener"InteractorStyle
that:cornerstonetoolsmouseclick
cornerstone-tools
event dispatcherscornerstone-tools
that our new "event dispatcher" can use to determine who should "capture" events and apply their active strategiesPerhaps the biggest difference here would be for "tools" that do more than modify the viewport/camera.
vtk.js
renders annotations differently fromcornerstone-tools
, and how that fits in is still unclear.This is a discussion piece to get the ball rolling. Please feel free to weigh in.