Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfix/mapsios 538 bearing is incorrect when rotate (#1396)
* Correct PanZoomPinchBehavior drag camera options. * Correct PanPinchBehavior drag camera options
- Loading branch information
Showing
10 changed files
with
21 additions
and
83 deletions.
There are no files selected for viewing
22 changes: 7 additions & 15 deletions
22
Sources/MapboxMaps/Gestures/GestureHandlers/PinchBehaviors/PanPinchBehavior.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,20 @@ | ||
internal final class PanPinchBehavior: PinchBehavior { | ||
private let initialCameraState: CameraState | ||
private let initialPinchMidpoint: CGPoint | ||
private var currentPinchMidpoint: CGPoint | ||
private let mapboxMap: MapboxMapProtocol | ||
|
||
internal init(initialCameraState: CameraState, | ||
initialPinchMidpoint: CGPoint, | ||
mapboxMap: MapboxMapProtocol) { | ||
self.initialCameraState = initialCameraState | ||
self.initialPinchMidpoint = initialPinchMidpoint | ||
internal init(initialPinchMidpoint: CGPoint, mapboxMap: MapboxMapProtocol) { | ||
self.currentPinchMidpoint = initialPinchMidpoint | ||
self.mapboxMap = mapboxMap | ||
} | ||
|
||
internal func update(pinchMidpoint: CGPoint, pinchScale: CGFloat) { | ||
mapboxMap.performWithoutNotifying { | ||
mapboxMap.setCamera(to: CameraOptions( | ||
center: initialCameraState.center, | ||
bearing: initialCameraState.bearing)) | ||
} | ||
|
||
mapboxMap.dragStart(for: initialPinchMidpoint) | ||
mapboxMap.dragStart(for: currentPinchMidpoint) | ||
let dragOptions = mapboxMap.dragCameraOptions( | ||
from: initialPinchMidpoint, | ||
from: currentPinchMidpoint, | ||
to: pinchMidpoint) | ||
mapboxMap.setCamera(to: dragOptions) | ||
mapboxMap.dragEnd() | ||
|
||
currentPinchMidpoint = pinchMidpoint | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters