|
232 | 232 | const lng = parseFloat(mission.location_lng); |
233 | 233 |
|
234 | 234 | if (isNaN(lat) || isNaN(lng)) return; |
235 | | - fullscreenMapManager.addCustomMarker(lat, lng, { |
236 | | - status: mission.status, |
237 | | - onClick: () => { |
238 | | - window.location.href = `/api/missions/${mission.id}/`; |
239 | | - } |
240 | | - }); |
241 | 235 |
|
242 | | - // ✨ 마커 생성 + 클릭 시 상세페이지 이동 |
243 | | - const marker = fullscreenMapManager.addCustomMarker(lat, lng, { |
244 | | - status: mission.status, // WAITING/MATCHED/COMPLETED |
| 236 | + // ✨ category 전달 → 카테고리별 색상 자동 적용 |
| 237 | + fullscreenMapManager.addCustomMarker(lat, lng, { |
| 238 | + category: mission.category, |
| 239 | + status: mission.status, |
245 | 240 | onClick: () => { |
246 | 241 | window.location.href = `/api/missions/${mission.id}/`; |
247 | 242 | } |
|
292 | 287 |
|
293 | 288 | /** |
294 | 289 | * 지도 마커 업데이트 |
295 | | - * - map_manager: 마커 생성/표시 (CSS 스타일 적용) |
| 290 | + * - map_manager: 마커 생성/표시 (카테고리별 색상 적용) |
296 | 291 | * - mission_list: 클릭 시 상세페이지 이동 |
297 | 292 | */ |
298 | 293 | function updateMapMarkers(missions) { |
|
311 | 306 | return; |
312 | 307 | } |
313 | 308 |
|
314 | | - // ✨ 마커 생성 + 클릭 시 상세페이지 이동 |
315 | | - const marker = mapManager.addCustomMarker(lat, lng, { |
316 | | - status: mission.status, // WAITING/MATCHED/COMPLETED |
| 309 | + // ✨ category 전달 → 카테고리별 색상 자동 적용 |
| 310 | + mapManager.addCustomMarker(lat, lng, { |
| 311 | + category: mission.category, |
| 312 | + status: mission.status, |
317 | 313 | onClick: () => { |
318 | 314 | window.location.href = `/api/missions/${mission.id}/`; |
319 | 315 | } |
|
432 | 428 | } |
433 | 429 |
|
434 | 430 | window.moveToCurrentLocation = async function(isFullscreen = false) { |
435 | | - const targetManager = isFullscreen ? fullscreenMapManager : mapManager; |
436 | | - |
437 | | - if (!targetManager) return; |
438 | | - |
439 | | - console.log(isFullscreen ? "전체화면 현위치 탐색..." : "일반 지도 현위치 탐색..."); |
440 | | - |
441 | | - try { |
442 | | - // KakaoMapManager 내부의 getUserLocation 활용 |
443 | | - const loc = await targetManager.getUserLocation(); |
| 431 | + const targetManager = isFullscreen ? fullscreenMapManager : mapManager; |
444 | 432 |
|
445 | | - // 해당 지도의 중심 이동 |
446 | | - targetManager.setCenter(loc.lat, loc.lng); |
447 | | - targetManager.setLevel(3); |
| 433 | + if (!targetManager) return; |
448 | 434 |
|
449 | | - // 내 위치 마커 표시 (MapUtils 활용) |
450 | | - await MapUtils.displayUserLocation(targetManager); |
| 435 | + console.log(isFullscreen ? "전체화면 현위치 탐색..." : "일반 지도 현위치 탐색..."); |
451 | 436 |
|
452 | | - } catch (err) { |
453 | | - console.error("현위치 이동 실패:", err); |
454 | | - alert("위치 정보를 가져올 수 없습니다."); |
455 | | - } |
456 | | -}; |
| 437 | + try { |
| 438 | + // KakaoMapManager 내부의 getUserLocation 활용 |
| 439 | + const loc = await targetManager.getUserLocation(); |
| 440 | + |
| 441 | + // 해당 지도의 중심 이동 |
| 442 | + targetManager.setCenter(loc.lat, loc.lng); |
| 443 | + targetManager.setLevel(3); |
| 444 | + |
| 445 | + // 내 위치 마커 표시 (MapUtils 활용) |
| 446 | + await MapUtils.displayUserLocation(targetManager); |
| 447 | + |
| 448 | + } catch (err) { |
| 449 | + console.error("현위치 이동 실패:", err); |
| 450 | + alert("위치 정보를 가져올 수 없습니다."); |
| 451 | + } |
| 452 | + }; |
457 | 453 |
|
458 | 454 | // ==================== 전역 함수 노출 ==================== |
459 | 455 |
|
|
0 commit comments