In your mouseHover event handler, GraphObject | GoJS API, would it be OK to just find and move Node1 to where you want it to be?
Would you want to also implement a mouseLeave event handler to move Node1 back to where it had been? But the event handler will need to check whether the mouse is leaving Node2 to go into Node1 and not move Node1 then. The mouseLeave event handler on Node1 would need to do the same check when leaving Node1 but going into Node2.
the default state would be just seeing Node2. When i hover over or rather on mouseEnter of Node2, Node1 appears at the RightCenter of the Node2, and on mouseLeave of Node2, Node1 disappears.
Also, when i am inside Node1, Node2’s mouseLeave shouldn’t get triggered else i wont be able to click within Node1.
Your mouseLeave event handler should look at the next argument to decide whether or not to move Node1 back to where it was originally. Same goes for the mouseLeave event handler on Node1, when going back to Node2 (except presumably you do not want to move Node1).
Well, that’s what I understood from looking at your screenshots.
Do these actually need to be Nodes? Will there be Links connecting them?
If not, maybe you could just use plain Parts or Adornments.
In particular, I was thinking that upon mouseEnter you could add an Adornment to Node2, and remove that Adornment upon mouseLeave.
Examine the Hover Buttons sample: Buttons that show on Hover
However, the mouseLeave and mouseEnter events gets triggered continuously when my mouse pointer is inside adornment.
How to prevent this from happening?
When you show the Adornment, is the mouse point contained by the Adornment? If so, the mouse is leaving whatever it was in and entering the Adornment (or some GraphObject within it). Don’t remove the Adornment if the mouse is in the Adornment!
In the Hover Buttons sample, note that there’s no mouseLeave event handler on or in the Node.
Right, in the Hover Buttons example the adornment will only be remove when i explicitly go inside the AdornedButton and leave from there.
However, the scenario that i need is that the AdornedObject should stay until i am either in the Node or in the AdornedObject. If I am not in one of the two objects, I want the adornment to be removed.
PS. While I am in the Node, I may or may not move my cursor inside the Adorned Object. Hence, the remove Adornment was written in the Node.
OK, so don’t remove the Adornment if the mouse is in either the Node or in the Adornment.
Note that mouseLeaveGraphObject | GoJS API (and mouseEnter, for that matter) are functions that take three arguments – you may be interested in the third argument!