-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get coordinates where mouse is/click #215
Comments
@JosephIsaacTurner is this what you're looking for? #166 |
I actually figured out a solution to my problem. I couldn't figure it out anywhere else, even on the page mentioned by @cynde. There's a method called papaya.viewer.Viewer.prototype.getCurrentValueAt So, what I did was added a boolean parameter to the papaya.viewer.Viewer.prototype.getCurrentValueAt method, and whenever the papaya.viewer.Viewer.prototype.drawViewer calls the method, this parameter is set as true; whenever true, I change the value of an HTML attribute in my page to show the coordinates created by the papaya.viewer.Viewer.prototype.getCurrentValueAt method. It might be easier to understand looking at my code for these methods: This is what it looks like: papaya.viewer.Viewer.prototype.getCurrentValueAt = function(x, y, z, click) {
}; You can copy this snippet and replace the method in your version of papaya.js. You will also want to change the method that calls it; The method is really big, and I made a minute change near the very end (see bold text): papaya.viewer.Viewer.prototype.drawViewer=function(c,b){ |
Hi guys,
I am using Papaya to make a webpage where users can search based on coordinates.
A good example of something similar is neurosynth (https://neurosynth.org/locations/).
I want users to be able to search based on where they click on the papaya viewer. Just like the neurosynth viewer, which allows one to search based on the selected coordinate.
This is all straightforward.
I just want to know how to return the xyz coordinates where the user's mouse is hovering and/or where was last clicked.
It seems like it should be simple, because the papaya viewer always knows the coordinates of the mouse when you hover over the viewer (you can see at the bottom); I just don't know how to actually get those values and use them lol.
Thanks
The text was updated successfully, but these errors were encountered: