Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/MapView.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ Set map's label locale, e.g. `{ "locale": "es" }` will localize labels to Spanis
type GestureSettings = {
doubleTapToZoomInEnabled: boolean; /* Whether double tapping the map with one touch results in a zoom-in animation. */
doubleTouchToZoomOutEnabled: boolean; /* Whether single tapping the map with two touches results in a zoom-out animation. */
focalPoint: signature; /* By default, gestures rotate and zoom around the center of the gesture. Set
this property to rotate and zoom around a fixed point instead. */
pinchPanEnabled: boolean; /* Whether pan/scroll is enabled for the pinch gesture. */
pinchZoomEnabled: boolean; /* Whether zoom is enabled for the pinch gesture. */
pinchZoomDecelerationEnabled: boolean; /* Whether a deceleration animation following a pinch-zoom gesture is enabled. True by default.
Expand Down
7 changes: 7 additions & 0 deletions docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -5308,6 +5308,13 @@
"default": "none",
"description": "Whether single tapping the map with two touches results in a zoom-out animation."
},
{
"name": "focalPoint",
"required": false,
"type": "signature",
"default": "none",
"description": "By default, gestures rotate and zoom around the center of the gesture. Set\nthis property to rotate and zoom around a fixed point instead."
},
{
"name": "pinchPanEnabled",
"required": false,
Expand Down
10 changes: 10 additions & 0 deletions ios/RNMBX/RNMBXMapView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ open class RNMBXMapView: UIView, RCTInvalidating {
var panEnabled: Bool? = nil;
var panDecelerationFactor: CGFloat? = nil;
var simultaneousRotateAndPinchZoomEnabled: Bool? = nil;
var focalPoint: CGPoint? = nil;
}

var gestureSettings = GestureSettings()
Expand Down Expand Up @@ -626,6 +627,12 @@ open class RNMBXMapView: UIView, RCTInvalidating {
if let simultaneousRotateAndPinchZoomEnabled = value["simultaneousRotateAndPinchZoomEnabled"] as? NSNumber {
options.simultaneousRotateAndPinchZoomEnabled = simultaneousRotateAndPinchZoomEnabled.boolValue
}
if let focalPoint = value["focalPoint"] as? NSDictionary {
if let x = focalPoint["x"] as? NSNumber, let y = focalPoint["y"] as? NSNumber {
options.focalPoint = CGPoint(x: x.doubleValue, y: y.doubleValue)
}
}

/* android only
if let zoomAnimationAmount = value["zoomAnimationAmount"] as? NSNumber {
options.zoomAnimationAmount = zoomAnimationAmount.CGFloat
Expand Down Expand Up @@ -674,6 +681,9 @@ open class RNMBXMapView: UIView, RCTInvalidating {
if let simultaneousRotateAndPinchZoomEnabled = settings.simultaneousRotateAndPinchZoomEnabled as? Bool {
options.simultaneousRotateAndPinchZoomEnabled = simultaneousRotateAndPinchZoomEnabled
}
if let focalPoint = settings.focalPoint as? CGPoint {
options.focalPoint = focalPoint
}
/* android only
if let zoomAnimationAmount = value["zoomAnimationAmount"] as? NSNumber {
options.zoomAnimationAmount = zoomAnimationAmount.CGFloat
Expand Down
6 changes: 6 additions & 0 deletions src/components/MapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ export type GestureSettings = {
* Whether single tapping the map with two touches results in a zoom-out animation.
*/
doubleTouchToZoomOutEnabled?: boolean;
/**
* By default, gestures rotate and zoom around the center of the gesture. Set
* this property to rotate and zoom around a fixed point instead.
*/
focalPoint?: Point;

/**
* Whether pan/scroll is enabled for the pinch gesture.
*/
Expand Down