Is there a method to return the step x/y value of where the mouse is when you call Click()?
Aug 5 2015, 4:20 pm
Best response
|
|
In the params argument of mouse functions, you can access icon-x and icon-y. This is the pixel coordinates of the mouse position inside of the object the mouse is over. If you determine the object's step_x/y and then apply the offset of the mouse to the object as well, you should be able to find the number you're looking for.
|
step x/y value?
You want a vector to the mouse position, but relative to what? You could use the icon-x, icon-y, or screen-loc parameters. If you use params2list() on the params argument given to Click() (and other mouse events), you can get those values as text (use text2num() if you want numbers). |
In response to Kaiochao
|
|
to the turf someone clicks on, albro helped me with params2list but when i try to output/use the value it's just blank
turf/Click(params) |
Just ran this test code, and it works just fine.
The only differences I see are that I included all of the arguments in Click() (Not sure if this affects it or not) and you're using a proc to output the message. One of these things is likely the culprit. EDIT: Just checked what would happen if I only did Click(params), and it broke it. Include all of the arguments for it to work. |
In response to Albro1
|
|
yea i guess i had to include all 3 arguments, works now. thanks
|
As I mentioned when you asked me this last night, getting the step_x/y isn't the same as icon_x/icon_y. You also need to account for pixel_x/y, step_x/y, bound_x, loc, transform.c/f, etc.
There's a lot you aren't accounting for, but overall the solution that albro gave you is pretty much identical to what you saw me doing in my snippet last night. |