Hello! I assigned the function of moving a line to the left mouse button. But as a result, the function of moving of individual points of the line stopped working.
How can I make it so that when you hover the mouse over the line itself and hold down the left mouse button, the entire line is translated, and when you hover the cursor over a separate point of the line and hold down the left mouse button, only this point of the line begins to translate?
This is my code for translating a line by left mouse button pressing:
sliceViewLabel = "Red"
sliceViewWidget = slicer.app.layoutManager().sliceWidget(sliceViewLabel)
displayableManager = sliceViewWidget.sliceView().displayableManagerByClassName(
"vtkMRMLMarkupsDisplayableManager"
)
line = slicer.util.getNode('L')
lineDisplayNode = line.GetDisplayNode()
widget = displayableManager.GetWidget(lineDisplayNode)
widget.SetEventTranslationClickAndDrag(
widget.WidgetStateOnWidget,
vtk.vtkCommand.LeftButtonPressEvent,
vtk.vtkEvent.NoModifier,
widget.WidgetStateTranslate,
vtk.vtkWidgetEvent.NoEvent,
vtk.vtkWidgetEvent.NoEvent
)
widget.SetEventTranslationClickAndDrag(
widget.WidgetStateOnWidget,
vtk.vtkCommand.LeftButtonPressEvent,
vtk.vtkEvent.NoModifier,
widget.WidgetStateTranslate,
widget.WidgetEventTranslateStart,
widget.WidgetEventTranslateEnd
)