Skip to content

Commit

Permalink
Remove public clamping implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
vospennikov committed Sep 16, 2023
1 parent c20cc83 commit b402fb3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,16 @@ public extension ClusterManager {
///
/// Beyond this zoom level, annotations will be displayed individually.
///
/// - Note: The minimum value is `0` (max zoom out) and the maximum value is `20` (max zoom in). The default is
/// `20`.
@Clamping(to: 0...20)
public var maxZoomLevel: Double = 20
/// - Note: The minimum value is `0` (max zoom out). The default is `20`.
public let maxZoomLevel: Double

/// Threshold number for clustering within a region.
///
/// This count is the minimum number of annotations required to form a cluster. Annotations in regions with
/// fewer than this count will not be clustered.
///
/// - Note: The default is `2`.
@Clamping(to: 0...)
public var minCountForClustering: Int = 2
public let minCountForClustering: Int

/// Removal of non-visible annotations.
///
Expand All @@ -49,7 +46,7 @@ public extension ClusterManager {
/// When set to `true`, annotations outside the current map view will not be processed.
///
/// - Note: The default is `true`.
public var shouldRemoveInvisibleAnnotations: Bool
public let shouldRemoveInvisibleAnnotations: Bool

/// Distribution of annotations with identical coordinates.
///
Expand All @@ -59,16 +56,15 @@ public extension ClusterManager {
/// overlapping.
///
/// - Note: The default is `true`.
public var shouldDistributeAnnotationsOnSameCoordinate: Bool
public let shouldDistributeAnnotationsOnSameCoordinate: Bool

/// Distance (in meters) for distributing overlapping annotations.
///
/// When `shouldDistributeAnnotationsOnSameCoordinate` is `true`, this value represents the distance (in meters)
/// by which annotations should be shifted apart from a contested location.
///
/// - Note: The default is `3`.
@Clamping(to: 0...)
public var distanceFromContestedLocation: Double = 3
public let distanceFromContestedLocation: Double

/// Controls the positioning strategy of a cluster.
///
Expand Down Expand Up @@ -101,7 +97,7 @@ public extension ClusterManager {
/// ```
///
/// - Note: The default value is `.nearCenter`
public var clusterPosition: ClusterAlignment = .nearCenter
public let clusterPosition: ClusterAlignment

/// Dynamic size adjustment of the grid cell for a given zoom level.
///
Expand Down Expand Up @@ -131,7 +127,7 @@ public extension ClusterManager {
/// }
/// }
/// )
public var cellSizeForZoomLevel: (Int) -> CGSize
public let cellSizeForZoomLevel: (Int) -> CGSize

public init(
maxZoomLevel: Double = 20,
Expand All @@ -149,11 +145,11 @@ public extension ClusterManager {
}
}
) {
self.maxZoomLevel = maxZoomLevel
self.minCountForClustering = minCountForClustering
self.maxZoomLevel = max(0, maxZoomLevel)
self.minCountForClustering = max(0, minCountForClustering)
self.shouldRemoveInvisibleAnnotations = shouldRemoveInvisibleAnnotations
self.shouldDistributeAnnotationsOnSameCoordinate = shouldDistributeAnnotationsOnSameCoordinate
self.distanceFromContestedLocation = distanceFromContestedLocation
self.distanceFromContestedLocation = max(0, distanceFromContestedLocation)
self.clusterPosition = clusterPosition
self.cellSizeForZoomLevel = cellSizeForZoomLevel
}
Expand Down
73 changes: 0 additions & 73 deletions Sources/ClusterMap/Public/Utils/Clamping.swift

This file was deleted.

0 comments on commit b402fb3

Please sign in to comment.