Skip to content

Fix: Enhance TasksMap zoom behavior#7199

Open
sumitdahal7 wants to merge 1 commit intohotosm:developfrom
sumitdahal7:fix/7052-tasks-map-zoom-logic
Open

Fix: Enhance TasksMap zoom behavior#7199
sumitdahal7 wants to merge 1 commit intohotosm:developfrom
sumitdahal7:fix/7052-tasks-map-zoom-logic

Conversation

@sumitdahal7
Copy link
Copy Markdown
Contributor

What type of PR is this? (check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation
  • 🧑‍💻 Refactor
  • ✅ Test
  • 🤖 Build or CI
  • ❓ Other (please specify)

Related Issue

Fixes: #7052

Describe this PR

This PR enhances the TasksMap component by implementing a robust, programmatic zooming mechanism for specific tasks and adding UI interaction guards to improve the overall navigation experience.

Changes:

  • Task-Specific Zooming: Implemented zoomedTaskId support that allows the map to automatically calculate and fit its bounds (using @turf/bbox) to a specific task or a group of tasks.

  • Redundant Zoom Prevention: Introduced a lastZoomedIdRef utilizing JSON serialization to perform value-based comparisons on task selections. This ensures the map doesn't unnecessarily or re-zoom when mapResults or other dependencies update unless the task selection has actually changed.

  • Consistent State Reset: Optimized the cleanup logic within useLayoutEffect to correctly reset tracking references when task selections are cleared (null or empty array), ensuring reliable behavior on subsequent selections.

Screenshots

  • Image I (Before: Initial View of Task Map where map don't zoom to the selected taskID)
image
  • Image II (After the Fix: Initial View of Task Map where map zoom to the selected taskID)
image

@sonarqubecloud
Copy link
Copy Markdown

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modify project zoom level after task selection.

1 participant