Skip to content

Commit

Permalink
Merge pull request #294 from boostcampwm2023/iOS/feat#291
Browse files Browse the repository at this point in the history
feat: 지도에서 영상 검색시 반경 radius 표시
  • Loading branch information
anyukyung authored Dec 11, 2023
2 parents 7490581 + 49d8111 commit d2b726d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions iOS/Layover/Layover/Scenes/Map/MapModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import Foundation

enum MapModels {

static let searchRadiusInMeters: Double = 10000

struct DisplayedPost: Hashable {
let boardID: Int
let thumbnailImageData: Data?
Expand Down
15 changes: 15 additions & 0 deletions iOS/Layover/Layover/Scenes/Map/MapViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,17 @@ extension MapViewController: VideoPickerDelegate {
}
}

func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {
if overlay is MKCircle {
let renderer = MKCircleRenderer(overlay: overlay)
renderer.strokeColor = UIColor.primaryPurple.withAlphaComponent(0.6)
renderer.fillColor = UIColor.primaryPurple.withAlphaComponent(0.3)
renderer.lineWidth = 2.0
return renderer
}
return MKOverlayRenderer()
}

}

// MARK: - MapDisplayLogic
Expand All @@ -293,6 +304,10 @@ extension MapViewController: MapDisplayLogic {
carouselDatasource.apply(snapshot)

mapView.removeAnnotations(mapView.annotations)
mapView.removeOverlays(mapView.overlays)

let circleOverlay = MKCircle(center: mapView.centerCoordinate, radius: Models.searchRadiusInMeters)
mapView.addOverlay(circleOverlay, level: .aboveLabels)
viewModel.displayedPosts.forEach { createMapAnnotation(post: $0) }
}

Expand Down

0 comments on commit d2b726d

Please sign in to comment.