Implementing Crosshair Movement on Mouse Click in MPR Viewer Using vtlResliceCursorWidget

I am currently working on a project that involves implementing a functionality in the MPR viewer. Specifically, I am using the vtlResliceCursorWidget and aiming to synchronize the crosshair movement with mouse clicks in such a way that the selected slide updates accordingly. Additionally, I want to ensure that the crosshair movement corresponds to changes in the slider position.

I would greatly appreciate any insights, guidance, or code examples you may have regarding this integration. If anyone has experience or knowledge in this area, your assistance would be invaluable. Thank you in advance for your time and support.
@finetjul @rajajms

I’m not sure to undertand the difference between what you want to achieve and the existing vtkResliceCursorWidget example.

1 Like

Thank you for your response. I’ll provide some clarification on my query. While the vtkResliceCursorWidget example is indeed a helpful resource, my specific use case involves the vtlResliceCursorWidget. I am looking for guidance on synchronizing the movement of the crosshair in the MPR viewer with mouse clicks, ensuring that the selected slide updates correspondingly. Additionally, I attached the video for more clarity.

Gotcha, you would like to implement a “jump to mouse position” feature.
You would need to edit the ResliceCursorWidget/behavior.js file, and notably the handleLeftButtonDown, handleMouseMove (to detect if the mouse was moved while the mouse button was down) and handleLeftButtonRelease (to perform the jump, i.e. call setCenter())

Thank you for pointing me in the right direction. I’m eager to proceed with implementing the “jump to mouse position” feature using the vtlResliceCursorWidget. To ensure I make the necessary modifications correctly, could you please provide more context or guidance on the following for better understanding?

this is a js example ,do you know some cpp examples as the sample.