diff --git a/src/Controls/Maps/src/HandlerImpl/Map.Impl.cs b/src/Controls/Maps/src/HandlerImpl/Map.Impl.cs index 631b6f3cbf6a..8800d90b192d 100644 --- a/src/Controls/Maps/src/HandlerImpl/Map.Impl.cs +++ b/src/Controls/Maps/src/HandlerImpl/Map.Impl.cs @@ -41,6 +41,10 @@ void IMap.UserLocationUpdated(Location location) void IMap.HideInfoWindow(IMapPin pin) => Handler?.Invoke(nameof(IMap.HideInfoWindow), pin); + void IMap.MoveToRegion(MapSpan region) => MoveToRegion(region); + + void IMap.MoveToRegion(MapSpan region, bool animated) => MoveToRegion(region, animated); + MapSpan? IMap.VisibleRegion { get @@ -61,7 +65,7 @@ protected override void OnHandlerChanged() { base.OnHandlerChanged(); //The user specified on the ctor a MapSpan we now need the handler to move to that region - Handler?.Invoke(nameof(IMap.MoveToRegion), _lastMoveToRegion); + Handler?.Invoke(nameof(IMap.MoveToRegion), new MoveToRegionRequest(_lastMoveToRegion, false)); } } diff --git a/src/Controls/Maps/src/Map.cs b/src/Controls/Maps/src/Map.cs index 55ac15c66023..fcfac6e48f22 100644 --- a/src/Controls/Maps/src/Map.cs +++ b/src/Controls/Maps/src/Map.cs @@ -259,7 +259,15 @@ public IEnumerator GetEnumerator() /// /// A object containing details on what region should be shown. /// Thrown when is . - public void MoveToRegion(MapSpan mapSpan) + public void MoveToRegion(MapSpan mapSpan) => MoveToRegion(mapSpan, true); + + /// + /// Adjusts the viewport of the map control to view the specified region, with control over animation. + /// + /// A object containing details on what region should be shown. + /// Whether the transition should be animated. + /// Thrown when is . + public void MoveToRegion(MapSpan mapSpan, bool animated) { if (mapSpan is null) { @@ -267,7 +275,7 @@ public void MoveToRegion(MapSpan mapSpan) } _lastMoveToRegion = mapSpan; - Handler?.Invoke(nameof(IMap.MoveToRegion), _lastMoveToRegion); + Handler?.Invoke(nameof(IMap.MoveToRegion), new MoveToRegionRequest(_lastMoveToRegion, animated)); } IEnumerator IEnumerable.GetEnumerator() diff --git a/src/Controls/Maps/src/PublicAPI/net-android/PublicAPI.Unshipped.txt b/src/Controls/Maps/src/PublicAPI/net-android/PublicAPI.Unshipped.txt index 902063dc66be..5bfc62325a6a 100644 --- a/src/Controls/Maps/src/PublicAPI/net-android/PublicAPI.Unshipped.txt +++ b/src/Controls/Maps/src/PublicAPI/net-android/PublicAPI.Unshipped.txt @@ -12,6 +12,7 @@ Microsoft.Maui.Controls.Maps.Map.IsClusteringEnabled.get -> bool Microsoft.Maui.Controls.Maps.Map.IsClusteringEnabled.set -> void Microsoft.Maui.Controls.Maps.Map.LastUserLocation.get -> Microsoft.Maui.Devices.Sensors.Location? Microsoft.Maui.Controls.Maps.Map.MapLongClicked -> System.EventHandler? +Microsoft.Maui.Controls.Maps.Map.MoveToRegion(Microsoft.Maui.Maps.MapSpan! mapSpan, bool animated) -> void Microsoft.Maui.Controls.Maps.Map.Region.get -> Microsoft.Maui.Maps.MapSpan? Microsoft.Maui.Controls.Maps.Map.Region.set -> void Microsoft.Maui.Controls.Maps.Map.UserLocationChanged -> System.EventHandler? diff --git a/src/Controls/Maps/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt b/src/Controls/Maps/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt index 902063dc66be..5bfc62325a6a 100644 --- a/src/Controls/Maps/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt +++ b/src/Controls/Maps/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt @@ -12,6 +12,7 @@ Microsoft.Maui.Controls.Maps.Map.IsClusteringEnabled.get -> bool Microsoft.Maui.Controls.Maps.Map.IsClusteringEnabled.set -> void Microsoft.Maui.Controls.Maps.Map.LastUserLocation.get -> Microsoft.Maui.Devices.Sensors.Location? Microsoft.Maui.Controls.Maps.Map.MapLongClicked -> System.EventHandler? +Microsoft.Maui.Controls.Maps.Map.MoveToRegion(Microsoft.Maui.Maps.MapSpan! mapSpan, bool animated) -> void Microsoft.Maui.Controls.Maps.Map.Region.get -> Microsoft.Maui.Maps.MapSpan? Microsoft.Maui.Controls.Maps.Map.Region.set -> void Microsoft.Maui.Controls.Maps.Map.UserLocationChanged -> System.EventHandler? diff --git a/src/Controls/Maps/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt b/src/Controls/Maps/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt index 902063dc66be..5bfc62325a6a 100644 --- a/src/Controls/Maps/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt +++ b/src/Controls/Maps/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt @@ -12,6 +12,7 @@ Microsoft.Maui.Controls.Maps.Map.IsClusteringEnabled.get -> bool Microsoft.Maui.Controls.Maps.Map.IsClusteringEnabled.set -> void Microsoft.Maui.Controls.Maps.Map.LastUserLocation.get -> Microsoft.Maui.Devices.Sensors.Location? Microsoft.Maui.Controls.Maps.Map.MapLongClicked -> System.EventHandler? +Microsoft.Maui.Controls.Maps.Map.MoveToRegion(Microsoft.Maui.Maps.MapSpan! mapSpan, bool animated) -> void Microsoft.Maui.Controls.Maps.Map.Region.get -> Microsoft.Maui.Maps.MapSpan? Microsoft.Maui.Controls.Maps.Map.Region.set -> void Microsoft.Maui.Controls.Maps.Map.UserLocationChanged -> System.EventHandler? diff --git a/src/Controls/Maps/src/PublicAPI/net-tizen/PublicAPI.Unshipped.txt b/src/Controls/Maps/src/PublicAPI/net-tizen/PublicAPI.Unshipped.txt index 902063dc66be..5bfc62325a6a 100644 --- a/src/Controls/Maps/src/PublicAPI/net-tizen/PublicAPI.Unshipped.txt +++ b/src/Controls/Maps/src/PublicAPI/net-tizen/PublicAPI.Unshipped.txt @@ -12,6 +12,7 @@ Microsoft.Maui.Controls.Maps.Map.IsClusteringEnabled.get -> bool Microsoft.Maui.Controls.Maps.Map.IsClusteringEnabled.set -> void Microsoft.Maui.Controls.Maps.Map.LastUserLocation.get -> Microsoft.Maui.Devices.Sensors.Location? Microsoft.Maui.Controls.Maps.Map.MapLongClicked -> System.EventHandler? +Microsoft.Maui.Controls.Maps.Map.MoveToRegion(Microsoft.Maui.Maps.MapSpan! mapSpan, bool animated) -> void Microsoft.Maui.Controls.Maps.Map.Region.get -> Microsoft.Maui.Maps.MapSpan? Microsoft.Maui.Controls.Maps.Map.Region.set -> void Microsoft.Maui.Controls.Maps.Map.UserLocationChanged -> System.EventHandler? diff --git a/src/Controls/Maps/src/PublicAPI/net-windows/PublicAPI.Unshipped.txt b/src/Controls/Maps/src/PublicAPI/net-windows/PublicAPI.Unshipped.txt index 902063dc66be..5bfc62325a6a 100644 --- a/src/Controls/Maps/src/PublicAPI/net-windows/PublicAPI.Unshipped.txt +++ b/src/Controls/Maps/src/PublicAPI/net-windows/PublicAPI.Unshipped.txt @@ -12,6 +12,7 @@ Microsoft.Maui.Controls.Maps.Map.IsClusteringEnabled.get -> bool Microsoft.Maui.Controls.Maps.Map.IsClusteringEnabled.set -> void Microsoft.Maui.Controls.Maps.Map.LastUserLocation.get -> Microsoft.Maui.Devices.Sensors.Location? Microsoft.Maui.Controls.Maps.Map.MapLongClicked -> System.EventHandler? +Microsoft.Maui.Controls.Maps.Map.MoveToRegion(Microsoft.Maui.Maps.MapSpan! mapSpan, bool animated) -> void Microsoft.Maui.Controls.Maps.Map.Region.get -> Microsoft.Maui.Maps.MapSpan? Microsoft.Maui.Controls.Maps.Map.Region.set -> void Microsoft.Maui.Controls.Maps.Map.UserLocationChanged -> System.EventHandler? diff --git a/src/Controls/Maps/src/PublicAPI/net/PublicAPI.Unshipped.txt b/src/Controls/Maps/src/PublicAPI/net/PublicAPI.Unshipped.txt index 902063dc66be..5bfc62325a6a 100644 --- a/src/Controls/Maps/src/PublicAPI/net/PublicAPI.Unshipped.txt +++ b/src/Controls/Maps/src/PublicAPI/net/PublicAPI.Unshipped.txt @@ -12,6 +12,7 @@ Microsoft.Maui.Controls.Maps.Map.IsClusteringEnabled.get -> bool Microsoft.Maui.Controls.Maps.Map.IsClusteringEnabled.set -> void Microsoft.Maui.Controls.Maps.Map.LastUserLocation.get -> Microsoft.Maui.Devices.Sensors.Location? Microsoft.Maui.Controls.Maps.Map.MapLongClicked -> System.EventHandler? +Microsoft.Maui.Controls.Maps.Map.MoveToRegion(Microsoft.Maui.Maps.MapSpan! mapSpan, bool animated) -> void Microsoft.Maui.Controls.Maps.Map.Region.get -> Microsoft.Maui.Maps.MapSpan? Microsoft.Maui.Controls.Maps.Map.Region.set -> void Microsoft.Maui.Controls.Maps.Map.UserLocationChanged -> System.EventHandler? diff --git a/src/Controls/Maps/src/PublicAPI/netstandard/PublicAPI.Unshipped.txt b/src/Controls/Maps/src/PublicAPI/netstandard/PublicAPI.Unshipped.txt index 902063dc66be..5bfc62325a6a 100644 --- a/src/Controls/Maps/src/PublicAPI/netstandard/PublicAPI.Unshipped.txt +++ b/src/Controls/Maps/src/PublicAPI/netstandard/PublicAPI.Unshipped.txt @@ -12,6 +12,7 @@ Microsoft.Maui.Controls.Maps.Map.IsClusteringEnabled.get -> bool Microsoft.Maui.Controls.Maps.Map.IsClusteringEnabled.set -> void Microsoft.Maui.Controls.Maps.Map.LastUserLocation.get -> Microsoft.Maui.Devices.Sensors.Location? Microsoft.Maui.Controls.Maps.Map.MapLongClicked -> System.EventHandler? +Microsoft.Maui.Controls.Maps.Map.MoveToRegion(Microsoft.Maui.Maps.MapSpan! mapSpan, bool animated) -> void Microsoft.Maui.Controls.Maps.Map.Region.get -> Microsoft.Maui.Maps.MapSpan? Microsoft.Maui.Controls.Maps.Map.Region.set -> void Microsoft.Maui.Controls.Maps.Map.UserLocationChanged -> System.EventHandler? diff --git a/src/Controls/samples/Controls.Sample/Pages/Controls/MapsGalleries/CameraZoomGallery.xaml b/src/Controls/samples/Controls.Sample/Pages/Controls/MapsGalleries/CameraZoomGallery.xaml new file mode 100644 index 000000000000..53577c5f628a --- /dev/null +++ b/src/Controls/samples/Controls.Sample/Pages/Controls/MapsGalleries/CameraZoomGallery.xaml @@ -0,0 +1,17 @@ + + + + +