LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Zoom in/out picture with mouse and mouse wheel?

Hi, thanks to you guys I was able to get my picture up on the front panel and was able to zoom in/out of it with Zoom factor. However, the user interface is a bit cumbersome. You have to turn the Zoom wheel and then reposition with the vertical/horizontal bars. So I was trying to implement a way of having the mouse do all this. Specifically the mouse wheel could act as the zoom and the mouse could then drag the picture around inside the frame without the use of the vertical/horizontal bars. I've attached a sample of my zoom.vi here. Any ideas? Can I do this through property nodes?

Download All
0 Kudos
Message 1 of 3
(4,008 Views)

Hi,

 

for the Zoom function, you could use the mouse --> Mouse wheel event. It gives you back the the orientation (mostly vertical in my case) and a Delta (-1 or +1) which you can use to add to the current zoom with a factor. I would implement it as a functional global, just to avoid the shift registers in the main BD.

 

As for the Drag function, you could use a combination of Mouse down and mouse up events additionally mouse move, if you want the drag to feel responsive. Those Events give you back the mouse position, with which you can calculate the amount and direction by which to move your image. For setting the Image position I only found the origin property, which works, but I find it a bit odd, that there isn't a "proper" property to move the picture... At least I didn't find one.



Remember Cunningham's Law
0 Kudos
Message 2 of 3
(3,976 Views)

The Code Capture Tool has a pan feature for the preview image. You can look at the source code after installing it to see how it works (should be in <LabVIEW>\Project).


___________________
Try to take over the world!
0 Kudos
Message 3 of 3
(3,945 Views)