findPartsAt is giving parts which are not there at that point as well

For accessibility purpose, we are calling robot.mouseMove(x,y) and
we have mouseEnter binding registered on Node/Link. Inside that mouseEnter binding function, we are calling findPartsAt to get the exact Node/Link data. But we are getting the incorrect link with findPartsAt

Here is the diagram

I am trying to identify link(New path2) with its unique point(251.5,122.5). But I am getting link NewPath1 which doesn’t have (251.5,122.5) in its points array. Is this a bug or am i missing something ?

At that location

There are indeed both link geometries, so it makes sense that you would find both of them. findPartsAt is not just looking at link points, but the whole link geometry and all other components of the link (labels, arrowheads, etc).

Hi @simon , even then we are not getting both the links with findPartsAt, we are getting only link 1.

In general the findObjectAt findPartAt methods are very precise. It is almost certainly that the rounded corner is making findPartsAt miss link 2, since you are using the corner position, and the link route points are not where the link geometry goes, thanks to the rounded corner. the find... methods only look at an object’s geometry.

You could test this by removing the Link.corner setting. But you may want to instead choose a place on the link that is not the corner for your hit testing.

Thanks for the reply @simon . In that case can you please explain how can I solve this particular use case…
For accessibility purpose(We are setting focus on every link for every keyboard tab navigation), We are simulating robot.mouseMove( on every link for every tab key press and setting stroke value of link in the mouseEnter binding.
Clearly this approach is not working for overlapped links with Link.corner. So , how can we able to acheive this ?

Is your app using the built-in highlighting mechanism? GoJS Highlighting -- Northwoods Software

If not, after you execute myDiagram.highlightCollection(myDiagram.links), then each time the user presses the space bar key, another Link will be highlighted in turn. That is because pressing the space bar invokes the CommandHandler.scrollToPart command. CommandHandler | GoJS API

No @walter, For accessibility purpose, we have added invisible html buttons on canvas for every node and link. And upon every tab key press event, we are calling robot.mousemove to the location/point of that particular part and then setting stroke property of that node/link in mouseEnter event.

That’s where we are facing challenge for overlapping of two along links with corner property. So can you please suggest how can we get the unique link ?

we saw that in robot.mouseMove we can pass eventprops as well… can we be able to get these in mouseEnter callback function ?

Do you have the key of the node/link associated with the HTML button?

Rather than using the Robot for mouse events, it would probably be better to get the node/link associated with your HTML button via its key, then set Part.isHighlighted and have an associated binding to change the stroke.