# Translating of a line

**URL:** <https://discourse.slicer.org/t/translating-of-a-line/32001>\
**Category:** Support\
**Tags:** markups-fiducials\
**Created:** [October 3, 2023, 1:48am UTC](https://discourse.slicer.org/t/translating-of-a-line/32001 "2023-10-03T01:48:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grigoriy\_Postolskiy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/grigoriy_postolskiy/32/15587_2.png) [@Grigoriy\_Postolskiy](https://discourse.slicer.org/u/Grigoriy_Postolskiy)\
**Post date:** [October 3, 2023, 1:48am UTC](https://discourse.slicer.org/t/translating-of-a-line/32001/1 "2023-10-03T01:48:15Z")

</div>

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:

```auto
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
)

```

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [October 3, 2023, 3:47am UTC](https://discourse.slicer.org/t/translating-of-a-line/32001/2 "2023-10-03T03:47:09Z")

</div>

As part of improving functionality for the Slicer community, have you found that the existing events for a Markups line node not sufficient?

- Mouse wheel click on line to translate entire line
- Left click on control point to translate single point

---

<div class="post-metadata">

**Author:** ![Grigoriy\_Postolskiy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/grigoriy_postolskiy/32/15587_2.png) [@Grigoriy\_Postolskiy](https://discourse.slicer.org/u/Grigoriy_Postolskiy)\
**Post date:** [October 3, 2023, 10:38am UTC](https://discourse.slicer.org/t/translating-of-a-line/32001/3 "2023-10-03T10:38:42Z")

</div>

I am making the application for doctors who do not have much professionalism in using a computer and it will be difficult for them to understand that the transfer of the entire line is assigned to the middle mouse button.

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [October 3, 2023, 10:48am UTC](https://discourse.slicer.org/t/translating-of-a-line/32001/4 "2023-10-03T10:48:32Z")

</div>

> [@Grigoriy\_Postolskiy](#):
>
> doctors who do not have much professionalism in using a computer

I wish to contribute these lines as a surgeon.

When your doctors have finished with your simplification, they would ask you for more simplifications. You will be caught up in an endless whirlwind, reinventing the wheel every time. I think IT pros and developers should rather show doctors how to use computers and software as they are. Lest in 50 years, doctors (in general) would remain at the same level of unfortunately ‘below base’ skill.

---

<div class="post-metadata">

**Author:** ![Grigoriy\_Postolskiy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/grigoriy_postolskiy/32/15587_2.png) [@Grigoriy\_Postolskiy](https://discourse.slicer.org/u/Grigoriy_Postolskiy)\
**Post date:** [October 3, 2023, 12:59pm UTC](https://discourse.slicer.org/t/translating-of-a-line/32001/5 "2023-10-03T12:59:40Z")

</div>

The recording of the problem is below - the entire line translating works by left mouse button pressing, but the point translating stopped working.  
 ![Animation](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/d/4d53c90ca89394a1a7d118cdbe6c3bee5181d748.gif)
