Browser event and coordinates

From JSXGraph Wiki
Revision as of 17:36, 20 March 2011 by Michael (talk | contribs) (Created page with "This example shows how to add a point whenever the user clicks on the board. The function getMouseCoords extracts the click coordinates from the event object and returns a JXG.Co...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This example shows how to add a point whenever the user clicks on the board. The function getMouseCoords extracts the click coordinates from the event object and returns a JXG.Coords object with the point's coordinates on the board. up() is the event listener attached to the board via board.addHook(). The for loop in the event listener is to check if there is already a point as we don't want to create a point in this case.