Fix map pin duplication and overlap issues - #227
Conversation
The problem: Camp and art pins were being duplicated on the map because the same objects appeared in multiple YapDatabase views (art/camps views, visit status views, favorites view). The solution: Implemented dictionary-based de-duplication using type-prefixed keys (e.g., "BRCArtObject:art-123") to ensure exactly one annotation per unique object. Removed the now-unnecessary filterOutFavorites() method. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
The previous fix only handled FilteredMapDataSource duplicates. This moves de-duplication to MapViewAdapter where ALL annotations flow through, ensuring duplicates are prevented from any source (filters, zoom-based queries, future sources). Key changes: - Added annotationsByID dictionary to track all annotations on map - Created keyForAnnotation() helper for consistent key generation - Modified addAnnotations() to check for and skip duplicates - Reverted FilteredMapDataSource to simple array appending - Clean separation: data sources filter, MapViewAdapter presents This ensures no duplicate pins regardless of zoom level or data source. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Simplified the de-duplication and offset logic: - Single pass using filter instead of multiple iterations - Sort overlapping annotations by uniqueID for consistent positioning - Apply offsets immediately during filtering - Cleaner, more functional approach This ensures annotations at the same coordinate always get the same relative positions regardless of the order they're added. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
The bug: When adding a new annotation to an overlapping group, only the new annotation was being offset, leaving existing ones at their original positions. The fix: Re-offset ALL annotations in the overlapping group whenever a new one is added, ensuring proper radial distribution. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Claude finished @chrisballinger's task —— View job Code Review Complete ✅I've analyzed this PR for code quality, potential bugs, performance, security, and test coverage. Here's my detailed feedback: Todo List:
✅ StrengthsArchitecture & Design
Code Quality
|
Visit status filtering was out of scope and not being used. Removed: - filterByVisitStatus() method - Visit status data sources (visited, wantToVisit, unvisited) - All calls to filterByVisitStatus() This simplifies the code and removes unused functionality. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
The issue: reloadAnnotations() was clearing the entire annotationsByID dictionary, losing track of zoom-based annotations that UserMapViewAdapter had added separately. This caused duplicates when annotations were re-added. The fix: Don't clear the entire dictionary in reloadAnnotations(). Let removeAnnotations() handle cleanup only for the annotations being removed. This keeps zoom-based annotations tracked across reloads. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Claude finished @chrisballinger's task —— View job Code Review Complete ✅I've analyzed this PR for code quality, potential bugs, performance, security, and test coverage. Here's my detailed feedback: Todo List:
✅ StrengthsArchitecture & Design
Code Quality
|
|
Claude finished @chrisballinger's task —— View job Code Review Complete ✅Todo List:
✅ StrengthsArchitecture & Design
Code Quality
|
New features: - Art and camps can now be shown only at high zoom levels (default) - Art appears at zoom 16+, camps at zoom 17+ when in zoomed-only mode - New "Always" sub-toggle to show at all zoom levels - Hierarchical UI: main toggle enables/disables, sub-toggle for always visible This reduces map clutter at low zoom levels while maintaining detail when zoomed in. The de-duplication system ensures no duplicates when items appear from both data sources. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Claude finished @chrisballinger's task —— View job Code Review Complete ✅Todo List:
✅ StrengthsArchitecture & Design
Code Quality
|
|
Claude finished @chrisballinger's task —— View job Code Review Complete ✅Todo List:
✅ StrengthsArchitecture & Design
Code Quality
|
Summary
Problem
Camps and art pins were being duplicated on the map when:
Solution
Implemented dictionary-based de-duplication at the MapViewAdapter level using type-prefixed keys. This ensures each unique object appears only once on the map regardless of data source.
Key Changes
annotationsByIDdictionary to track all annotations"BRCArtObject:art-123"prevents ID collisionsTest Plan
🤖 Generated with Claude Code