Skip to content

Commit

Permalink
Fix the number font size to fit inside a cluster marker
Browse files Browse the repository at this point in the history
  • Loading branch information
Yigal Omer committed Sep 26, 2018
1 parent b28b797 commit 2706507
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Anyway/MarkerViews.swift
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ class ClusterView: MKAnnotationView {
let size = CGSize(squareSide: 30)

// the label for the number

let aLabel = UILabel(frame: CGRect(origin: CGPoint.zero, size: size))
aLabel.textAlignment = .center
aLabel.font = UIFont.systemFont(ofSize: 14)
Expand All @@ -233,6 +232,12 @@ class ClusterView: MKAnnotationView {
if let cluster = annotation as? OCAnnotation {
let numOfAccidents = cluster.annotationsInCluster().count
anImage.image = clusterImageForClusterCount(numOfAccidents)
if (numOfAccidents >= 100){
aLabel.font = UIFont.systemFont(ofSize: 7)
}
else if (numOfAccidents >= 10){
aLabel.font = UIFont.systemFont(ofSize: 10)
}
}
anImage.frame.size = size

Expand Down

0 comments on commit 2706507

Please sign in to comment.