diff --git a/Sources/MapboxMaps/Foundation/MapViewDependencyProvider.swift b/Sources/MapboxMaps/Foundation/MapViewDependencyProvider.swift index 6eed8c33dfb5..a9de0beb04fb 100644 --- a/Sources/MapboxMaps/Foundation/MapViewDependencyProvider.swift +++ b/Sources/MapboxMaps/Foundation/MapViewDependencyProvider.swift @@ -70,7 +70,7 @@ internal final class MapViewDependencyProvider: MapViewDependencyProviderProtoco func makeDoubleTapToZoomInGestureHandler(view: UIView, mapboxMap: MapboxMapProtocol, - cameraAnimationsManager: CameraAnimationsManagerProtocol) -> DoubleTapToZoomInGestureHandlerProtocol { + cameraAnimationsManager: CameraAnimationsManagerProtocol) -> ZoomGestureHandlerProtocol { let gestureRecognizer = UITapGestureRecognizer() view.addGestureRecognizer(gestureRecognizer) return DoubleTapToZoomInGestureHandler( @@ -81,7 +81,7 @@ internal final class MapViewDependencyProvider: MapViewDependencyProviderProtoco func makeDoubleTouchToZoomOutGestureHandler(view: UIView, mapboxMap: MapboxMapProtocol, - cameraAnimationsManager: CameraAnimationsManagerProtocol) -> DoubleTouchToZoomOutGestureHandlerProtocol { + cameraAnimationsManager: CameraAnimationsManagerProtocol) -> ZoomGestureHandlerProtocol { let gestureRecognizer = UITapGestureRecognizer() view.addGestureRecognizer(gestureRecognizer) return DoubleTouchToZoomOutGestureHandler( @@ -90,8 +90,7 @@ internal final class MapViewDependencyProvider: MapViewDependencyProviderProtoco cameraAnimationsManager: cameraAnimationsManager) } - func makeQuickZoomGestureHandler(view: UIView, - mapboxMap: MapboxMapProtocol) -> QuickZoomGestureHandlerProtocol { + func makeQuickZoomGestureHandler(view: UIView, mapboxMap: MapboxMapProtocol) -> ZoomGestureHandlerProtocol { let gestureRecognizer = UILongPressGestureRecognizer() view.addGestureRecognizer(gestureRecognizer) return QuickZoomGestureHandler( diff --git a/Sources/MapboxMaps/Gestures/GestureHandlers/DoubleTapToZoomInGestureHandler.swift b/Sources/MapboxMaps/Gestures/GestureHandlers/DoubleTapToZoomInGestureHandler.swift index c65ba78e4655..ea0282a23ae3 100644 --- a/Sources/MapboxMaps/Gestures/GestureHandlers/DoubleTapToZoomInGestureHandler.swift +++ b/Sources/MapboxMaps/Gestures/GestureHandlers/DoubleTapToZoomInGestureHandler.swift @@ -1,12 +1,8 @@ import UIKit -internal protocol DoubleTapToZoomInGestureHandlerProtocol: GestureHandler { - var focalPoint: CGPoint? { get set } -} - /// `DoubleTapToZoomInGestureHandler` updates the map camera in response /// to double tap gestures with 1 touch -internal final class DoubleTapToZoomInGestureHandler: GestureHandler, DoubleTapToZoomInGestureHandlerProtocol { +internal final class DoubleTapToZoomInGestureHandler: GestureHandler, ZoomGestureHandlerProtocol { internal var focalPoint: CGPoint? private let mapboxMap: MapboxMapProtocol diff --git a/Sources/MapboxMaps/Gestures/GestureHandlers/DoubleTouchToZoomOutGestureHandler.swift b/Sources/MapboxMaps/Gestures/GestureHandlers/DoubleTouchToZoomOutGestureHandler.swift index 69e36395c61b..40a5583d0bf0 100644 --- a/Sources/MapboxMaps/Gestures/GestureHandlers/DoubleTouchToZoomOutGestureHandler.swift +++ b/Sources/MapboxMaps/Gestures/GestureHandlers/DoubleTouchToZoomOutGestureHandler.swift @@ -1,12 +1,8 @@ import UIKit -internal protocol DoubleTouchToZoomOutGestureHandlerProtocol: GestureHandler { - var focalPoint: CGPoint? { get set } -} - /// `DoubleTouchToZoomOutGestureHandler` updates the map camera in response /// to single tap gestures with 2 touches -internal final class DoubleTouchToZoomOutGestureHandler: GestureHandler, DoubleTouchToZoomOutGestureHandlerProtocol { +internal final class DoubleTouchToZoomOutGestureHandler: GestureHandler, ZoomGestureHandlerProtocol { internal var focalPoint: CGPoint? private let mapboxMap: MapboxMapProtocol diff --git a/Sources/MapboxMaps/Gestures/GestureHandlers/PinchGestureHandler.swift b/Sources/MapboxMaps/Gestures/GestureHandlers/PinchGestureHandler.swift index fc1912605358..b55ee81318f5 100644 --- a/Sources/MapboxMaps/Gestures/GestureHandlers/PinchGestureHandler.swift +++ b/Sources/MapboxMaps/Gestures/GestureHandlers/PinchGestureHandler.swift @@ -1,9 +1,8 @@ import UIKit -internal protocol PinchGestureHandlerProtocol: GestureHandler { +internal protocol PinchGestureHandlerProtocol: ZoomGestureHandlerProtocol { var rotateEnabled: Bool { get set } var behavior: PinchGestureBehavior { get set } - var focalPoint: CGPoint? { get set } } internal protocol PinchGestureHandlerImpl: AnyObject { diff --git a/Sources/MapboxMaps/Gestures/GestureHandlers/QuickZoomGestureHandler.swift b/Sources/MapboxMaps/Gestures/GestureHandlers/QuickZoomGestureHandler.swift index 9afb197f4e97..a40b7b184cf7 100644 --- a/Sources/MapboxMaps/Gestures/GestureHandlers/QuickZoomGestureHandler.swift +++ b/Sources/MapboxMaps/Gestures/GestureHandlers/QuickZoomGestureHandler.swift @@ -1,11 +1,7 @@ import UIKit -internal protocol QuickZoomGestureHandlerProtocol: GestureHandler { - var focalPoint: CGPoint? { get set } -} - /// `QuickZoomGestureHandler` updates the map camera in response to double tap and drag gestures -internal final class QuickZoomGestureHandler: GestureHandler, QuickZoomGestureHandlerProtocol { +internal final class QuickZoomGestureHandler: GestureHandler, ZoomGestureHandlerProtocol { internal var focalPoint: CGPoint? private var initialLocation: CGPoint? diff --git a/Sources/MapboxMaps/Gestures/GestureHandlers/ZoomGestureHandlerProtocol.swift b/Sources/MapboxMaps/Gestures/GestureHandlers/ZoomGestureHandlerProtocol.swift new file mode 100644 index 000000000000..e7b5336fc1ef --- /dev/null +++ b/Sources/MapboxMaps/Gestures/GestureHandlers/ZoomGestureHandlerProtocol.swift @@ -0,0 +1,5 @@ +import Foundation + +internal protocol ZoomGestureHandlerProtocol: GestureHandler { + var focalPoint: CGPoint? { get set } +} diff --git a/Sources/MapboxMaps/Gestures/GestureManager.swift b/Sources/MapboxMaps/Gestures/GestureManager.swift index 1bec0b6c1bba..de7c74e68125 100644 --- a/Sources/MapboxMaps/Gestures/GestureManager.swift +++ b/Sources/MapboxMaps/Gestures/GestureManager.swift @@ -99,9 +99,9 @@ public final class GestureManager: GestureHandlerDelegate { private let panGestureHandler: PanGestureHandlerProtocol private let pinchGestureHandler: PinchGestureHandlerProtocol private let pitchGestureHandler: GestureHandler - private let doubleTapToZoomInGestureHandler: DoubleTapToZoomInGestureHandlerProtocol - private let doubleTouchToZoomOutGestureHandler: DoubleTouchToZoomOutGestureHandlerProtocol - private let quickZoomGestureHandler: QuickZoomGestureHandlerProtocol + private let doubleTapToZoomInGestureHandler: ZoomGestureHandlerProtocol + private let doubleTouchToZoomOutGestureHandler: ZoomGestureHandlerProtocol + private let quickZoomGestureHandler: ZoomGestureHandlerProtocol private let singleTapGestureHandler: GestureHandler private let anyTouchGestureHandler: GestureHandler private let mapboxMap: MapboxMapProtocol @@ -109,9 +109,9 @@ public final class GestureManager: GestureHandlerDelegate { internal init(panGestureHandler: PanGestureHandlerProtocol, pinchGestureHandler: PinchGestureHandlerProtocol, pitchGestureHandler: GestureHandler, - doubleTapToZoomInGestureHandler: DoubleTapToZoomInGestureHandlerProtocol, - doubleTouchToZoomOutGestureHandler: DoubleTouchToZoomOutGestureHandlerProtocol, - quickZoomGestureHandler: QuickZoomGestureHandlerProtocol, + doubleTapToZoomInGestureHandler: ZoomGestureHandlerProtocol, + doubleTouchToZoomOutGestureHandler: ZoomGestureHandlerProtocol, + quickZoomGestureHandler: ZoomGestureHandlerProtocol, singleTapGestureHandler: GestureHandler, anyTouchGestureHandler: GestureHandler, mapboxMap: MapboxMapProtocol) { diff --git a/Tests/MapboxMapsTests/Gestures/GestureHandlers/Mocks/MockDoubleTapToZoomInGestureHandler.swift b/Tests/MapboxMapsTests/Gestures/GestureHandlers/Mocks/MockDoubleTapToZoomInGestureHandler.swift index 3a3ca3dd4bc2..f971144d635d 100644 --- a/Tests/MapboxMapsTests/Gestures/GestureHandlers/Mocks/MockDoubleTapToZoomInGestureHandler.swift +++ b/Tests/MapboxMapsTests/Gestures/GestureHandlers/Mocks/MockDoubleTapToZoomInGestureHandler.swift @@ -1,5 +1,5 @@ @testable import MapboxMaps -final class MockDoubleTapToZoomInGestureHandler: GestureHandler, DoubleTapToZoomInGestureHandlerProtocol { +final class MockDoubleTapToZoomInGestureHandler: GestureHandler, ZoomGestureHandlerProtocol { var focalPoint: CGPoint? } diff --git a/Tests/MapboxMapsTests/Gestures/GestureHandlers/Mocks/MockDoubleTouchToZoomOutGestureHandler.swift b/Tests/MapboxMapsTests/Gestures/GestureHandlers/Mocks/MockDoubleTouchToZoomOutGestureHandler.swift index 2d837db31859..628f8e8a4092 100644 --- a/Tests/MapboxMapsTests/Gestures/GestureHandlers/Mocks/MockDoubleTouchToZoomOutGestureHandler.swift +++ b/Tests/MapboxMapsTests/Gestures/GestureHandlers/Mocks/MockDoubleTouchToZoomOutGestureHandler.swift @@ -1,5 +1,5 @@ @testable import MapboxMaps -final class MockDoubleTouchToZoomOutGestureHandler: GestureHandler, DoubleTouchToZoomOutGestureHandlerProtocol { +final class MockDoubleTouchToZoomOutGestureHandler: GestureHandler, ZoomGestureHandlerProtocol { var focalPoint: CGPoint? } diff --git a/Tests/MapboxMapsTests/Gestures/GestureHandlers/Mocks/MockQuickZoomGestureHandler.swift b/Tests/MapboxMapsTests/Gestures/GestureHandlers/Mocks/MockQuickZoomGestureHandler.swift index f4c74ea9d8bc..edb8474b99fc 100644 --- a/Tests/MapboxMapsTests/Gestures/GestureHandlers/Mocks/MockQuickZoomGestureHandler.swift +++ b/Tests/MapboxMapsTests/Gestures/GestureHandlers/Mocks/MockQuickZoomGestureHandler.swift @@ -1,5 +1,5 @@ @testable import MapboxMaps -final class MockQuickZoomGestureHandler: GestureHandler, QuickZoomGestureHandlerProtocol { +final class MockQuickZoomGestureHandler: GestureHandler, ZoomGestureHandlerProtocol { var focalPoint: CGPoint? }