LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

mouse position in picture

Hello! I found a problem with picture indicator. If zooming or panning the mouse position is not correct. After struggling around for a while I found this solution (but it would have been better if NI can correct the problem).
The mouse position in the bitmap==ZV+dV*MP
where (properties belonging to the picture)
dV== 1 / (propertie zoom factor)
ZV== - (dv-1)*(propertie origin)
MP== propertie mouse.mousepos
/tj
0 Kudos
Message 1 of 6
(4,087 Views)

Hello Thomas!

I built a small example program to test this and I am not sure if it can be considered a bug or not. When zooming the mouse coordinates remains the same even though its position compared to the other objects of course changes and I assume that you would like to have the mouse position changed when the other objects resizes. Is that correct?

Regards,

Jimmie A.

Applications Engineer, National Instruments

 

Regards,
Jimmie Adolph
Systems Engineering Manager, National Instruments Northern European Region

Message 2 of 6
(4,017 Views)

I agree with Jimmie. I don't consider this "not correct".

To quote from the help for this property:

Position is a cluster of (Vertical, Horizontal) coordinates... Mouse position is relative to the picture control origin.

The "origin" is the top left visible pixel. The mouse property returns the cursor cooridnates for the control, not the pixel number in the picture. If you want to get that, you need to calculate it using the formula you gave.


___________________
Try to take over the world!
0 Kudos
Message 3 of 6
(4,005 Views)
In graphics there is often confusion between the different coordinate systems, and world coordinated do not agree with screen coordinates but with a 2d system it is easy to transform between them through a translation and scale matrix operation.
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 4 of 6
(4,002 Views)
Thanks Thomas,
 
you are great!
exactly it works as you described.
 
babalabo
0 Kudos
Message 5 of 6
(3,858 Views)

It works perfectly!!!

 

Thanks

Davis Montenegro
0 Kudos
Message 6 of 6
(3,339 Views)