Skip to content

Fix incorrect country labels and flags when coloring neighboring countries - #2190

Open
nithinshiju-dev wants to merge 1 commit into
llaske:devfrom
nithinshiju-dev:fix-country-tooltip-hit-tolerance
Open

nithinshiju-dev wants to merge 1 commit into
llaske:devfrom
nithinshiju-dev:fix-country-tooltip-hit-tolerance

Conversation

@nithinshiju-dev

Copy link
Copy Markdown
Contributor

Description

This PR fixes an issue where clicking adjacent countries (for example, India and Bhutan) could display incorrect country labels and flags.

The issue was caused by the click hit tolerance. With hitTolerance set to 4, clicks near country borders could match neighboring features. Reducing it to 0 ensures that only the intended country is selected.

Changes

  • Changed hitTolerance from 4 to 0 in activities/ColorMyWorld.activity/lib/map.js.

Testing

  • Reproduced the issue by clicking adjacent countries.
  • Verified that incorrect neighboring country tooltips no longer appear.
  • Confirmed that the intended country's tooltip is displayed correctly.

Fixes #2179

@nithinshiju-dev

Copy link
Copy Markdown
Contributor Author

@llaske I tracked the issue to the click hitTolerance. Setting it to 0 instead of 4 prevents neighboring countries from being selected during normal clicks. The only remaining edge case is clicking exactly on the shared border, where both countries may still be detected due to the map geometry.

Screen.Recording.2026-07-31.075155.mp4

@llaske

llaske commented Aug 6, 2026

Copy link
Copy Markdown
Owner

@nithinshiju-dev did you test it on a touch device? I'm afraid reducing hit tolerance could have an impact on touch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants