Select to view content in your preferred language

Unexpected MapView "click" hittest() behavior

1373
2
Jump to solution
10-20-2020 12:37 PM
CoreyRondeau
Emerging Contributor

I have been testing with map interaction with our React application utilizing arcgis javascript api 4.17. We are simply creating GeoJSON points that are being added to a #geojsonlayer in a basic Map. My goal was to be able to click on a point in the map and be able to do something with it. I was pleased when I found the following example code: ArcGIS API for JavaScript Sandbox. This is running on the 4.4 version of the API, but I referenced the documentation to confirm that it still applied. This example works as I would expect. You can click directly on a feature/graphic and it highlights. However, when I implemented the sample, I found that the click precision was far less. That is, I can click a fair distance away from a point (far enough that I wouldn't expect it to do anything) and it still highlights it. Upon further investigation, I changed the API version in the sample to be 4.17, and of course I got the same results as my application. Our speculation is that this inaccuracy is to help account for users on touch-capable devices. So my question is: Is there a way to adjust this click radius (for lack of a better term) to behave more like the 4.4 API version?

0 Kudos
1 Solution

Accepted Solutions
KristianEkenes
Esri Regular Contributor

Hey Corey,

This is a known issue. We're working on tightening the tolerance for hitTest.

View solution in original post

2 Replies
KristianEkenes
Esri Regular Contributor

Hey Corey,

This is a known issue. We're working on tightening the tolerance for hitTest.

CoreyRondeau
Emerging Contributor

That is great to know. Thank you for your quick reply!

0 Kudos