Browser event and coordinates

From JSXGraph Wiki
Revision as of 09:07, 21 March 2011 by Michael (talk | contribs)
Jump to navigationJump to search

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.