Thank you Murray! You are a star!
I was unable to replicate the behaviour you mentioned in your first solution where you said two points will be overlapping. I added a "console.log(drawnObjects.length);" line [1] to inspect the size of the array of points but I could not get it to show more points than expected. I did the following use case:
- Click on "Draw Point".
- Click on a random location in the board to insert point A.
- Click on a random location in the board to insert point B.
- Click on a random location in the board to insert point C.
- Click on "Select".
- Click on A to change its name.
- Click on B to change its name.
- Click on "Draw Point".
- Click on a random location in the board to insert point D.
- Click on a random location in the board to insert point E.
- Click on a random location in the board to insert point F.
- Click on "Select".
- Click on point C to change its name.
- Click on point E to change its name.
I could not see any overlapping "visually" or through the console. Here I append the console log to the previous actions.
- Click on "Draw Point". []
- Click on a random location in the board to insert point A. [ "Array Size = 1" ]
- Click on a random location in the board to insert point B. [ "Array Size = 2" ]
- Click on a random location in the board to insert point C. [
"Array Size = 3"
]
- Click on "Select". []
- Click on A to change its name. [ "A click somewhere has been performed.", "Array Size = 3" ]
- Click on B to change its name.
[
"A click somewhere has been performed.",
"Array Size = 3" ]
- Click on "Draw Point". []
- Click on a random location in the board to insert point D. [ "Array Size = 4" ]
- Click on a random location in the board to insert point E. [ "Array Size = 5" ]
- Click on a random location in the board to insert point F. [ "Array Size = 6" ]
- Click on "Select". []
- Click on point C to change its name. ["A click somewhere has been performed.", "Array Size = 6"]
- Click on point E to change its name. ["A click somewhere has been performed.", "Array Size = 6"]
The second solution you kindly provided [2] is a great help as I had no idea how to deal with reading user input, but it seems standard JS/ jQuery is doable here.
As for the app's intention, I am trying to implement something similar to (but not as rich) Geogebra Classic to enable users to draw Euclidean-geometry objects such as points, lines, parallel lines, angles, etc. So I am playing with basic JSXGraph functionality to gauge the difficulty of the project and get myself accustomed to JSXGraph. The buttons are definitely making life harder but I cannot see how I can otherwise allow the user to draw different geometry entities --- especially when it comes to drawing entities with constraints e.g. line perpendicular on a given line, or angle with size x for instance. For each of these, I need some sort of mode that allows the app to perform the user's specific intention.
Cheers.
[1] https://jsfiddle.net/Minoush82/98s02b67/
--
You received this message because you are subscribed to a topic in the Google Groups "JSXGraph" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jsxgraph/sS7YQxpT56k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jsxgraph+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jsxgraph/c4151964-9bf7-4693-9ff8-496452c78989n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jsxgraph/554c9acd-9766-4b16-8fca-8549ca55fe70n%40googlegroups.com.