# Crop widget handles moves only when dragging horizontally

**URL:** https://discourse.vtk.org/t/crop-widget-handles-moves-only-when-dragging-horizontally/5762
**Category:** Web
**Created:** [May 11, 2021, 2:45pm UTC](https://discourse.vtk.org/t/crop-widget-handles-moves-only-when-dragging-horizontally/5762 "2021-05-11T14:45:48Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![ronzim](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ronzim/32/3153_2.png) [@ronzim](https://discourse.vtk.org/u/ronzim)
#### Post date: [May 11, 2021, 2:45pm UTC](https://discourse.vtk.org/t/crop-widget-handles-moves-only-when-dragging-horizontally/5762/1 "2021-05-11T14:45:48Z")

</div>

Hi,  
I have a problem with crop widget in vtk.js and I cannot find if my bug or vtk.js bug.  
I try to explain: when dragging an handle, it seems that only the X movement of the mouse has an effect, while dragging in the Y direction has no effect.  
I don’t know exactly where I can look for, as I’m using a very basic setup (genericRenderWindow + volumeMapper + cropFilter and cropWidget).  
Thanks to anyone that can puts me in the right direction.  
Mattia

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [May 11, 2021, 2:53pm UTC](https://discourse.vtk.org/t/crop-widget-handles-moves-only-when-dragging-horizontally/5762/2 "2021-05-11T14:53:24Z")

</div>

Could you illustrate that via an animated gif or something similar?

FYI @Forrest

---

<div class="post-metadata">

### Author: ![ronzim](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ronzim/32/3153_2.png) [@ronzim](https://discourse.vtk.org/u/ronzim)
#### Post date: [May 11, 2021, 3:02pm UTC](https://discourse.vtk.org/t/crop-widget-handles-moves-only-when-dragging-horizontally/5762/3 "2021-05-11T15:02:27Z")

</div>

Yes, I’ll do it in a moment. I can add that it happens only with face handles and not corner handles.

---

<div class="post-metadata">

### Author: ![ronzim](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ronzim/32/3153_2.png) [@ronzim](https://discourse.vtk.org/u/ronzim)
#### Post date: [May 11, 2021, 3:30pm UTC](https://discourse.vtk.org/t/crop-widget-handles-moves-only-when-dragging-horizontally/5762/4 "2021-05-11T15:30:47Z")

</div>

Here’s the link to the video

> **[crop.mp4 (video)](https://drive.google.com/file/d/14tWfswa4z68xVEWZLWGw9WwU826HWhb7/view?usp=sharing)**
>
> Google Drive file.

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [May 11, 2021, 3:42pm UTC](https://discourse.vtk.org/t/crop-widget-handles-moves-only-when-dragging-horizontally/5762/5 "2021-05-11T15:42:17Z")

</div>

Actually what we are seeing make sense as when you move vertically you are not changing the position of the plan.

Think of a virtual plan normal and based on where your mouse is and how to move a point along that virtual line intersect with your mouse pointer.  
The Y axis is almost normal to that virtual plan normal. So moving along Y is not affecting the plane position along its normal.

---

<div class="post-metadata">

### Author: ![ronzim](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ronzim/32/3153_2.png) [@ronzim](https://discourse.vtk.org/u/ronzim)
#### Post date: [May 11, 2021, 4:01pm UTC](https://discourse.vtk.org/t/crop-widget-handles-moves-only-when-dragging-horizontally/5762/6 "2021-05-11T16:01:51Z")

</div>

Thank you, I see your point. But the same happens when I drag the handle on the top plane (ie horizontal plane). I can produce a video as well.

---

<div class="post-metadata">

### Author: ![ronzim](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ronzim/32/3153_2.png) [@ronzim](https://discourse.vtk.org/u/ronzim)
#### Post date: [May 11, 2021, 4:22pm UTC](https://discourse.vtk.org/t/crop-widget-handles-moves-only-when-dragging-horizontally/5762/7 "2021-05-11T16:22:39Z")

</div>

Here it is: [DigletTK - VR example - Google Chrome 2021-05-11 18-16-59.mp4 - Google Drive](https://drive.google.com/file/d/1SKHeeRuwCJbDgrgQe1HHqRpTcGK0Kupt/view?usp=sharing)

I have made a comparison between my application and vtk.js example.  
I can reformulate the problem in these terms: when dragging an handles, in vtk.js example it remains under the cursor, in my app it does not.

Thank you for the time you are spending helping me.

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [May 11, 2021, 5:11pm UTC](https://discourse.vtk.org/t/crop-widget-handles-moves-only-when-dragging-horizontally/5762/8 "2021-05-11T17:11:39Z")

</div>

Wow indeed, the second video really show the issue… I’m not sure what is the problem, but it is definitely a bug on the vtk.js side…

@Forrest

---

<div class="post-metadata">

### Author: ![ronzim](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ronzim/32/3153_2.png) [@ronzim](https://discourse.vtk.org/u/ronzim)
#### Post date: [May 12, 2021, 8:16am UTC](https://discourse.vtk.org/t/crop-widget-handles-moves-only-when-dragging-horizontally/5762/9 "2021-05-12T08:16:32Z")

</div>

Thanks Sebastien! Should I fill an issue on github ?

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [May 12, 2021, 4:05pm UTC](https://discourse.vtk.org/t/crop-widget-handles-moves-only-when-dragging-horizontally/5762/10 "2021-05-12T16:05:07Z")

</div>

I guess you did and Forrest already fixed it… Thanks!

---

<div class="post-metadata">

### Author: ![ronzim](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ronzim/32/3153_2.png) [@ronzim](https://discourse.vtk.org/u/ronzim)
#### Post date: [July 22, 2021, 2:40pm UTC](https://discourse.vtk.org/t/crop-widget-handles-moves-only-when-dragging-horizontally/5762/11 "2021-07-22T14:40:38Z")

</div>

Hi Sebastien, sorry for coming back to you after some time, but I was confident that the fix you mentioned would have solved my issue. Unfortunately, it has not.  
I’m still facing the same problem after updating vtk.js (now at 18.7.2). Can you give me support again ? Should I share my code ?  
Thanks in advance

---

<div class="post-metadata">

### Author: ![ronzim](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ronzim/32/3153_2.png) [@ronzim](https://discourse.vtk.org/u/ronzim)
#### Post date: [July 23, 2021, 8:23am UTC](https://discourse.vtk.org/t/crop-widget-handles-moves-only-when-dragging-horizontally/5762/12 "2021-07-23T08:23:43Z")

</div>

I’ve also found that the behavior changes with the loaded image. I can share one of them if needed.  
Notice that the issue is only present when dragging edges and faces handles. Corners handles seem always good.

---

<div class="post-metadata">

### Author: ![ronzim](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ronzim/32/3153_2.png) [@ronzim](https://discourse.vtk.org/u/ronzim)
#### Post date: [July 23, 2021, 9:23am UTC](https://discourse.vtk.org/t/crop-widget-handles-moves-only-when-dragging-horizontally/5762/13 "2021-07-23T09:23:39Z")

</div>

Digging into image properties, I’ve found that the issue happens with images with origin different from 0,0,0. I’ve reproduced the issue into vtk.js example by setting image origin to (200, 200, 200).  
If you can give me a hint of where in the source code this could affect the calculation, I can try to fix it.
