diff --git a/app/src/androidTest/java/com/mapbox/maps/testapp/gestures/generated/GesturesAttributeParserDefaultValueTest.kt b/app/src/androidTest/java/com/mapbox/maps/testapp/gestures/generated/GesturesAttributeParserDefaultValueTest.kt
index 871163b640..efcea99bd0 100644
--- a/app/src/androidTest/java/com/mapbox/maps/testapp/gestures/generated/GesturesAttributeParserDefaultValueTest.kt
+++ b/app/src/androidTest/java/com/mapbox/maps/testapp/gestures/generated/GesturesAttributeParserDefaultValueTest.kt
@@ -4,7 +4,7 @@ package com.mapbox.maps.testapp.gestures.generated
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
-import com.mapbox.maps.plugin.PanScrollMode
+import com.mapbox.maps.plugin.ScrollMode
import com.mapbox.maps.plugin.gestures.gestures
import com.mapbox.maps.testapp.BaseMapTest
import org.junit.Assert.assertEquals
@@ -27,9 +27,9 @@ class GesturesAttributeParserDefaultValueTest : BaseMapTest() {
mapView.gestures.getSettings().rotateEnabled
)
assertEquals(
- "zoomEnabled test failed..",
+ "pinchToZoomEnabled test failed..",
true,
- mapView.gestures.getSettings().zoomEnabled
+ mapView.gestures.getSettings().pinchToZoomEnabled
)
assertEquals(
"scrollEnabled test failed..",
@@ -42,14 +42,19 @@ class GesturesAttributeParserDefaultValueTest : BaseMapTest() {
mapView.gestures.getSettings().pitchEnabled
)
assertEquals(
- "panScrollMode test failed..",
- PanScrollMode.HORIZONTAL_AND_VERTICAL,
- mapView.gestures.getSettings().panScrollMode
+ "scrollMode test failed..",
+ ScrollMode.HORIZONTAL_AND_VERTICAL,
+ mapView.gestures.getSettings().scrollMode
)
assertEquals(
- "doubleTapToZoomEnabled test failed..",
+ "doubleTapToZoomInEnabled test failed..",
true,
- mapView.gestures.getSettings().doubleTapToZoomEnabled
+ mapView.gestures.getSettings().doubleTapToZoomInEnabled
+ )
+ assertEquals(
+ "doubleTouchToZoomOutEnabled test failed..",
+ true,
+ mapView.gestures.getSettings().doubleTouchToZoomOutEnabled
)
assertEquals(
"quickZoomEnabled test failed..",
@@ -62,44 +67,34 @@ class GesturesAttributeParserDefaultValueTest : BaseMapTest() {
mapView.gestures.getSettings().focalPoint
)
assertEquals(
- "scaleVelocityAnimationEnabled test failed..",
- true,
- mapView.gestures.getSettings().scaleVelocityAnimationEnabled
- )
- assertEquals(
- "rotateVelocityAnimationEnabled test failed..",
+ "pinchToZoomDecelerationEnabled test failed..",
true,
- mapView.gestures.getSettings().rotateVelocityAnimationEnabled
+ mapView.gestures.getSettings().pinchToZoomDecelerationEnabled
)
assertEquals(
- "flingVelocityAnimationEnabled test failed..",
+ "rotateDecelerationEnabled test failed..",
true,
- mapView.gestures.getSettings().flingVelocityAnimationEnabled
+ mapView.gestures.getSettings().rotateDecelerationEnabled
)
assertEquals(
- "increaseRotateThresholdWhenScaling test failed..",
+ "scrollDecelerationEnabled test failed..",
true,
- mapView.gestures.getSettings().increaseRotateThresholdWhenScaling
+ mapView.gestures.getSettings().scrollDecelerationEnabled
)
assertEquals(
- "disableRotateWhenScaling test failed..",
+ "increaseRotateThresholdWhenPinchingToZoom test failed..",
true,
- mapView.gestures.getSettings().disableRotateWhenScaling
+ mapView.gestures.getSettings().increaseRotateThresholdWhenPinchingToZoom
)
assertEquals(
- "increaseScaleThresholdWhenRotating test failed..",
+ "increasePinchToZoomThresholdWhenRotating test failed..",
true,
- mapView.gestures.getSettings().increaseScaleThresholdWhenRotating
+ mapView.gestures.getSettings().increasePinchToZoomThresholdWhenRotating
)
assertEquals(
- "zoomRate test failed..",
+ "zoomAnimationAmount test failed..",
1f,
- mapView.gestures.getSettings().zoomRate
- )
- assertEquals(
- "pixelRatio test failed..",
- pixelRatio,
- mapView.gestures.getSettings().pixelRatio
+ mapView.gestures.getSettings().zoomAnimationAmount
)
}
}
diff --git a/app/src/androidTest/java/com/mapbox/maps/testapp/gestures/generated/GesturesAttributeParserTest.kt b/app/src/androidTest/java/com/mapbox/maps/testapp/gestures/generated/GesturesAttributeParserTest.kt
index bf782a50c5..f79f4a2259 100644
--- a/app/src/androidTest/java/com/mapbox/maps/testapp/gestures/generated/GesturesAttributeParserTest.kt
+++ b/app/src/androidTest/java/com/mapbox/maps/testapp/gestures/generated/GesturesAttributeParserTest.kt
@@ -6,7 +6,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import com.mapbox.maps.R
import com.mapbox.maps.ScreenCoordinate
-import com.mapbox.maps.plugin.PanScrollMode
+import com.mapbox.maps.plugin.ScrollMode
import com.mapbox.maps.plugin.gestures.gestures
import com.mapbox.maps.testapp.BaseMapTest
import org.junit.Assert.assertEquals
@@ -38,9 +38,9 @@ class GesturesAttributeParserTest : BaseMapTest() {
mapView.gestures.getSettings().rotateEnabled
)
assertEquals(
- "zoomEnabled test failed..",
+ "pinchToZoomEnabled test failed..",
false,
- mapView.gestures.getSettings().zoomEnabled
+ mapView.gestures.getSettings().pinchToZoomEnabled
)
assertEquals(
"scrollEnabled test failed..",
@@ -53,14 +53,19 @@ class GesturesAttributeParserTest : BaseMapTest() {
mapView.gestures.getSettings().pitchEnabled
)
assertEquals(
- "panScrollMode test failed..",
- PanScrollMode.HORIZONTAL_AND_VERTICAL,
- mapView.gestures.getSettings().panScrollMode
+ "scrollMode test failed..",
+ ScrollMode.HORIZONTAL_AND_VERTICAL,
+ mapView.gestures.getSettings().scrollMode
)
assertEquals(
- "doubleTapToZoomEnabled test failed..",
+ "doubleTapToZoomInEnabled test failed..",
false,
- mapView.gestures.getSettings().doubleTapToZoomEnabled
+ mapView.gestures.getSettings().doubleTapToZoomInEnabled
+ )
+ assertEquals(
+ "doubleTouchToZoomOutEnabled test failed..",
+ false,
+ mapView.gestures.getSettings().doubleTouchToZoomOutEnabled
)
assertEquals(
"quickZoomEnabled test failed..",
@@ -73,44 +78,34 @@ class GesturesAttributeParserTest : BaseMapTest() {
mapView.gestures.getSettings().focalPoint
)
assertEquals(
- "scaleVelocityAnimationEnabled test failed..",
+ "pinchToZoomDecelerationEnabled test failed..",
false,
- mapView.gestures.getSettings().scaleVelocityAnimationEnabled
+ mapView.gestures.getSettings().pinchToZoomDecelerationEnabled
)
assertEquals(
- "rotateVelocityAnimationEnabled test failed..",
+ "rotateDecelerationEnabled test failed..",
false,
- mapView.gestures.getSettings().rotateVelocityAnimationEnabled
+ mapView.gestures.getSettings().rotateDecelerationEnabled
)
assertEquals(
- "flingVelocityAnimationEnabled test failed..",
+ "scrollDecelerationEnabled test failed..",
false,
- mapView.gestures.getSettings().flingVelocityAnimationEnabled
+ mapView.gestures.getSettings().scrollDecelerationEnabled
)
assertEquals(
- "increaseRotateThresholdWhenScaling test failed..",
+ "increaseRotateThresholdWhenPinchingToZoom test failed..",
false,
- mapView.gestures.getSettings().increaseRotateThresholdWhenScaling
+ mapView.gestures.getSettings().increaseRotateThresholdWhenPinchingToZoom
)
assertEquals(
- "disableRotateWhenScaling test failed..",
+ "increasePinchToZoomThresholdWhenRotating test failed..",
false,
- mapView.gestures.getSettings().disableRotateWhenScaling
- )
- assertEquals(
- "increaseScaleThresholdWhenRotating test failed..",
- false,
- mapView.gestures.getSettings().increaseScaleThresholdWhenRotating
- )
- assertEquals(
- "zoomRate test failed..",
- 0.9f,
- mapView.gestures.getSettings().zoomRate
+ mapView.gestures.getSettings().increasePinchToZoomThresholdWhenRotating
)
assertEquals(
- "pixelRatio test failed..",
+ "zoomAnimationAmount test failed..",
0.9f,
- mapView.gestures.getSettings().pixelRatio
+ mapView.gestures.getSettings().zoomAnimationAmount
)
}
}
diff --git a/app/src/main/java/com/mapbox/maps/testapp/examples/GesturesActivity.kt b/app/src/main/java/com/mapbox/maps/testapp/examples/GesturesActivity.kt
index dfece1ba2f..03db90ab56 100644
--- a/app/src/main/java/com/mapbox/maps/testapp/examples/GesturesActivity.kt
+++ b/app/src/main/java/com/mapbox/maps/testapp/examples/GesturesActivity.kt
@@ -1,6 +1,7 @@
package com.mapbox.maps.testapp.examples
import android.annotation.SuppressLint
+import android.graphics.BitmapFactory
import android.os.Bundle
import android.os.Handler
import android.view.*
@@ -18,7 +19,11 @@ import com.mapbox.geojson.Point
import com.mapbox.maps.CameraOptions
import com.mapbox.maps.MapboxMap
import com.mapbox.maps.Style
-import com.mapbox.maps.plugin.PanScrollMode
+import com.mapbox.maps.plugin.ScrollMode
+import com.mapbox.maps.plugin.annotation.annotations
+import com.mapbox.maps.plugin.annotation.generated.PointAnnotationManager
+import com.mapbox.maps.plugin.annotation.generated.PointAnnotationOptions
+import com.mapbox.maps.plugin.annotation.generated.createPointAnnotationManager
import com.mapbox.maps.plugin.gestures.*
import com.mapbox.maps.testapp.R
import com.mapbox.maps.testapp.databinding.ActivityGesturesBinding
@@ -34,6 +39,7 @@ class GesturesActivity : AppCompatActivity() {
private lateinit var gesturesManager: AndroidGesturesManager
private lateinit var gestureAlertsAdapter: GestureAlertsAdapter
private var focalPointLatLng: Point? = null
+ private var pointAnnotationManager: PointAnnotationManager? = null
private lateinit var binding: ActivityGesturesBinding
override fun onCreate(savedInstanceState: Bundle?) {
@@ -47,7 +53,9 @@ class GesturesActivity : AppCompatActivity() {
.zoom(15.0)
.build()
)
- mapboxMap.loadStyleUri(Style.MAPBOX_STREETS)
+ mapboxMap.loadStyleUri(Style.MAPBOX_STREETS) {
+ it.addImage(MARKER_IMAGE_ID, BitmapFactory.decodeResource(resources, R.drawable.red_marker))
+ }
binding.mapView.waitForLayout {
initializeMap()
@@ -178,15 +186,15 @@ class GesturesActivity : AppCompatActivity() {
item.isChecked = focalPointLatLng == null
}
R.id.menu_gesture_animation -> {
- gesturesPlugin.scaleVelocityAnimationEnabled =
- !gesturesPlugin.scaleVelocityAnimationEnabled
- gesturesPlugin.rotateVelocityAnimationEnabled =
- !gesturesPlugin.rotateVelocityAnimationEnabled
- gesturesPlugin.flingVelocityAnimationEnabled =
- !gesturesPlugin.flingVelocityAnimationEnabled
- item.isChecked = gesturesPlugin.scaleVelocityAnimationEnabled &&
- gesturesPlugin.rotateVelocityAnimationEnabled &&
- gesturesPlugin.flingVelocityAnimationEnabled
+ gesturesPlugin.pinchToZoomDecelerationEnabled =
+ !gesturesPlugin.pinchToZoomDecelerationEnabled
+ gesturesPlugin.rotateDecelerationEnabled =
+ !gesturesPlugin.rotateDecelerationEnabled
+ gesturesPlugin.scrollDecelerationEnabled =
+ !gesturesPlugin.scrollDecelerationEnabled
+ item.isChecked = gesturesPlugin.pinchToZoomDecelerationEnabled &&
+ gesturesPlugin.rotateDecelerationEnabled &&
+ gesturesPlugin.scrollDecelerationEnabled
}
R.id.menu_gesture_rotate -> {
gesturesPlugin.rotateEnabled = !gesturesPlugin.rotateEnabled
@@ -197,16 +205,20 @@ class GesturesActivity : AppCompatActivity() {
item.isChecked = gesturesPlugin.pitchEnabled
}
R.id.menu_gesture_zoom -> {
- gesturesPlugin.zoomEnabled = !gesturesPlugin.zoomEnabled
- item.isChecked = gesturesPlugin.zoomEnabled
+ gesturesPlugin.pinchToZoomEnabled = !gesturesPlugin.pinchToZoomEnabled
+ item.isChecked = gesturesPlugin.pinchToZoomEnabled
}
R.id.menu_gesture_scroll -> {
gesturesPlugin.scrollEnabled = !gesturesPlugin.scrollEnabled
item.isChecked = gesturesPlugin.scrollEnabled
}
R.id.menu_gesture_double_tap -> {
- gesturesPlugin.doubleTapToZoomEnabled = !gesturesPlugin.doubleTapToZoomEnabled
- item.isChecked = gesturesPlugin.doubleTapToZoomEnabled
+ gesturesPlugin.doubleTapToZoomInEnabled = !gesturesPlugin.doubleTapToZoomInEnabled
+ item.isChecked = gesturesPlugin.doubleTapToZoomInEnabled
+ }
+ R.id.menu_gesture_double_touch -> {
+ gesturesPlugin.doubleTouchToZoomOutEnabled = !gesturesPlugin.doubleTouchToZoomOutEnabled
+ item.isChecked = gesturesPlugin.doubleTouchToZoomOutEnabled
}
R.id.menu_gesture_quick_zoom -> {
gesturesPlugin.quickZoomEnabled = !gesturesPlugin.quickZoomEnabled
@@ -214,18 +226,21 @@ class GesturesActivity : AppCompatActivity() {
}
R.id.menu_gesture_pan_scroll_horizontal_vertical -> {
binding.mapView.gestures.updateSettings {
- panScrollMode = PanScrollMode.HORIZONTAL_AND_VERTICAL
+ scrollMode = ScrollMode.HORIZONTAL_AND_VERTICAL
}
+ item.isChecked = true
}
R.id.menu_gesture_pan_scroll_horizontal -> {
binding.mapView.gestures.updateSettings {
- panScrollMode = PanScrollMode.HORIZONTAL
+ scrollMode = ScrollMode.HORIZONTAL
}
+ item.isChecked = true
}
R.id.menu_gesture_pan_scroll_vertical -> {
binding.mapView.gestures.updateSettings {
- panScrollMode = PanScrollMode.VERTICAL
+ scrollMode = ScrollMode.VERTICAL
}
+ item.isChecked = true
}
}
return true
@@ -234,17 +249,22 @@ class GesturesActivity : AppCompatActivity() {
private fun fixedFocalPointEnabled(enabled: Boolean) {
if (enabled) {
- focalPointLatLng = Point.fromLngLat(-0.12968, 51.50325)
- // TODO add marker
- // marker = mapboxMap.addMarker(MarkerOptions().position(focalPointLatLng))
+ focalPointLatLng = FOCAL_POINT
+ pointAnnotationManager =
+ binding.mapView.annotations.createPointAnnotationManager(binding.mapView).apply {
+ create(
+ PointAnnotationOptions()
+ .withPoint(FOCAL_POINT)
+ .withIconImage(MARKER_IMAGE_ID)
+ )
+ }
mapboxMap.setCamera(CameraOptions.Builder().center(focalPointLatLng).zoom(16.0).build())
recalculateFocalPoint()
} else {
- // TODO add marker
- // if (marker != null) {
- // mapboxMap.removeMarker(marker)
- // marker = null
- // }
+ pointAnnotationManager?.let {
+ binding.mapView.annotations.removeAnnotationManager(it)
+ }
+ pointAnnotationManager = null
focalPointLatLng = null
gesturesPlugin.focalPoint = null
}
@@ -376,6 +396,8 @@ class GesturesActivity : AppCompatActivity() {
companion object {
private const val MAX_NUMBER_OF_ALERTS = 30
+ private const val MARKER_IMAGE_ID = "MARKER_IMAGE_ID"
+ private val FOCAL_POINT = Point.fromLngLat(-0.12968, 51.50325)
}
}
diff --git a/app/src/main/java/com/mapbox/maps/testapp/examples/InsetMapActivity.kt b/app/src/main/java/com/mapbox/maps/testapp/examples/InsetMapActivity.kt
index a32731609f..d14d07fe14 100644
--- a/app/src/main/java/com/mapbox/maps/testapp/examples/InsetMapActivity.kt
+++ b/app/src/main/java/com/mapbox/maps/testapp/examples/InsetMapActivity.kt
@@ -81,7 +81,7 @@ class InsetMapActivity : AppCompatActivity(), OnCameraChangeListener {
gestures.updateSettings {
scrollEnabled = false
- zoomEnabled = false
+ pinchToZoomEnabled = false
}
}
}
diff --git a/app/src/main/java/com/mapbox/maps/testapp/examples/terrain3D/SantaCatalinaActivity.kt b/app/src/main/java/com/mapbox/maps/testapp/examples/terrain3D/SantaCatalinaActivity.kt
index f1201aae75..e1a7e0d644 100644
--- a/app/src/main/java/com/mapbox/maps/testapp/examples/terrain3D/SantaCatalinaActivity.kt
+++ b/app/src/main/java/com/mapbox/maps/testapp/examples/terrain3D/SantaCatalinaActivity.kt
@@ -270,6 +270,8 @@ fun MapView.disablePlugins() {
gestures.pitchEnabled = false
gestures.rotateEnabled = false
- gestures.zoomEnabled = false
+ gestures.pinchToZoomEnabled = false
+ gestures.doubleTouchToZoomOutEnabled = false
+ gestures.doubleTapToZoomInEnabled = false
gestures.scrollEnabled = false
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_style_switch.xml b/app/src/main/res/layout/activity_style_switch.xml
index e65907a843..558450f313 100644
--- a/app/src/main/res/layout/activity_style_switch.xml
+++ b/app/src/main/res/layout/activity_style_switch.xml
@@ -40,7 +40,7 @@
app:mapbox_compassMarginLeft="32dp"
app:mapbox_compassMarginRight="32dp"
app:mapbox_compassMarginTop="32dp"
- app:mapbox_gesturesDoubleTapToZoomEnabled="false"
+ app:mapbox_gesturesDoubleTapToZoomInEnabled="false"
app:mapbox_logoEnabled="true"
app:mapbox_logoGravity="bottom|right"
app:mapbox_logoMarginBottom="32dp"
@@ -51,7 +51,7 @@
app:mapbox_gesturesRotateEnabled="true"
app:mapbox_gesturesScrollEnabled="false"
app:mapbox_gesturesPitchEnabled="false"
- app:mapbox_gesturesZoomEnabled="false" />
+ app:mapbox_gesturesPinchToZoomEnabled="false" />
\ No newline at end of file
diff --git a/app/src/main/res/menu/menu_gestures.xml b/app/src/main/res/menu/menu_gestures.xml
index 05248ddc89..621f39126d 100644
--- a/app/src/main/res/menu/menu_gestures.xml
+++ b/app/src/main/res/menu/menu_gestures.xml
@@ -35,18 +35,27 @@
android:checkable="true"
android:checked="true"
android:title="@string/toggle_double_tap_enabled" />
+
-
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index b63ec580c0..164c831bdf 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -9,16 +9,17 @@
Satellite
Satellite Streets
Toggle focus on a point
- Toggle velocity animations
+ Toggle deceleration animations
Toggle rotate enabled
Toggle pitch enabled
- Toggle zoom enabled
+ Toggle pinch-to-zoom enabled
Toggle scroll enabled
- Toggle double tap enabled
+ Toggle double tap to zoom in enabled
+ Toggle double touch to zoom out enabled
Toggle quick zoom enabled
- Pan scroll horizontal and vertical
- Pan scroll horizontal
- Pan scroll vertical
+ Scroll horizontal and vertical
+ Scroll horizontal
+ Scroll vertical
Search for examples here
diff --git a/plugin-gestures/src/main/java/com/mapbox/maps/plugin/gestures/GesturesExt.kt b/plugin-gestures/src/main/java/com/mapbox/maps/plugin/gestures/GesturesExt.kt
index 098a96586d..ed0dc02eb3 100644
--- a/plugin-gestures/src/main/java/com/mapbox/maps/plugin/gestures/GesturesExt.kt
+++ b/plugin-gestures/src/main/java/com/mapbox/maps/plugin/gestures/GesturesExt.kt
@@ -3,8 +3,8 @@
package com.mapbox.maps.plugin.gestures
import com.mapbox.android.gestures.AndroidGesturesManager
-import com.mapbox.maps.plugin.PanScrollMode
import com.mapbox.maps.plugin.Plugin
+import com.mapbox.maps.plugin.ScrollMode
import com.mapbox.maps.plugin.delegates.MapPluginExtensionsDelegate
import com.mapbox.maps.plugin.delegates.MapPluginProviderDelegate
import com.mapbox.maps.plugin.gestures.generated.GesturesSettings
@@ -230,17 +230,17 @@ fun MapPluginExtensionsDelegate.getGesturesSettings() =
gesturesPlugin { getSettings() } as GesturesSettings?
/**
- * Returns if the panning is horizontally limited,
- * In other words, the pan scroll mode is set to vertical.
+ * Returns if the scroll is horizontally limited,
+ * In other words, the scroll mode is set to vertical.
*/
-fun GesturesSettings.isPanHorizontallyLimited(): Boolean {
- return panScrollMode == PanScrollMode.VERTICAL
+fun GesturesSettings.isScrollHorizontallyLimited(): Boolean {
+ return scrollMode == ScrollMode.VERTICAL
}
/**
- * Returns if the panning is vertically limited,
- * In other words, the pan scroll mode is set to horizontal.
+ * Returns if the scroll is vertically limited,
+ * In other words, the scroll mode is set to horizontal.
*/
-fun GesturesSettings.isPanVerticallyLimited(): Boolean {
- return panScrollMode == PanScrollMode.HORIZONTAL
+fun GesturesSettings.isScrollVerticallyLimited(): Boolean {
+ return scrollMode == ScrollMode.HORIZONTAL
}
\ No newline at end of file
diff --git a/plugin-gestures/src/main/java/com/mapbox/maps/plugin/gestures/GesturesPluginImpl.kt b/plugin-gestures/src/main/java/com/mapbox/maps/plugin/gestures/GesturesPluginImpl.kt
index 5da1d01e06..d7c2434c27 100644
--- a/plugin-gestures/src/main/java/com/mapbox/maps/plugin/gestures/GesturesPluginImpl.kt
+++ b/plugin-gestures/src/main/java/com/mapbox/maps/plugin/gestures/GesturesPluginImpl.kt
@@ -40,6 +40,7 @@ import kotlin.math.*
class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
private val context: Context
+ private var pixelRatio: Float = 1f
private lateinit var gesturesManager: AndroidGesturesManager
@@ -129,6 +130,7 @@ class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
pixelRatio: Float
) {
this.context = context
+ this.pixelRatio = pixelRatio
internalSettings = GesturesAttributeParser.parseGesturesSettings(context, null, pixelRatio)
mainHandler = Handler(Looper.getMainLooper())
}
@@ -139,6 +141,7 @@ class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
pixelRatio: Float
) {
this.context = context
+ this.pixelRatio = pixelRatio
internalSettings =
GesturesAttributeParser.parseGesturesSettings(context, attributeSet, pixelRatio)
mainHandler = Handler(Looper.getMainLooper())
@@ -152,6 +155,7 @@ class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
handler: Handler
) {
this.context = context
+ this.pixelRatio = pixelRatio
internalSettings =
GesturesAttributeParser.parseGesturesSettings(context, attributeSet, pixelRatio)
mainHandler = handler
@@ -346,7 +350,7 @@ class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
when (event.actionMasked) {
// Mouse scrolls
MotionEvent.ACTION_SCROLL -> {
- if (!internalSettings.zoomEnabled) {
+ if (!internalSettings.pinchToZoomEnabled) {
return false
}
@@ -521,7 +525,7 @@ class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
return if (quickZoom) {
// around center
- centerScreen
+ doubleTapFocalPoint
} else {
// around gesture
val pointF = detector.focalPoint
@@ -554,7 +558,7 @@ class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
notifyOnScaleEndListeners(detector)
val velocityXY = abs(velocityX) + abs(velocityY)
- if (!internalSettings.scaleVelocityAnimationEnabled || velocityXY < minimumVelocity || spanSinceLast / velocityXY < scaleVelocityRatioThreshold
+ if (!internalSettings.pinchToZoomDecelerationEnabled || velocityXY < minimumVelocity || spanSinceLast / velocityXY < scaleVelocityRatioThreshold
) {
return
}
@@ -584,7 +588,6 @@ class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
val focalPoint = getScaleFocalPoint(detector)
scaleCachedAnchor = cameraAnimationsPlugin.anchor
if (quickZoom) {
- internalSettings.zoomRate
val pixelDeltaChange = abs(detector.currentEvent.y - doubleTapFocalPoint.y)
val zoomedOut = detector.currentEvent.y < doubleTapFocalPoint.y
@@ -599,7 +602,7 @@ class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
// calculate target zoom and adjust for a multiplier
var targetZoom =
if (zoomedOut) startZoom - normalizedDeltaChange else startZoom + normalizedDeltaChange
- targetZoom *= internalSettings.zoomRate.toDouble()
+ targetZoom *= internalSettings.zoomAnimationAmount.toDouble()
easeToImmediately(
CameraOptions.Builder()
.zoom(targetZoom)
@@ -613,7 +616,7 @@ class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
)
} else {
val zoomBy =
- ln(detector.scaleFactor.toDouble()) / ln(PI / 2) * ZOOM_RATE.toDouble() * internalSettings.zoomRate.toDouble()
+ ln(detector.scaleFactor.toDouble()) / ln(PI / 2) * ZOOM_RATE.toDouble() * internalSettings.zoomAnimationAmount.toDouble()
easeToImmediately(
CameraOptions.Builder()
.zoom(mapCameraManagerDelegate.cameraState.zoom + zoomBy)
@@ -632,10 +635,6 @@ class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
internal fun handleScaleBegin(detector: StandardScaleGestureDetector): Boolean {
quickZoom = detector.pointersCount == 1
- if (!internalSettings.zoomEnabled) {
- return false
- }
-
if (quickZoom) {
if (!internalSettings.quickZoomEnabled) {
return false
@@ -643,6 +642,9 @@ class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
// re-try disabling the move detector in case double tap has been interrupted before quickzoom started
gesturesManager.moveGestureDetector.isEnabled = false
} else {
+ if (!internalSettings.pinchToZoomEnabled) {
+ return false
+ }
if (detector.previousSpan > 0) {
val currSpan = detector.currentSpan
val prevSpan = detector.previousSpan
@@ -662,10 +664,8 @@ class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
return false
}
- if (internalSettings.disableRotateWhenScaling) {
- // disable rotate gesture when scale is detected first
- gesturesManager.rotateGestureDetector.isEnabled = false
- }
+ // disable rotate gesture when scale is detected first
+ gesturesManager.rotateGestureDetector.isEnabled = false
}
} else {
return false
@@ -791,7 +791,7 @@ class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
angularVelocityEvent: Float
) {
var angularVelocity = angularVelocityEvent
- if (internalSettings.increaseScaleThresholdWhenRotating) {
+ if (internalSettings.increasePinchToZoomThresholdWhenRotating) {
// resetting default scale threshold values
gesturesManager.standardScaleGestureDetector.spanSinceStartThreshold =
defaultSpanSinceStartThreshold
@@ -810,7 +810,7 @@ class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
val delta = abs(detector.deltaSinceLast)
val ratio = (delta / velocityXY).toDouble()
- if (!internalSettings.rotateVelocityAnimationEnabled || abs(angularVelocity) < minimumAngularVelocity || gesturesManager.standardScaleGestureDetector.isInProgress() && ratio < rotateVelocityRatioThreshold) {
+ if (!internalSettings.rotateDecelerationEnabled || abs(angularVelocity) < minimumAngularVelocity || gesturesManager.standardScaleGestureDetector.isInProgress() && ratio < rotateVelocityRatioThreshold) {
// notifying listeners that camera is idle only if there is no follow-up animation
return
}
@@ -881,7 +881,7 @@ class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
return false
}
- if (internalSettings.increaseScaleThresholdWhenRotating) {
+ if (internalSettings.increasePinchToZoomThresholdWhenRotating) {
// when rotation starts, interrupting scale and increasing the threshold
// to make rotation without scaling easier
gesturesManager.standardScaleGestureDetector.spanSinceStartThreshold =
@@ -971,7 +971,7 @@ class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
detector: MultiFingerTapGestureDetector,
pointersCount: Int
): Boolean {
- if (!internalSettings.zoomEnabled || pointersCount != 2) {
+ if (!internalSettings.doubleTouchToZoomOutEnabled || pointersCount != 2) {
return false
}
@@ -1088,7 +1088,7 @@ class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
private fun noGesturesInProgress(): Boolean {
return (
(!internalSettings.scrollEnabled || !gesturesManager.moveGestureDetector.isInProgress) &&
- (!internalSettings.zoomEnabled || !gesturesManager.standardScaleGestureDetector.isInProgress)
+ ((!internalSettings.pinchToZoomEnabled && !internalSettings.doubleTouchToZoomOutEnabled && !internalSettings.doubleTapToZoomInEnabled) || !gesturesManager.standardScaleGestureDetector.isInProgress)
) &&
(!internalSettings.rotateEnabled || !gesturesManager.rotateGestureDetector.isInProgress) &&
(!internalSettings.pitchEnabled || !gesturesManager.shoveGestureDetector.isInProgress)
@@ -1138,7 +1138,7 @@ class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
return false
}
- if (!internalSettings.zoomEnabled || !internalSettings.doubleTapToZoomEnabled) {
+ if (!internalSettings.doubleTapToZoomInEnabled) {
return false
}
@@ -1166,11 +1166,11 @@ class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
notifyOnFlingListeners()
- if (!internalSettings.flingVelocityAnimationEnabled) {
+ if (!internalSettings.scrollDecelerationEnabled) {
return false
}
- val screenDensity = internalSettings.pixelRatio
+ val screenDensity = pixelRatio
// calculate velocity vector for xy dimensions, independent from screen size
val velocityXY =
@@ -1184,8 +1184,8 @@ class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
cameraAnimationsPlugin.cancelAllAnimators(protectedCameraAnimatorOwnerList)
- val offsetX = if (internalSettings.isPanHorizontallyLimited()) 0.0 else velocityX / FLING_LIMITING_FACTOR
- val offsetY = if (internalSettings.isPanVerticallyLimited()) 0.0 else velocityY / FLING_LIMITING_FACTOR
+ val offsetX = if (internalSettings.isScrollHorizontallyLimited()) 0.0 else velocityX / FLING_LIMITING_FACTOR
+ val offsetY = if (internalSettings.isScrollVerticallyLimited()) 0.0 else velocityY / FLING_LIMITING_FACTOR
// calculate animation time based on displacement
// velocityXY ranges from VELOCITY_THRESHOLD_IGNORE_FLING to ~5000
@@ -1240,9 +1240,9 @@ class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
val fromY = focalPoint.y.toDouble()
val resolvedDistanceX =
- if (internalSettings.isPanHorizontallyLimited()) 0.0 else distanceX.toDouble()
+ if (internalSettings.isScrollHorizontallyLimited()) 0.0 else distanceX.toDouble()
val resolvedDistanceY =
- if (internalSettings.isPanVerticallyLimited()) 0.0 else distanceY.toDouble()
+ if (internalSettings.isScrollVerticallyLimited()) 0.0 else distanceY.toDouble()
val toX = fromX - resolvedDistanceX
val toY = fromY - resolvedDistanceY
@@ -1552,6 +1552,7 @@ class GesturesPluginImpl : GesturesPlugin, GesturesSettingsBase {
pixelRatio: Float
) {
this.gesturesManager = gesturesManager
+ this.pixelRatio = pixelRatio
internalSettings = GesturesAttributeParser.parseGesturesSettings(context, attrs, pixelRatio)
}
diff --git a/plugin-gestures/src/main/java/com/mapbox/maps/plugin/gestures/generated/GesturesAttributeParser.kt b/plugin-gestures/src/main/java/com/mapbox/maps/plugin/gestures/generated/GesturesAttributeParser.kt
index 496d03381f..0e37c2125b 100644
--- a/plugin-gestures/src/main/java/com/mapbox/maps/plugin/gestures/generated/GesturesAttributeParser.kt
+++ b/plugin-gestures/src/main/java/com/mapbox/maps/plugin/gestures/generated/GesturesAttributeParser.kt
@@ -5,7 +5,7 @@ package com.mapbox.maps.plugin.gestures.generated
import android.content.Context
import android.util.AttributeSet
import com.mapbox.maps.ScreenCoordinate
-import com.mapbox.maps.plugin.PanScrollMode
+import com.mapbox.maps.plugin.ScrollMode
import com.mapbox.maps.plugin.gestures.R
/**
@@ -23,11 +23,12 @@ internal object GesturesAttributeParser {
try {
return GesturesSettings(
rotateEnabled = typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_gesturesRotateEnabled, true),
- zoomEnabled = typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_gesturesZoomEnabled, true),
+ pinchToZoomEnabled = typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_gesturesPinchToZoomEnabled, true),
scrollEnabled = typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_gesturesScrollEnabled, true),
pitchEnabled = typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_gesturesPitchEnabled, true),
- panScrollMode = PanScrollMode.values()[typedArray.getInt(R.styleable.mapbox_MapView_mapbox_gesturesPanScrollMode, PanScrollMode.HORIZONTAL_AND_VERTICAL.ordinal)],
- doubleTapToZoomEnabled = typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_gesturesDoubleTapToZoomEnabled, true),
+ scrollMode = ScrollMode.values()[typedArray.getInt(R.styleable.mapbox_MapView_mapbox_gesturesScrollMode, ScrollMode.HORIZONTAL_AND_VERTICAL.ordinal)],
+ doubleTapToZoomInEnabled = typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_gesturesDoubleTapToZoomInEnabled, true),
+ doubleTouchToZoomOutEnabled = typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_gesturesDoubleTouchToZoomOutEnabled, true),
quickZoomEnabled = typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_gesturesQuickZoomEnabled, true),
focalPoint = if (typedArray.hasValue(R.styleable.mapbox_MapView_mapbox_gesturesFocalPointX) && typedArray.hasValue(R.styleable.mapbox_MapView_mapbox_gesturesFocalPointY)) {
ScreenCoordinate(
@@ -37,14 +38,12 @@ internal object GesturesAttributeParser {
} else {
null
},
- scaleVelocityAnimationEnabled = typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_gesturesScaleVelocityAnimationEnabled, true),
- rotateVelocityAnimationEnabled = typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_gesturesRotateVelocityAnimationEnabled, true),
- flingVelocityAnimationEnabled = typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_gesturesFlingVelocityAnimationEnabled, true),
- increaseRotateThresholdWhenScaling = typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_gesturesIncreaseRotateThresholdWhenScaling, true),
- disableRotateWhenScaling = typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_gesturesDisableRotateWhenScaling, true),
- increaseScaleThresholdWhenRotating = typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_gesturesIncreaseScaleThresholdWhenRotating, true),
- zoomRate = typedArray.getFloat(R.styleable.mapbox_MapView_mapbox_gesturesZoomRate, 1f),
- pixelRatio = typedArray.getFloat(R.styleable.mapbox_MapView_mapbox_gesturesPixelRatio, pixelRatio),
+ pinchToZoomDecelerationEnabled = typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_gesturesPinchToZoomDecelerationEnabled, true),
+ rotateDecelerationEnabled = typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_gesturesRotateDecelerationEnabled, true),
+ scrollDecelerationEnabled = typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_gesturesScrollDecelerationEnabled, true),
+ increaseRotateThresholdWhenPinchingToZoom = typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_gesturesIncreaseRotateThresholdWhenPinchingToZoom, true),
+ increasePinchToZoomThresholdWhenRotating = typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_gesturesIncreasePinchToZoomThresholdWhenRotating, true),
+ zoomAnimationAmount = typedArray.getFloat(R.styleable.mapbox_MapView_mapbox_gesturesZoomAnimationAmount, 1f),
)
} finally {
typedArray.recycle()
diff --git a/plugin-gestures/src/main/res-public/values/public.xml b/plugin-gestures/src/main/res-public/values/public.xml
index e65e93e875..81e7488da3 100644
--- a/plugin-gestures/src/main/res-public/values/public.xml
+++ b/plugin-gestures/src/main/res-public/values/public.xml
@@ -2,54 +2,51 @@
-
+
-
-
+
+
-
+
-
+
-
-
+
+
-
-
+
+
-
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
\ No newline at end of file
diff --git a/plugin-gestures/src/main/res/values/attrs.xml b/plugin-gestures/src/main/res/values/attrs.xml
index 6a2ee192c9..5302ebe370 100644
--- a/plugin-gestures/src/main/res/values/attrs.xml
+++ b/plugin-gestures/src/main/res/values/attrs.xml
@@ -2,46 +2,44 @@
-
+
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
+
-
+
-
-
-
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugin-gestures/src/test/java/com/mapbox/maps/plugin/gestures/GestureOptionsTest.kt b/plugin-gestures/src/test/java/com/mapbox/maps/plugin/gestures/GestureOptionsTest.kt
index 73ec3cb7ed..f9284cbdb6 100644
--- a/plugin-gestures/src/test/java/com/mapbox/maps/plugin/gestures/GestureOptionsTest.kt
+++ b/plugin-gestures/src/test/java/com/mapbox/maps/plugin/gestures/GestureOptionsTest.kt
@@ -5,7 +5,7 @@ import android.content.res.TypedArray
import android.os.Handler
import android.util.AttributeSet
import com.mapbox.android.gestures.AndroidGesturesManager
-import com.mapbox.maps.plugin.PanScrollMode
+import com.mapbox.maps.plugin.ScrollMode
import com.mapbox.maps.plugin.animation.CameraAnimationsPlugin
import com.mapbox.maps.plugin.animation.camera
import com.mapbox.maps.plugin.delegates.MapDelegateProvider
@@ -75,23 +75,23 @@ class GestureOptionsTest {
}
@Test
- fun getGestureSettingsZoomEnabled() {
+ fun getGestureSettingsPinchToZoomEnabled() {
gesturePlugin.bind(context, gestureManager, attrs, 1f)
gesturePlugin.initialize()
- assertTrue(gesturePlugin.getSettings().zoomEnabled)
+ assertTrue(gesturePlugin.getSettings().pinchToZoomEnabled)
}
@Test
- fun getGestureSettingsZoomDisabled() {
+ fun getGestureSettingsPinchToZoomDisabled() {
every {
typedArray.getBoolean(
- R.styleable.mapbox_MapView_mapbox_gesturesZoomEnabled,
+ R.styleable.mapbox_MapView_mapbox_gesturesPinchToZoomEnabled,
true
)
} returns false
gesturePlugin.bind(context, gestureManager, attrs, 1f)
gesturePlugin.initialize()
- assertFalse(gesturePlugin.getSettings().zoomEnabled)
+ assertFalse(gesturePlugin.getSettings().pinchToZoomEnabled)
}
@Test
@@ -175,61 +175,81 @@ class GestureOptionsTest {
}
@Test
- fun getGestureSettingsDoubleTapEnabled() {
+ fun getGestureSettingsDoubleTapToZoomInEnabled() {
gesturePlugin.bind(context, gestureManager, attrs, 1f)
gesturePlugin.initialize()
- assertTrue(gesturePlugin.getSettings().doubleTapToZoomEnabled)
+ assertTrue(gesturePlugin.getSettings().doubleTapToZoomInEnabled)
}
@Test
- fun getGestureSettingsDoubleTapDisabled() {
+ fun getGestureSettingsDoubleTapToZoomInDisabled() {
every {
typedArray.getBoolean(
- R.styleable.mapbox_MapView_mapbox_gesturesDoubleTapToZoomEnabled,
+ R.styleable.mapbox_MapView_mapbox_gesturesDoubleTapToZoomInEnabled,
true
)
} returns false
gesturePlugin.bind(context, gestureManager, attrs, 1f)
gesturePlugin.initialize()
- assertFalse(gesturePlugin.getSettings().doubleTapToZoomEnabled)
+ assertFalse(gesturePlugin.getSettings().doubleTapToZoomInEnabled)
+ }
+
+ @Test
+ fun getGestureSettingsDoubleTouchToZoomOutEnabled() {
+ gesturePlugin.bind(context, gestureManager, attrs, 1f)
+ gesturePlugin.initialize()
+ assertTrue(gesturePlugin.getSettings().doubleTouchToZoomOutEnabled)
+ }
+
+ @Test
+ fun getGestureSettingsDoubleTouchToZoomOutDisabled() {
+ every {
+ typedArray.getBoolean(
+ R.styleable.mapbox_MapView_mapbox_gesturesDoubleTouchToZoomOutEnabled,
+ true
+ )
+ } returns false
+ gesturePlugin.bind(context, gestureManager, attrs, 1f)
+ gesturePlugin.initialize()
+ assertFalse(gesturePlugin.getSettings().doubleTouchToZoomOutEnabled)
}
@Test
fun getGestureSettingsPanScrollDefault() {
every {
typedArray.getInt(
- R.styleable.mapbox_MapView_mapbox_gesturesPanScrollMode,
+ R.styleable.mapbox_MapView_mapbox_gesturesScrollMode,
any()
)
- } returns PanScrollMode.HORIZONTAL_AND_VERTICAL.ordinal
+ } returns ScrollMode.HORIZONTAL_AND_VERTICAL.ordinal
gesturePlugin.bind(context, gestureManager, attrs, 1f)
gesturePlugin.initialize()
- assertEquals(gesturePlugin.getSettings().panScrollMode, PanScrollMode.HORIZONTAL_AND_VERTICAL)
+ assertEquals(gesturePlugin.getSettings().scrollMode, ScrollMode.HORIZONTAL_AND_VERTICAL)
}
@Test
fun getGestureSettingsPanScrollHorizontal() {
every {
typedArray.getInt(
- R.styleable.mapbox_MapView_mapbox_gesturesPanScrollMode,
+ R.styleable.mapbox_MapView_mapbox_gesturesScrollMode,
any()
)
- } returns PanScrollMode.HORIZONTAL.ordinal
+ } returns ScrollMode.HORIZONTAL.ordinal
gesturePlugin.bind(context, gestureManager, attrs, 1f)
gesturePlugin.initialize()
- assertEquals(gesturePlugin.getSettings().panScrollMode, PanScrollMode.HORIZONTAL)
+ assertEquals(gesturePlugin.getSettings().scrollMode, ScrollMode.HORIZONTAL)
}
@Test
fun getGestureSettingsPanScrollVertical() {
every {
typedArray.getInt(
- R.styleable.mapbox_MapView_mapbox_gesturesPanScrollMode,
+ R.styleable.mapbox_MapView_mapbox_gesturesScrollMode,
any()
)
- } returns PanScrollMode.VERTICAL.ordinal
+ } returns ScrollMode.VERTICAL.ordinal
gesturePlugin.bind(context, gestureManager, attrs, 1f)
gesturePlugin.initialize()
- assertEquals(gesturePlugin.getSettings().panScrollMode, PanScrollMode.VERTICAL)
+ assertEquals(gesturePlugin.getSettings().scrollMode, ScrollMode.VERTICAL)
}
}
\ No newline at end of file
diff --git a/plugin-gestures/src/test/java/com/mapbox/maps/plugin/gestures/GesturePluginTest.kt b/plugin-gestures/src/test/java/com/mapbox/maps/plugin/gestures/GesturePluginTest.kt
index 88fdc7753e..f03971aa9b 100644
--- a/plugin-gestures/src/test/java/com/mapbox/maps/plugin/gestures/GesturePluginTest.kt
+++ b/plugin-gestures/src/test/java/com/mapbox/maps/plugin/gestures/GesturePluginTest.kt
@@ -16,8 +16,8 @@ import com.mapbox.maps.CameraOptions
import com.mapbox.maps.CameraState
import com.mapbox.maps.EdgeInsets
import com.mapbox.maps.ScreenCoordinate
-import com.mapbox.maps.plugin.PanScrollMode
import com.mapbox.maps.plugin.Plugin
+import com.mapbox.maps.plugin.ScrollMode
import com.mapbox.maps.plugin.animation.CameraAnimationsPlugin
import com.mapbox.maps.plugin.delegates.*
import com.mapbox.maps.plugin.gestures.generated.GesturesAttributeParser
@@ -60,7 +60,7 @@ class GesturePluginTest {
@Before
fun setUp() {
- mockkObject(GesturesAttributeParser::class)
+ mockkObject(GesturesAttributeParser)
every {
GesturesAttributeParser.parseGesturesSettings(
context,
@@ -149,7 +149,7 @@ class GesturePluginTest {
@Test
fun verifyOnGenericMoveEventIgnore() {
- presenter.zoomEnabled = false
+ presenter.pinchToZoomEnabled = false
assertFalse(presenter.onGenericMotionEvent(obtainMotionEventButton(BUTTON_SECONDARY)))
verify(exactly = 0) { mapCameraManagerDelegate.setCamera(any()) }
}
@@ -252,8 +252,8 @@ class GesturePluginTest {
}
@Test
- fun verifyDoubleTapEventIgnoreZoomGesturesDisabled() {
- presenter.zoomEnabled = false
+ fun verifyDoubleTapEventIgnorePinchToZoomGesturesDisabled() {
+ presenter.doubleTapToZoomInEnabled = false
// verify initial tap
val downEvent = obtainMotionEventAction(ACTION_DOWN)
@@ -269,7 +269,7 @@ class GesturePluginTest {
@Test
fun verifyDoubleTapEventIgnoreDoubleTapGesturesDisabled() {
- presenter.doubleTapToZoomEnabled = false
+ presenter.doubleTapToZoomInEnabled = false
// verify initial tap
val downEvent = obtainMotionEventAction(ACTION_DOWN)
@@ -370,7 +370,7 @@ class GesturePluginTest {
any()
)
} returns CameraOptions.Builder().build()
- presenter.updateSettings { panScrollMode = PanScrollMode.VERTICAL }
+ presenter.updateSettings { scrollMode = ScrollMode.VERTICAL }
val motionEvent = mockk()
every { motionEvent.x } returns 0.0f
every { motionEvent.y } returns 0.0f
@@ -400,7 +400,7 @@ class GesturePluginTest {
any()
)
} returns CameraOptions.Builder().build()
- presenter.updateSettings { panScrollMode = PanScrollMode.HORIZONTAL }
+ presenter.updateSettings { scrollMode = ScrollMode.HORIZONTAL }
val motionEvent = mockk()
every { motionEvent.x } returns 0.0f
every { motionEvent.y } returns 0.0f
@@ -485,11 +485,11 @@ class GesturePluginTest {
}
@Test
- fun verifyScaleDisabled() {
- presenter.zoomEnabled = false
+ fun verifyPinchToZoomDisabled() {
+ presenter.pinchToZoomEnabled = false
val scaleDetector = mockk()
- every { scaleDetector.pointersCount } returns 1
+ every { scaleDetector.pointersCount } returns 2
every { scaleDetector.currentSpan } returns 100.0f
every { scaleDetector.previousSpan } returns 80.0f
every { mapCameraManagerDelegate.cameraState.zoom } returns 1.0
diff --git a/plugin-gestures/src/test/java/com/mapbox/maps/plugin/gestures/generated/GesturesAttributeParserTest.kt b/plugin-gestures/src/test/java/com/mapbox/maps/plugin/gestures/generated/GesturesAttributeParserTest.kt
index 0c6a0653a2..dca83181d6 100644
--- a/plugin-gestures/src/test/java/com/mapbox/maps/plugin/gestures/generated/GesturesAttributeParserTest.kt
+++ b/plugin-gestures/src/test/java/com/mapbox/maps/plugin/gestures/generated/GesturesAttributeParserTest.kt
@@ -8,7 +8,7 @@ import android.graphics.Color
import android.graphics.drawable.Drawable
import android.util.AttributeSet
import com.mapbox.maps.ScreenCoordinate
-import com.mapbox.maps.plugin.PanScrollMode
+import com.mapbox.maps.plugin.ScrollMode
import io.mockk.every
import io.mockk.mockk
import io.mockk.mockkObject
@@ -64,17 +64,17 @@ class GesturesAttributeParserTest {
}
@Test
- fun zoomEnabledTestTrue() {
+ fun pinchToZoomEnabledTestTrue() {
every { typedArray.getBoolean(any(), any()) } returns true
val settings = GesturesAttributeParser.parseGesturesSettings(context, attrs, 1.2f)
- assertEquals(true, settings.zoomEnabled)
+ assertEquals(true, settings.pinchToZoomEnabled)
}
@Test
- fun zoomEnabledTestFalse() {
+ fun pinchToZoomEnabledTestFalse() {
every { typedArray.getBoolean(any(), any()) } returns false
val settings = GesturesAttributeParser.parseGesturesSettings(context, attrs, 1.2f)
- assertEquals(false, settings.zoomEnabled)
+ assertEquals(false, settings.pinchToZoomEnabled)
}
@Test
@@ -105,136 +105,136 @@ class GesturesAttributeParserTest {
assertEquals(false, settings.pitchEnabled)
}
@Test
- fun panScrollModeTest() {
- every { typedArray.getInt(any(), any()) } returns PanScrollMode.HORIZONTAL_AND_VERTICAL.ordinal
+ fun scrollModeTest() {
+ every { typedArray.getInt(any(), any()) } returns ScrollMode.HORIZONTAL_AND_VERTICAL.ordinal
val settings = GesturesAttributeParser.parseGesturesSettings(context, attrs, 1.2f)
- assertEquals(PanScrollMode.HORIZONTAL_AND_VERTICAL, settings.panScrollMode)
+ assertEquals(ScrollMode.HORIZONTAL_AND_VERTICAL, settings.scrollMode)
}
@Test
- fun doubleTapToZoomEnabledTestTrue() {
+ fun doubleTapToZoomInEnabledTestTrue() {
every { typedArray.getBoolean(any(), any()) } returns true
val settings = GesturesAttributeParser.parseGesturesSettings(context, attrs, 1.2f)
- assertEquals(true, settings.doubleTapToZoomEnabled)
+ assertEquals(true, settings.doubleTapToZoomInEnabled)
}
@Test
- fun doubleTapToZoomEnabledTestFalse() {
+ fun doubleTapToZoomInEnabledTestFalse() {
every { typedArray.getBoolean(any(), any()) } returns false
val settings = GesturesAttributeParser.parseGesturesSettings(context, attrs, 1.2f)
- assertEquals(false, settings.doubleTapToZoomEnabled)
+ assertEquals(false, settings.doubleTapToZoomInEnabled)
}
@Test
- fun quickZoomEnabledTestTrue() {
+ fun doubleTouchToZoomOutEnabledTestTrue() {
every { typedArray.getBoolean(any(), any()) } returns true
val settings = GesturesAttributeParser.parseGesturesSettings(context, attrs, 1.2f)
- assertEquals(true, settings.quickZoomEnabled)
+ assertEquals(true, settings.doubleTouchToZoomOutEnabled)
}
@Test
- fun quickZoomEnabledTestFalse() {
+ fun doubleTouchToZoomOutEnabledTestFalse() {
every { typedArray.getBoolean(any(), any()) } returns false
val settings = GesturesAttributeParser.parseGesturesSettings(context, attrs, 1.2f)
- assertEquals(false, settings.quickZoomEnabled)
+ assertEquals(false, settings.doubleTouchToZoomOutEnabled)
}
@Test
- fun focalPointTest() {
- every { typedArray.getDimension(any(), any()) } returns 10.0f
+ fun quickZoomEnabledTestTrue() {
+ every { typedArray.getBoolean(any(), any()) } returns true
val settings = GesturesAttributeParser.parseGesturesSettings(context, attrs, 1.2f)
- assertEquals(ScreenCoordinate(10.0, 10.0), settings.focalPoint)
+ assertEquals(true, settings.quickZoomEnabled)
}
@Test
- fun scaleVelocityAnimationEnabledTestTrue() {
- every { typedArray.getBoolean(any(), any()) } returns true
+ fun quickZoomEnabledTestFalse() {
+ every { typedArray.getBoolean(any(), any()) } returns false
val settings = GesturesAttributeParser.parseGesturesSettings(context, attrs, 1.2f)
- assertEquals(true, settings.scaleVelocityAnimationEnabled)
+ assertEquals(false, settings.quickZoomEnabled)
}
@Test
- fun scaleVelocityAnimationEnabledTestFalse() {
- every { typedArray.getBoolean(any(), any()) } returns false
+ fun focalPointTest() {
+ every { typedArray.getDimension(any(), any()) } returns 10.0f
val settings = GesturesAttributeParser.parseGesturesSettings(context, attrs, 1.2f)
- assertEquals(false, settings.scaleVelocityAnimationEnabled)
+ assertEquals(ScreenCoordinate(10.0, 10.0), settings.focalPoint)
}
@Test
- fun rotateVelocityAnimationEnabledTestTrue() {
+ fun pinchToZoomDecelerationEnabledTestTrue() {
every { typedArray.getBoolean(any(), any()) } returns true
val settings = GesturesAttributeParser.parseGesturesSettings(context, attrs, 1.2f)
- assertEquals(true, settings.rotateVelocityAnimationEnabled)
+ assertEquals(true, settings.pinchToZoomDecelerationEnabled)
}
@Test
- fun rotateVelocityAnimationEnabledTestFalse() {
+ fun pinchToZoomDecelerationEnabledTestFalse() {
every { typedArray.getBoolean(any(), any()) } returns false
val settings = GesturesAttributeParser.parseGesturesSettings(context, attrs, 1.2f)
- assertEquals(false, settings.rotateVelocityAnimationEnabled)
+ assertEquals(false, settings.pinchToZoomDecelerationEnabled)
}
@Test
- fun flingVelocityAnimationEnabledTestTrue() {
+ fun rotateDecelerationEnabledTestTrue() {
every { typedArray.getBoolean(any(), any()) } returns true
val settings = GesturesAttributeParser.parseGesturesSettings(context, attrs, 1.2f)
- assertEquals(true, settings.flingVelocityAnimationEnabled)
+ assertEquals(true, settings.rotateDecelerationEnabled)
}
@Test
- fun flingVelocityAnimationEnabledTestFalse() {
+ fun rotateDecelerationEnabledTestFalse() {
every { typedArray.getBoolean(any(), any()) } returns false
val settings = GesturesAttributeParser.parseGesturesSettings(context, attrs, 1.2f)
- assertEquals(false, settings.flingVelocityAnimationEnabled)
+ assertEquals(false, settings.rotateDecelerationEnabled)
}
@Test
- fun increaseRotateThresholdWhenScalingTestTrue() {
+ fun scrollDecelerationEnabledTestTrue() {
every { typedArray.getBoolean(any(), any()) } returns true
val settings = GesturesAttributeParser.parseGesturesSettings(context, attrs, 1.2f)
- assertEquals(true, settings.increaseRotateThresholdWhenScaling)
+ assertEquals(true, settings.scrollDecelerationEnabled)
}
@Test
- fun increaseRotateThresholdWhenScalingTestFalse() {
+ fun scrollDecelerationEnabledTestFalse() {
every { typedArray.getBoolean(any(), any()) } returns false
val settings = GesturesAttributeParser.parseGesturesSettings(context, attrs, 1.2f)
- assertEquals(false, settings.increaseRotateThresholdWhenScaling)
+ assertEquals(false, settings.scrollDecelerationEnabled)
}
@Test
- fun disableRotateWhenScalingTestTrue() {
+ fun increaseRotateThresholdWhenPinchingToZoomTestTrue() {
every { typedArray.getBoolean(any(), any()) } returns true
val settings = GesturesAttributeParser.parseGesturesSettings(context, attrs, 1.2f)
- assertEquals(true, settings.disableRotateWhenScaling)
+ assertEquals(true, settings.increaseRotateThresholdWhenPinchingToZoom)
}
@Test
- fun disableRotateWhenScalingTestFalse() {
+ fun increaseRotateThresholdWhenPinchingToZoomTestFalse() {
every { typedArray.getBoolean(any(), any()) } returns false
val settings = GesturesAttributeParser.parseGesturesSettings(context, attrs, 1.2f)
- assertEquals(false, settings.disableRotateWhenScaling)
+ assertEquals(false, settings.increaseRotateThresholdWhenPinchingToZoom)
}
@Test
- fun increaseScaleThresholdWhenRotatingTestTrue() {
+ fun increasePinchToZoomThresholdWhenRotatingTestTrue() {
every { typedArray.getBoolean(any(), any()) } returns true
val settings = GesturesAttributeParser.parseGesturesSettings(context, attrs, 1.2f)
- assertEquals(true, settings.increaseScaleThresholdWhenRotating)
+ assertEquals(true, settings.increasePinchToZoomThresholdWhenRotating)
}
@Test
- fun increaseScaleThresholdWhenRotatingTestFalse() {
+ fun increasePinchToZoomThresholdWhenRotatingTestFalse() {
every { typedArray.getBoolean(any(), any()) } returns false
val settings = GesturesAttributeParser.parseGesturesSettings(context, attrs, 1.2f)
- assertEquals(false, settings.increaseScaleThresholdWhenRotating)
+ assertEquals(false, settings.increasePinchToZoomThresholdWhenRotating)
}
@Test
- fun zoomRateTest() {
+ fun zoomAnimationAmountTest() {
every { typedArray.getFloat(any(), any()) } returns 1f
val settings = GesturesAttributeParser.parseGesturesSettings(context, attrs, 1.2f)
- assertEquals(1f, settings.zoomRate)
+ assertEquals(1f, settings.zoomAnimationAmount)
}
}
diff --git a/sdk-base/src/main/java/com/mapbox/maps/plugin/ConfigProperties.kt b/sdk-base/src/main/java/com/mapbox/maps/plugin/ConfigProperties.kt
index d9c9e78b06..3f46f19578 100644
--- a/sdk-base/src/main/java/com/mapbox/maps/plugin/ConfigProperties.kt
+++ b/sdk-base/src/main/java/com/mapbox/maps/plugin/ConfigProperties.kt
@@ -5,21 +5,21 @@ package com.mapbox.maps.plugin
import android.graphics.drawable.Drawable
/**
- * Whether the user is restricted in which direction the map is scrolled.
+ * Configures the directions in which the map is allowed to move during a scroll gesture.
*
* @param value String value of this property
*/
-enum class PanScrollMode(val value: String) {
+enum class ScrollMode(val value: String) {
/**
- * The map allows the user to only scroll horizontally.
+ * The map may only move horizontally.
*/
HORIZONTAL("horizontal"),
/**
- * The map allows the user to only scroll vertically.
+ * The map may only move vertically.
*/
VERTICAL("vertical"),
/**
- * The map allows the user to scroll both horizontally and vertically.
+ * The map may move both horizontally and vertically.
*/
HORIZONTAL_AND_VERTICAL("horizontal-and-vertical"),
}
diff --git a/sdk-base/src/main/java/com/mapbox/maps/plugin/gestures/generated/GesturesSettings.kt b/sdk-base/src/main/java/com/mapbox/maps/plugin/gestures/generated/GesturesSettings.kt
index b1d762169a..54fb834eec 100644
--- a/sdk-base/src/main/java/com/mapbox/maps/plugin/gestures/generated/GesturesSettings.kt
+++ b/sdk-base/src/main/java/com/mapbox/maps/plugin/gestures/generated/GesturesSettings.kt
@@ -3,91 +3,86 @@
package com.mapbox.maps.plugin.gestures.generated
import com.mapbox.maps.ScreenCoordinate
-import com.mapbox.maps.plugin.PanScrollMode
+import com.mapbox.maps.plugin.ScrollMode
/**
* Gesture configuration allows to control the user touch interaction.
*/
data class GesturesSettings(
/**
- * Whether rotation gestures are enabled.
+ * Whether the rotate gesture is enabled.
*/
var rotateEnabled: Boolean = true,
/**
- * Whether zoom gestures are enabled.
+ * Whether the pinch to zoom gesture is enabled.
*/
- var zoomEnabled: Boolean = true,
+ var pinchToZoomEnabled: Boolean = true,
/**
- * Whether scroll gestures are enabled.
+ * Whether the single-touch scroll gesture is enabled.
*/
var scrollEnabled: Boolean = true,
/**
- * Whether pitch gestures are enabled.
+ * Whether the pitch gesture is enabled.
*/
var pitchEnabled: Boolean = true,
/**
- * Whether the user is restricted in which direction the map is scrolled.
+ * Configures the directions in which the map is allowed to move during a scroll gesture.
*/
- var panScrollMode: PanScrollMode = PanScrollMode.HORIZONTAL_AND_VERTICAL,
+ var scrollMode: ScrollMode = ScrollMode.HORIZONTAL_AND_VERTICAL,
/**
- * Whether double tapping the map results in a zoom gesture.
+ * Whether double tapping the map with one touch results in a zoom-in animation.
*/
- var doubleTapToZoomEnabled: Boolean = true,
+ var doubleTapToZoomInEnabled: Boolean = true,
/**
- * Whether quick zoom gesture is enabled.
+ * Whether single tapping the map with two touches results in a zoom-out animation.
*/
- var quickZoomEnabled: Boolean = true,
+ var doubleTouchToZoomOutEnabled: Boolean = true,
/**
- * Whether a gesture executes around a fixed focal point or the center of the gesture.
+ * Whether the quick zoom gesture is enabled.
*/
- var focalPoint: ScreenCoordinate? = null,
-
- /**
- * Whether scale velocity animations are enabled, true by default.
- */
- var scaleVelocityAnimationEnabled: Boolean = true,
+ var quickZoomEnabled: Boolean = true,
/**
- * Whether rotate velocity animations are enabled, true by default.
+ * By default, gestures rotate and zoom around the center of the gesture. Set this property to rotate and zoom around a fixed point instead.
*/
- var rotateVelocityAnimationEnabled: Boolean = true,
+ var focalPoint: ScreenCoordinate? = null,
/**
- * Whether fling velocity animations are enabled, true by default.
+ * Whether a deceleration animation following a pinch-to-zoom gesture is enabled. True by default.
*/
- var flingVelocityAnimationEnabled: Boolean = true,
+ var pinchToZoomDecelerationEnabled: Boolean = true,
/**
- * Whether rotate threshold increases when scaling. true by default.
+ * Whether a deceleration animation following a rotate gesture is enabled. True by default.
*/
- var increaseRotateThresholdWhenScaling: Boolean = true,
+ var rotateDecelerationEnabled: Boolean = true,
/**
- * Whether rotate is disabled when scaling. true by default.
+ * Whether a deceleration animation following a scroll gesture is enabled. True by default.
*/
- var disableRotateWhenScaling: Boolean = true,
+ var scrollDecelerationEnabled: Boolean = true,
/**
- * Whether scale threshold increases when rotating. true by default.
+ * Whether rotate threshold increases when pinching to zoom. true by default.
*/
- var increaseScaleThresholdWhenRotating: Boolean = true,
+ var increaseRotateThresholdWhenPinchingToZoom: Boolean = true,
/**
- * The rate at which the zoom level increases. 1.0 by default
+ * Whether pinch to zoom threshold increases when rotating. true by default.
*/
- var zoomRate: Float = 1f,
+ var increasePinchToZoomThresholdWhenRotating: Boolean = true,
/**
- * The pixel ratio of the device that the gestures will take in account.
+ * The amount by which the zoom level increases or decreases during a double-tap-to-zoom-in or double-touch-to-zoom-out gesture. 1.0 by default. Must be positive.
*/
- var pixelRatio: Float = 1f,
+ var zoomAnimationAmount: Float = 1f,
)
// End of generated file.
\ No newline at end of file
diff --git a/sdk-base/src/main/java/com/mapbox/maps/plugin/gestures/generated/GesturesSettingsBase.kt b/sdk-base/src/main/java/com/mapbox/maps/plugin/gestures/generated/GesturesSettingsBase.kt
index f6f5c59948..84475cf8e2 100644
--- a/sdk-base/src/main/java/com/mapbox/maps/plugin/gestures/generated/GesturesSettingsBase.kt
+++ b/sdk-base/src/main/java/com/mapbox/maps/plugin/gestures/generated/GesturesSettingsBase.kt
@@ -3,7 +3,7 @@
package com.mapbox.maps.plugin.gestures.generated
import com.mapbox.maps.ScreenCoordinate
-import com.mapbox.maps.plugin.PanScrollMode
+import com.mapbox.maps.plugin.ScrollMode
/**
* Abstract settings class for GesturesPlugin.
@@ -41,7 +41,7 @@ abstract class GesturesSettingsBase : GesturesSettingsInterface {
}
/**
- * Whether rotation gestures are enabled.
+ * Whether the rotate gesture is enabled.
*/
override var rotateEnabled: Boolean
get() {
@@ -53,19 +53,19 @@ abstract class GesturesSettingsBase : GesturesSettingsInterface {
}
/**
- * Whether zoom gestures are enabled.
+ * Whether the pinch to zoom gesture is enabled.
*/
- override var zoomEnabled: Boolean
+ override var pinchToZoomEnabled: Boolean
get() {
- return this.internalSettings.zoomEnabled
+ return this.internalSettings.pinchToZoomEnabled
}
set(value) {
- this.internalSettings.zoomEnabled = value
+ this.internalSettings.pinchToZoomEnabled = value
applySettings()
}
/**
- * Whether scroll gestures are enabled.
+ * Whether the single-touch scroll gesture is enabled.
*/
override var scrollEnabled: Boolean
get() {
@@ -77,7 +77,7 @@ abstract class GesturesSettingsBase : GesturesSettingsInterface {
}
/**
- * Whether pitch gestures are enabled.
+ * Whether the pitch gesture is enabled.
*/
override var pitchEnabled: Boolean
get() {
@@ -89,146 +89,134 @@ abstract class GesturesSettingsBase : GesturesSettingsInterface {
}
/**
- * Whether the user is restricted in which direction the map is scrolled.
+ * Configures the directions in which the map is allowed to move during a scroll gesture.
*/
- override var panScrollMode: PanScrollMode
+ override var scrollMode: ScrollMode
get() {
- return this.internalSettings.panScrollMode
+ return this.internalSettings.scrollMode
}
set(value) {
- this.internalSettings.panScrollMode = value
+ this.internalSettings.scrollMode = value
applySettings()
}
/**
- * Whether double tapping the map results in a zoom gesture.
+ * Whether double tapping the map with one touch results in a zoom-in animation.
*/
- override var doubleTapToZoomEnabled: Boolean
+ override var doubleTapToZoomInEnabled: Boolean
get() {
- return this.internalSettings.doubleTapToZoomEnabled
+ return this.internalSettings.doubleTapToZoomInEnabled
}
set(value) {
- this.internalSettings.doubleTapToZoomEnabled = value
+ this.internalSettings.doubleTapToZoomInEnabled = value
applySettings()
}
/**
- * Whether quick zoom gesture is enabled.
+ * Whether single tapping the map with two touches results in a zoom-out animation.
*/
- override var quickZoomEnabled: Boolean
- get() {
- return this.internalSettings.quickZoomEnabled
- }
- set(value) {
- this.internalSettings.quickZoomEnabled = value
- applySettings()
- }
-
- /**
- * Whether a gesture executes around a fixed focal point or the center of the gesture.
- */
- override var focalPoint: ScreenCoordinate?
+ override var doubleTouchToZoomOutEnabled: Boolean
get() {
- return this.internalSettings.focalPoint
+ return this.internalSettings.doubleTouchToZoomOutEnabled
}
set(value) {
- this.internalSettings.focalPoint = value
+ this.internalSettings.doubleTouchToZoomOutEnabled = value
applySettings()
}
/**
- * Whether scale velocity animations are enabled, true by default.
+ * Whether the quick zoom gesture is enabled.
*/
- override var scaleVelocityAnimationEnabled: Boolean
+ override var quickZoomEnabled: Boolean
get() {
- return this.internalSettings.scaleVelocityAnimationEnabled
+ return this.internalSettings.quickZoomEnabled
}
set(value) {
- this.internalSettings.scaleVelocityAnimationEnabled = value
+ this.internalSettings.quickZoomEnabled = value
applySettings()
}
/**
- * Whether rotate velocity animations are enabled, true by default.
+ * By default, gestures rotate and zoom around the center of the gesture. Set this property to rotate and zoom around a fixed point instead.
*/
- override var rotateVelocityAnimationEnabled: Boolean
+ override var focalPoint: ScreenCoordinate?
get() {
- return this.internalSettings.rotateVelocityAnimationEnabled
+ return this.internalSettings.focalPoint
}
set(value) {
- this.internalSettings.rotateVelocityAnimationEnabled = value
+ this.internalSettings.focalPoint = value
applySettings()
}
/**
- * Whether fling velocity animations are enabled, true by default.
+ * Whether a deceleration animation following a pinch-to-zoom gesture is enabled. True by default.
*/
- override var flingVelocityAnimationEnabled: Boolean
+ override var pinchToZoomDecelerationEnabled: Boolean
get() {
- return this.internalSettings.flingVelocityAnimationEnabled
+ return this.internalSettings.pinchToZoomDecelerationEnabled
}
set(value) {
- this.internalSettings.flingVelocityAnimationEnabled = value
+ this.internalSettings.pinchToZoomDecelerationEnabled = value
applySettings()
}
/**
- * Whether rotate threshold increases when scaling. true by default.
+ * Whether a deceleration animation following a rotate gesture is enabled. True by default.
*/
- override var increaseRotateThresholdWhenScaling: Boolean
+ override var rotateDecelerationEnabled: Boolean
get() {
- return this.internalSettings.increaseRotateThresholdWhenScaling
+ return this.internalSettings.rotateDecelerationEnabled
}
set(value) {
- this.internalSettings.increaseRotateThresholdWhenScaling = value
+ this.internalSettings.rotateDecelerationEnabled = value
applySettings()
}
/**
- * Whether rotate is disabled when scaling. true by default.
+ * Whether a deceleration animation following a scroll gesture is enabled. True by default.
*/
- override var disableRotateWhenScaling: Boolean
+ override var scrollDecelerationEnabled: Boolean
get() {
- return this.internalSettings.disableRotateWhenScaling
+ return this.internalSettings.scrollDecelerationEnabled
}
set(value) {
- this.internalSettings.disableRotateWhenScaling = value
+ this.internalSettings.scrollDecelerationEnabled = value
applySettings()
}
/**
- * Whether scale threshold increases when rotating. true by default.
+ * Whether rotate threshold increases when pinching to zoom. true by default.
*/
- override var increaseScaleThresholdWhenRotating: Boolean
+ override var increaseRotateThresholdWhenPinchingToZoom: Boolean
get() {
- return this.internalSettings.increaseScaleThresholdWhenRotating
+ return this.internalSettings.increaseRotateThresholdWhenPinchingToZoom
}
set(value) {
- this.internalSettings.increaseScaleThresholdWhenRotating = value
+ this.internalSettings.increaseRotateThresholdWhenPinchingToZoom = value
applySettings()
}
/**
- * The rate at which the zoom level increases. 1.0 by default
+ * Whether pinch to zoom threshold increases when rotating. true by default.
*/
- override var zoomRate: Float
+ override var increasePinchToZoomThresholdWhenRotating: Boolean
get() {
- return this.internalSettings.zoomRate
+ return this.internalSettings.increasePinchToZoomThresholdWhenRotating
}
set(value) {
- this.internalSettings.zoomRate = value
+ this.internalSettings.increasePinchToZoomThresholdWhenRotating = value
applySettings()
}
/**
- * The pixel ratio of the device that the gestures will take in account.
+ * The amount by which the zoom level increases or decreases during a double-tap-to-zoom-in or double-touch-to-zoom-out gesture. 1.0 by default. Must be positive.
*/
- override var pixelRatio: Float
+ override var zoomAnimationAmount: Float
get() {
- return this.internalSettings.pixelRatio
+ return this.internalSettings.zoomAnimationAmount
}
set(value) {
- this.internalSettings.pixelRatio = value
+ this.internalSettings.zoomAnimationAmount = value
applySettings()
}
}
diff --git a/sdk-base/src/main/java/com/mapbox/maps/plugin/gestures/generated/GesturesSettingsInterface.kt b/sdk-base/src/main/java/com/mapbox/maps/plugin/gestures/generated/GesturesSettingsInterface.kt
index a591a44aa6..d39ec3d55c 100644
--- a/sdk-base/src/main/java/com/mapbox/maps/plugin/gestures/generated/GesturesSettingsInterface.kt
+++ b/sdk-base/src/main/java/com/mapbox/maps/plugin/gestures/generated/GesturesSettingsInterface.kt
@@ -3,7 +3,7 @@
package com.mapbox.maps.plugin.gestures.generated
import com.mapbox.maps.ScreenCoordinate
-import com.mapbox.maps.plugin.PanScrollMode
+import com.mapbox.maps.plugin.ScrollMode
/**
* Interface that defines the public settings interface for GesturesPlugin.
@@ -24,84 +24,79 @@ interface GesturesSettingsInterface {
fun updateSettings(block: GesturesSettings.() -> Unit)
/**
- * Whether rotation gestures are enabled.
+ * Whether the rotate gesture is enabled.
*/
var rotateEnabled: Boolean
/**
- * Whether zoom gestures are enabled.
+ * Whether the pinch to zoom gesture is enabled.
*/
- var zoomEnabled: Boolean
+ var pinchToZoomEnabled: Boolean
/**
- * Whether scroll gestures are enabled.
+ * Whether the single-touch scroll gesture is enabled.
*/
var scrollEnabled: Boolean
/**
- * Whether pitch gestures are enabled.
+ * Whether the pitch gesture is enabled.
*/
var pitchEnabled: Boolean
/**
- * Whether the user is restricted in which direction the map is scrolled.
+ * Configures the directions in which the map is allowed to move during a scroll gesture.
*/
- var panScrollMode: PanScrollMode
+ var scrollMode: ScrollMode
/**
- * Whether double tapping the map results in a zoom gesture.
+ * Whether double tapping the map with one touch results in a zoom-in animation.
*/
- var doubleTapToZoomEnabled: Boolean
+ var doubleTapToZoomInEnabled: Boolean
/**
- * Whether quick zoom gesture is enabled.
+ * Whether single tapping the map with two touches results in a zoom-out animation.
*/
- var quickZoomEnabled: Boolean
+ var doubleTouchToZoomOutEnabled: Boolean
/**
- * Whether a gesture executes around a fixed focal point or the center of the gesture.
+ * Whether the quick zoom gesture is enabled.
*/
- var focalPoint: ScreenCoordinate?
-
- /**
- * Whether scale velocity animations are enabled, true by default.
- */
- var scaleVelocityAnimationEnabled: Boolean
+ var quickZoomEnabled: Boolean
/**
- * Whether rotate velocity animations are enabled, true by default.
+ * By default, gestures rotate and zoom around the center of the gesture. Set this property to rotate and zoom around a fixed point instead.
*/
- var rotateVelocityAnimationEnabled: Boolean
+ var focalPoint: ScreenCoordinate?
/**
- * Whether fling velocity animations are enabled, true by default.
+ * Whether a deceleration animation following a pinch-to-zoom gesture is enabled. True by default.
*/
- var flingVelocityAnimationEnabled: Boolean
+ var pinchToZoomDecelerationEnabled: Boolean
/**
- * Whether rotate threshold increases when scaling. true by default.
+ * Whether a deceleration animation following a rotate gesture is enabled. True by default.
*/
- var increaseRotateThresholdWhenScaling: Boolean
+ var rotateDecelerationEnabled: Boolean
/**
- * Whether rotate is disabled when scaling. true by default.
+ * Whether a deceleration animation following a scroll gesture is enabled. True by default.
*/
- var disableRotateWhenScaling: Boolean
+ var scrollDecelerationEnabled: Boolean
/**
- * Whether scale threshold increases when rotating. true by default.
+ * Whether rotate threshold increases when pinching to zoom. true by default.
*/
- var increaseScaleThresholdWhenRotating: Boolean
+ var increaseRotateThresholdWhenPinchingToZoom: Boolean
/**
- * The rate at which the zoom level increases. 1.0 by default
+ * Whether pinch to zoom threshold increases when rotating. true by default.
*/
- var zoomRate: Float
+ var increasePinchToZoomThresholdWhenRotating: Boolean
/**
- * The pixel ratio of the device that the gestures will take in account.
+ * The amount by which the zoom level increases or decreases during a double-tap-to-zoom-in or double-touch-to-zoom-out gesture. 1.0 by default. Must be positive.
*/
- var pixelRatio: Float
+ var zoomAnimationAmount: Float
}
// End of generated file.
\ No newline at end of file