JavaScript: Event for mousemove in desktop app?

s_o shared this question 6 years ago
Answered

I've seen a similar question has been asked already 6 years ago with no answer:

I would like to create a line that moves with mouse, for an applet this is quite easy: https://www.geogebra.org/m/xpMHAQYq by using JavaScript events (document.getElementsByClassName("GeoGebraFrame")[0].addEventListener("mousemove",handleMouseMove);)

Is there any way to add the event listeners in the desktop app? I noticed that the ggbApplet object contains a lot more than what is documented. Is there any complete documentation or a readable source file to see all it's methods?

I found this: https://dev.geogebra.org/tr...

It contains some great ideas, but It seems to be completely outdated.

Comments (4)

photo
1

Sorry, that's not possible in the desktop app

photo
1

Sorry for my english, i am will translate this with Google Translate from spanish.

Hi Stefan, I've been researching just like you about some things related to mouse coordinates, but unlike you, I do not know about "javaScript".

I would like to know, if it is not too much trouble for you, if possible you can explain me how you managed to use the mouse coordinates in a Geogebra Applet. While I understand that it is not possible to do on the desktop version, I find it very interesting what you have achieved in the Applet that you share.

I need to do something very similar to what you have done, I mean the straight "mouseline" (the line in green color) but I need it to be perpendicular to the Y axis, by a point "MYP" with coordinate (0, y ("Y" mouse Coordinate).

I hope you can help me and later also I could help you in what you need.

photo
1

Sorry for my english, i am will translate this with Google Translate from spanish.

Hi Stefan, I've been researching just like you about some things related to mouse coordinates, but unlike you, I do not know about "javaScript".

I would like to know, if it is not too much trouble for you, if possible you can explain me how you managed to use the mouse coordinates in a Geogebra Applet. While I understand that it is not possible to do on the desktop version, I find it very interesting what you have achieved in the Applet that you share.

I need to do something very similar to what you have done, I mean the straight "mouseline" (the line in green color) but I need it to be perpendicular to the Y axis, by a point "MYP" with coordinate (0, y ("Y" mouse Coordinate).

I hope you can help me and later also I could help you in what you need.

photo
1

This is a late comment for people who find this thread in the future. If you want to explore the JavaScript used here to create the mouseMove event listener, navigate to the activity s_o shared above and go to Details, then download the activity. Their code is in the Global JavaScript area.

© 2023 International GeoGebra Institute