You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[compose] Add incremental camera animation methods to MapViewportState (#14735)
Fix [MAPSAND-2800](https://mapbox.atlassian.net/browse/MAPSAND-2800)
### Summary
- Add `rotateBy`, `moveBy`, `pitchBy`, and `scaleBy` methods to
`MapViewportState` in the Compose extension
- Each method integrates with the viewport system via a new
`RelativeAnimationViewportTransition`
- Add demo activity `MapViewportStatePredefinedAnimatorsActivity`
showcasing all four methods
### Context
`MapViewportState` lacked parity with the View-based
`CameraAnimationsPlugin` for incremental/relative camera animations.
Users needed these methods to perform gesture-like programmatic camera
movements in Compose.
### Discussion
- All methods are exclusive, so 2 animations can't run at the same time,
so they do not interfere with other viewport transitions, but substitute
them. To add more granular control with `playAnimatorsTogether` or
`playAnimatorsSequentially`, we would need some other API.
[MAPSAND-2800]:
https://mapbox.atlassian.net/browse/MAPSAND-2800?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
cc @mapbox/maps-android
GitOrigin-RevId: d02269c8d262b201d2bc0bc696457957fa46e1e5
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@ Mapbox welcomes participation and contributions from everyone.
8
8
## Features ✨ and improvements 🏁
9
9
* [compose] Introduce experimental `IndoorSelector` composable function available inside `MapboxMap`, displaying a scrollable floor-selection widget that appears automatically when an indoor building is in view. Exposes `IndoorSelectorState` for programmatic access to the current floor list and selected floor, and an `onFloorClicked` callback for reacting to user selections.
10
10
* [compose] Add `IndoorSelectorControl` headless composable inside `MapIndoorSelectorScope`: attaches the indoor plugin to an `IndoorSelectorState` without rendering any UI, enabling custom floor-selector implementations.
11
+
* [compose] Add `rotateBy`, `moveBy`, `pitchBy`, and `scaleBy` methods to `MapViewportState` for incremental camera animations.
11
12
* [compose] Add `rememberStyleImage(imageId, image9Patch: NinePatchImage)` and `remember9PatchStyleImage(imageId, bitmap: Bitmap)` overloads for nine-patch images.
12
13
* Introduce new experimental `ViewAnnotationOptions.enableSymbolLayerCollision` option which allows view annotations to hide underlying map symbols to avoid visual clutter.
13
14
By default, the full bounding box of the view annotation is used for collision detection. If your annotation has a non-rectangular shape, it is highly recommended to mark the specific subviews that should participate via the new experimental `View.mbxCollisionBox` flag.
<stringname="description_map_viewport_state_predefined_animators">Use incremental camera animations (rotateBy, moveBy, pitchBy, scaleBy) via MapViewportState</string>
14
15
<stringname="description_multiple_display">Display the map on a secondary display</string>
15
16
<stringname="description_ornaments_customisation">Customise ornaments of the Map</string>
16
17
<stringname="description_custom_attribution">Customise attribution of the Map</string>
Copy file name to clipboardExpand all lines: extension-compose/api/extension-compose.api
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -171,6 +171,14 @@ public final class com/mapbox/maps/extension/compose/animation/viewport/MapViewp
171
171
public final fun getMapViewportStatusChangedReason ()Lcom/mapbox/maps/plugin/viewport/data/ViewportStatusChangeReason;
172
172
public final fun getStyleDefaultCameraOptions ()Lcom/mapbox/maps/CameraOptions;
173
173
public final fun idle ()V
174
+
public final fun moveBy (Lcom/mapbox/maps/ScreenCoordinate;Lcom/mapbox/maps/plugin/animation/MapAnimationOptions;Lcom/mapbox/maps/plugin/viewport/CompletionListener;)V
175
+
public static synthetic fun moveBy$default (Lcom/mapbox/maps/extension/compose/animation/viewport/MapViewportState;Lcom/mapbox/maps/ScreenCoordinate;Lcom/mapbox/maps/plugin/animation/MapAnimationOptions;Lcom/mapbox/maps/plugin/viewport/CompletionListener;ILjava/lang/Object;)V
176
+
public final fun pitchBy (DLcom/mapbox/maps/plugin/animation/MapAnimationOptions;Lcom/mapbox/maps/plugin/viewport/CompletionListener;)V
177
+
public static synthetic fun pitchBy$default (Lcom/mapbox/maps/extension/compose/animation/viewport/MapViewportState;DLcom/mapbox/maps/plugin/animation/MapAnimationOptions;Lcom/mapbox/maps/plugin/viewport/CompletionListener;ILjava/lang/Object;)V
178
+
public final fun rotateBy (Lcom/mapbox/maps/ScreenCoordinate;Lcom/mapbox/maps/ScreenCoordinate;Lcom/mapbox/maps/plugin/animation/MapAnimationOptions;Lcom/mapbox/maps/plugin/viewport/CompletionListener;)V
179
+
public static synthetic fun rotateBy$default (Lcom/mapbox/maps/extension/compose/animation/viewport/MapViewportState;Lcom/mapbox/maps/ScreenCoordinate;Lcom/mapbox/maps/ScreenCoordinate;Lcom/mapbox/maps/plugin/animation/MapAnimationOptions;Lcom/mapbox/maps/plugin/viewport/CompletionListener;ILjava/lang/Object;)V
180
+
public final fun scaleBy (DLcom/mapbox/maps/ScreenCoordinate;Lcom/mapbox/maps/plugin/animation/MapAnimationOptions;Lcom/mapbox/maps/plugin/viewport/CompletionListener;)V
181
+
public static synthetic fun scaleBy$default (Lcom/mapbox/maps/extension/compose/animation/viewport/MapViewportState;DLcom/mapbox/maps/ScreenCoordinate;Lcom/mapbox/maps/plugin/animation/MapAnimationOptions;Lcom/mapbox/maps/plugin/viewport/CompletionListener;ILjava/lang/Object;)V
174
182
public final fun setCameraOptions (Lcom/mapbox/maps/CameraOptions;)V
175
183
public final fun setCameraOptions (Lkotlin/jvm/functions/Function1;)V
176
184
public final fun transitionToFollowPuckState (Lcom/mapbox/maps/plugin/viewport/data/FollowPuckViewportStateOptions;Lcom/mapbox/maps/plugin/viewport/data/DefaultViewportTransitionOptions;Lcom/mapbox/maps/plugin/viewport/CompletionListener;)V
0 commit comments