0

I have a choropleth map comprised of small and complex polygons. When zoomed in, the map works as normal, whereby as the pointer hovers over a polygon, info about the polygon is displayed in the top right hand corner and the outlign of the polygon is highlighted. Almost identical to the one in the leaflet site.

However, I've noticed that when zoomed out, moving the pointer over the map can cause 'flickering' as nearby polygons are alternatively highlighted. The tiniest movements will cause this to occur, and if the pointer is placed exactly on the border of two polygons, no movement of the mouse is required at all. It's not a show stopper but it distracts from the experience of using the maps. I wondered if anyone has had the same situation and if there is a pattern for dealing with this. So far I've been thinking along the lines of:

  • Having some kind of buffer within the polygon whereby the hover event is only triggered when it is a few pixels away from the border.
  • A delay between hover triggers.
  • Perhaps two or more polygons are triggering an event? In which case prioritise only one triggering object.
  • Preventing hover events when the map is too far zoomed out.

Any ideas from anyone who has had a similar issue?

  • Buffer would be complicated. I would recommend delay (with some experiment about duration), but only for zoom levels that are problematic. – TomazicM Nov 25 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.