I need a marker that behaves much like adding a marker to a map. On double click cause a marker to be displayed at the point that was clicked, and returns the x/y pixel coordinates of the point that was clicked.
I have Raphael paper:
var R = Raphael("paper", 500, 500);
with paths (R.path("M 92.3456 ... 37.0934 Z")) on it that defines shapes. And I have to be albe to add markers on this paper with shapes.
I am not a javascript programmer so I don’t really even know where to start. So any help here is much appreciated!
Ok, I’ve made this simple fiddle to help you with your problem.
http://jsfiddle.net/mN5du/1/
I just add a Raphael doubleclick event to the circle (you can do the same with your paths). When this event is fired up, stores the mouse coordinates in two variables. Then I just use those two variables to draw a new circle. If you want to draw a path instead of a circle, you just need to use the variables within the path coordinates.
I hope this works for you! If you have any questions just tell me! bye!
Edit: Look at the commentary Below, is a good contribution to the answer!
Edit2: The line
console.log(x,y)Its there to print the mouse values in the browser console, it’s not necessary for the code to work.