AnsweredAssumed Answered

Prevent map from scrolling when tapping on graphics?

Question asked by linkedpixel on Oct 2, 2017

Quick question. I am using view.hitTest(event.screenPoint) handler to check whether the user has tapped on a given graphical icon on a layer (using response.results[0].graphic). If so, I present additional data and handle the tap as a "marker selected" function.


The problem is that the map is very sensitive to movement especially on certain devices including Android (e.g,. S6) and so if you tap on a marker and move your finger even a pixel before releasing it then the hit test fails and the map simply scrolls a trace amount. This makes it increasingly difficult to actually select graphics in this manner.


Is there a good way to stop propagation of events if the hit test is true for a graphic, so that the map does not move at all once the user has touched an icon and the subsequent click actions for the graphic can occur?


EDIT: I wound up swapping the generic "click" event with "pointer-down" to handle the action the moment the user initially taps the taps, versus when they release their finger. Can also play around with event.stopPropagation but just implementing pointer-down to handle these aspects resolved the specific issue I was having.