Will the hitTest tolerance be configurable?

424
4
10-20-2023 09:13 AM
JonathanTiu
New Contributor II

hi! is there any chance in the 4.28 release next week that the hitTest tolerance is configurable? 

As per this thread, (https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/clarification-on-4-23-hittest-ret...),   someone mentioned that the tolerance is hardcoded at 6 pixels and that they would raise with the development team about making it configurable.  6 pixels is enormous for non-mobile applications. We have custom shape markers on our map like stars and our hover feedback/tooltip appears when we're still relatively far away from the border of the star marker!!

Here's a screenshot of our app....where the tooltip bottom left corner is where the hitTest thinks we "hit" the marker (Trader's Joe).  It's way off from the actual marker.

JonathanTiu_0-1697818338904.png

 

 

0 Kudos
4 Replies
Noah-Sager
Esri Regular Contributor

Hi @JonathanTiu. Thanks for posting your question here. This issue did not get addressed for 4.28, but is still being actively considered for a future release.

LaurenBoyd
Esri Contributor

@JonathanTiu good news! We have updated the MapView.hitTest() method's tolerance for desktop (activity with a mouse) to a 1px radius for most symbols at version 4.29. Hope this helps!

Lauren
0 Kudos
JonathanTiu
New Contributor II

Wonderful!  thank you 🙂 

0 Kudos
JonathanTiu
New Contributor II

hi @LaurenBoyd  !

 

i just tried 4.29.  it seems it's still showing a larger radius than 1px... the upper left corner of our tooltip is where it thinks the hitTest said we hit something and we are clearly still far from the border of the star symbol.

JonathanTiu_0-1712104284525.png

 

when you said most symbols, what about symbols specified with a custom svgPath?

In my screenshot, the star shaped marker symbol is defined by an svg path.  like this:

const symbol = new esri.SimpleMarkerSymbol();
symbol.path = 'M63.029,34.451l21.416,32.005c0.204,0.305,0.511,0.528,0.864,0.628l37.061,10.478 c1.059,0.3,1.475,1.579,0.794,2.444l-23.823,30.253c-0.227,0.289-0.344,0.649-0.33,1.016l1.494,38.482 c0.043,1.1-1.046,1.891-2.079,1.511l-36.148-13.307c-0.345-0.127-0.723-0.127-1.068,0l-36.141,13.307 c-1.033,0.38-2.121-0.41-2.079-1.51l1.487-38.482c0.014-0.367-0.103-0.727-0.33-1.016L0.332,80.006 c-0.681-0.865-0.265-2.144,0.794-2.444l37.06-10.479c0.354-0.1,0.66-0.323,0.864-0.628l21.409-32.004 C61.071,33.536,62.417,33.536,63.029,34.451z';

 

0 Kudos