Conversation
Walkthrough지도 뷰에서 동일 좌표 마커의 겹침 문제를 해결하기 위해 좌표 추적 및 지터(jitter) 기반 위치 오프셋을 도입하였으며, 토스트 알림의 기본 표시 시간을 3초에서 1.8초로 단축하였습니다. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
Neki-iOS/Features/Map/Sources/Presentation/Sources/View/NaverMapView.swift (1)
258-298:⚠️ Potential issue | 🟠 Major지터 위치의 안정성/확장성에 대한 우려
현재 구현에 두 가지 잠재적 이슈가 있습니다.
overlapIndex가photoBooths순회 순서에 의존합니다.coordinateFrequency는updateMarkers호출마다 새로 계산되지만, 지터 위치는isNew || isSelectedAffected인 경우에만 재계산되어currentKeyByID에 저장됩니다. 만약store.visiblePhotoBooths의 정렬/순서가 업데이트 사이에 바뀌면(예: 거리순 재정렬), 동일 좌표의 부스가 선택 변경으로 re-key 될 때 이전과 다른overlapIndex를 받아 마커 위치가 점프할 수 있습니다. 또한 같은 좌표에 이미 index 0으로 배치된 부스 A가 있고 나중에 새 부스 B가 순회에서 A보다 먼저 나오면, B는 index 0을 받아 A와 겹치게 됩니다. 결정론적 분산을 보장하려면 부스 ID 기반의 정렬(예:booth.id오름차순)으로 인덱스를 할당하거나, 좌표별로 ID 집합을 기억해 두고 그 안에서의 정렬 위치를overlapIndex로 사용하는 방식이 안전합니다.
angle = overlapIndex * π/3은 6개까지만 유일한 방향을 갖습니다. index 6은 angle2π로 index 0이 있었다면 그 근방(반경 방향)과 충돌하고, index 7 이후는 index 1, 2 …와 동일한 오프셋이 되어 다시 겹칩니다. 동일 좌표의 부스 수가 6을 넘을 가능성이 있다면 반경을 링(ring)별로 늘리거나(ring = overlapIndex / 6,offsetRadius * (1 + ring)), 해당 좌표의 총 개수에 맞춰2π / count로 각도를 재산정하는 방식을 고려해 주세요.♻️ 링 기반 분산 예시
- func calculateJitteredPosition(latitude: Double, longitude: Double, overlapIndex: Int) -> NMGLatLng { - guard overlapIndex > .zero else { return NMGLatLng(lat: latitude, lng: longitude) } - - let offsetRadius = 0.00005 - let angle = Double(overlapIndex) * (Double.pi / 3) - let latitudeOffset = offsetRadius * cos(angle) - let longitudeOffset = offsetRadius * sin(angle) - return NMGLatLng(lat: latitude + latitudeOffset, lng: longitude + longitudeOffset) - } + func calculateJitteredPosition(latitude: Double, longitude: Double, overlapIndex: Int) -> NMGLatLng { + guard overlapIndex > .zero else { return NMGLatLng(lat: latitude, lng: longitude) } + + let slotsPerRing = 6 + let baseRadius = 0.00005 + let ring = (overlapIndex - 1) / slotsPerRing + 1 + let slot = (overlapIndex - 1) % slotsPerRing + let angle = Double(slot) * (2 * .pi / Double(slotsPerRing)) + let radius = baseRadius * Double(ring) + return NMGLatLng( + lat: latitude + radius * cos(angle), + lng: longitude + radius * sin(angle) + ) + }추가로, 순회 순서 의존성을 제거하려면
updateMarkers앞단에서 부스를id기준으로 그룹핑해 각 좌표 내 정렬을 고정한 뒤overlapIndex를 결정하시는 것을 권장드립니다.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Neki-iOS/Features/Map/Sources/Presentation/Sources/View/NaverMapView.swift` around lines 258 - 298, The jitter placement is non-deterministic and repeats every 6 indices causing overlaps; modify updateMarkers to first group photoBooths by coordinateKey (the same key used in coordinateFrequency), sort each group by booth.id to deterministically assign overlapIndex per booth.id (update currentKeyByID and BoothClusteringKey assignment to use this stable index), and change calculateJitteredPosition to accept both overlapIndex and the group's total count (or compute ring = overlapIndex / 6) so you compute angle = 2π * (indexWithinRing) / max(countInRing,1) or scale radius by (1 + ring) to avoid collisions for index >=6; ensure calls to calculateJitteredPosition and any stored keys use the new signature/logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@Neki-iOS/Features/Map/Sources/Presentation/Sources/View/NaverMapView.swift`:
- Around line 258-298: The jitter placement is non-deterministic and repeats
every 6 indices causing overlaps; modify updateMarkers to first group
photoBooths by coordinateKey (the same key used in coordinateFrequency), sort
each group by booth.id to deterministically assign overlapIndex per booth.id
(update currentKeyByID and BoothClusteringKey assignment to use this stable
index), and change calculateJitteredPosition to accept both overlapIndex and the
group's total count (or compute ring = overlapIndex / 6) so you compute angle =
2π * (indexWithinRing) / max(countInRing,1) or scale radius by (1 + ring) to
avoid collisions for index >=6; ensure calls to calculateJitteredPosition and
any stored keys use the new signature/logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: d0cae3df-041b-4cd3-8065-3cdf70b881c3
📒 Files selected for processing (2)
Neki-iOS/Features/Map/Sources/Presentation/Sources/View/NaverMapView.swiftNeki-iOS/Shared/DesignSystem/Sources/Component/NekiToast/NekiToast.swift
🌴 작업한 브랜치
✅ 작업한 내용
❗️PR Point
📸 스크린샷
QA시트에 스크린샷 첨부해두었습니다. 이것으로 대체합니다.
📟 관련 이슈
Summary by CodeRabbit
버그 수정
작업