[iOS/Android] Move Map camera to correct region on layout change (#548)
authoradrianknight89 <adrianknight89@outlook.com>
Tue, 3 Jan 2017 11:35:54 +0000 (05:35 -0600)
committerRui Marinho <me@ruimarinho.net>
Tue, 3 Jan 2017 11:35:54 +0000 (11:35 +0000)
* Move to region on layout change

* remove visibility check

Xamarin.Forms.Maps.Android/MapRenderer.cs
Xamarin.Forms.Maps.iOS/MapRenderer.cs

index f83b6fa..3316faa 100644 (file)
@@ -186,6 +186,7 @@ namespace Xamarin.Forms.Maps.Android
                        else if (changed)
                        {
                                UpdateVisibleRegion(NativeMap.CameraPosition.Target);
+                               MoveToRegion(Element.LastMoveToRegion, false);
                        }
                }
 
index 3f4e7eb..af1f080 100644 (file)
@@ -190,7 +190,7 @@ namespace Xamarin.Forms.Maps.iOS
                                UpdateHasScrollEnabled();
                        else if (e.PropertyName == Map.HasZoomEnabledProperty.PropertyName)
                                UpdateHasZoomEnabled();
-                       else if (e.PropertyName == VisualElement.IsVisibleProperty.PropertyName && ((Map)Element).LastMoveToRegion != null)
+                       else if (e.PropertyName == VisualElement.HeightProperty.PropertyName && ((Map)Element).LastMoveToRegion != null)
                                _shouldUpdateRegion = true;
                }