New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS/Android] Move Map camera to correct region on layout change #548

Merged
merged 2 commits into from Jan 3, 2017

Conversation

Projects
None yet
5 participants
@adrianknight89
Contributor

adrianknight89 commented Nov 18, 2016

Description of Change

Move to correct region when Map control changes layout. Ref #172.

The repro attached to the bug has two maps in a vertical StackLayout. The second one is invisible on load and made visible on button click. Both maps should have the same camera view when visible; however, the first one is not re-adjusting its view region when control layout changes.

@rmarinho I don't believe checking visibility change on the second map on iOS is the right approach. For now, I removed it. I also ran Bugzilla38284 on Android device and confirmed that it's not working as it is.

Bugs Fixed

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard
  • Consolidate commits as makes sense
@rmarinho

This comment has been minimized.

Show comment
Hide comment
@rmarinho

rmarinho Dec 17, 2016

Member

needs rebase

Member

rmarinho commented Dec 17, 2016

needs rebase

@adrianknight89

This comment has been minimized.

Show comment
Hide comment
@adrianknight89

adrianknight89 Dec 17, 2016

Contributor

Done.

Contributor

adrianknight89 commented Dec 17, 2016

Done.

@rmarinho

This comment has been minimized.

Show comment
Hide comment
@rmarinho

rmarinho Dec 18, 2016

Member

@adrianknight89 build is failing
\Bugzilla35736.cs(6, 33): error CS1002: ; expected

Member

rmarinho commented Dec 18, 2016

@adrianknight89 build is failing
\Bugzilla35736.cs(6, 33): error CS1002: ; expected

@adrianknight89

This comment has been minimized.

Show comment
Hide comment
@adrianknight89

adrianknight89 Dec 18, 2016

Contributor

I have not touched that file, so why is it failing?

Contributor

adrianknight89 commented Dec 18, 2016

I have not touched that file, so why is it failing?

@rmarinho

This comment has been minimized.

Show comment
Hide comment
@rmarinho

rmarinho Jan 3, 2017

Member

GalleryTest failure is normal.

Member

rmarinho commented Jan 3, 2017

GalleryTest failure is normal.

@rmarinho rmarinho merged commit f003cfd into xamarin:master Jan 3, 2017

5 of 6 checks passed

iOS10-UITests-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: UI Tests :: OSX Test Cloud Package - Run iOS Unified iOS10 : Tests failed: 1,…
Details
Android-UITests-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: UI Tests :: OSX Test Cloud Package - Run Android 6.0.1 : Tests passed: 351, i…
Details
OSX-Debug-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: OSX Debug : Running
Details
Windows-Debug-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: Windows Debug : Tests passed: 3685, ignored: 10
Details
iOS8-UITests-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: UI Tests :: OSX Test Cloud Package - Run iOS Unified IOS8 : Tests passed: 344…
Details
iOS9-UITests-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: UI Tests :: OSX Test Cloud Package - Run iOS Unified iOS9 : Tests passed: 346…
Details

rookiejava added a commit to rookiejava/Xamarin.Forms that referenced this pull request Jan 9, 2017

[iOS/Android] Move Map camera to correct region on layout change (#548)
* Move to region on layout change

* remove visibility check

rmarinho added a commit that referenced this pull request Feb 2, 2017

Add pressed and released events to Button (#446)
* Add pressed and released events to Button

* Update ButtonRenderer.cs

* Apply safely casting to android button renderer

* Use safety casting for Android buttin renderer

* [Windows] Fix modal pages being laid out below soft buttons (#395)

* Add sample HanselForms and TwitterDemo to ControlGallery (#651)

* [Controls] Add Hanselforms sample

* Remove extra twitter sample

* [Controls]Add TwitterDemo sample

* [Controls] Fix build

* Slider should show user-set value on initial load (#378)

* [UWP] Use toolbar foreground color on primary items (#640)

* Avoid duplicating code in OmPlatform (#591)

* [iOS] Entry should not pass a newline to the next responder (#397)

* UITextField should not return so that the next field does not get passed a newline

* Added code sample

* [XamlC] import members on x:Static and factories (#642)

* [Xaml] support short Properties for PropertyCondition (#645)

* Xamlc compile data triggers (#648)

* [Xaml] DataTrigger and PropertyCondition no longer use a ServiceProvider

* [XamlC] avoid generating ServiceProvider for unused ProvideValue

* fix tests

* Fix comment typo

* [UWP] Fix TextBox style for foreground focus color (#618)

* Adding image to use for CellsGalleryImageUrlCellList UI test

* Update ImageCellListPage to use an image we control;
Update CellsGalleryImageUrlCellList test to wait longer than 1s for images
to load if necessary

* fix nre when changing content in datepickerselected (#494)

* Make CellsGalleryImageUrlCellList test finish early if possible

* [iOS] Change keyboard type while keyboard is visible (#443)

* Change keyboard while changing text

* add sample code

* [Android] Fix NavigationPage dispose crash when it parents a MasterDetailPage (#577)

* fix navigation page dispose crash

* changes after review

* [XamlC] detect duplicate x:Name at compile time (#655)

* [XamlC] detect duplicate x:Name at compile time

* invoking methods with the right arguments produces better results

* Make UWP toolbar display rules consistent with other platforms (#638)

* Allow subscriber to be collected if MessagingCenter is the only reference to it (#617)

* Repro

* Make messaging center callbacks weak references

* Preserve attribute

* Fix test method name

* Watch for collection of actual delegate target instead of wrapper delegate

* Preserve the original platform instance when changing main page

* Better tests for lambda situations

* Update tests, make callback target a weakreference if it's the subscriber

* Ensure old Platform MessagingCenter subs are gone before creating new Platform

* [iOS] Prevent multiple ListView cells from being swiped simultaneously (#578)

* disable multiple cell swipe

* add sample code

* refactored

* convert to weakreference

* remove null setting

* change weakreference setting place

* remove if

* revert isopen changes

* add instructions

* [WinRT/UWP] Apply BackgroundColor to Stepper buttons (#581)

* [WinRT/UWP] Apply BackgroundColor to Stepper buttons

* Add explanatory text; use nameof

* Move explanatory text to a label

* Return group instead of internal class (#461)

* [iOS/Android] Move Map camera to correct region on layout change (#548)

* Move to region on layout change

* remove visibility check

* [iOS] Platform specifics for controlling Picker SelectedIndex change behavior (#540)

* picker selected index could change when picker view is dismissed

* use enum

* [iOS] Ignore intermittent failing test on XTC (#666)

* [UITest] Update to UITest 2.0.5 (#665)

* Rebase the current branch onto upstream latest
@suggyd

This comment has been minimized.

Show comment
Hide comment
@suggyd

suggyd Nov 14, 2017

It might be only me but I don't feel like using the Element.LastMoveToRegion in this way gives the correct behaviour in all cases because this is only set by calls to Map.MoveToRegion(..) and not when the user interacts with the map. For example on iOS changing the device orientation triggers Height changes and resets the map view, which is frustrating for users if they have panned or zoomed. On android anything that triggers OnLayout also resets the view. The LastMoveToRegion in many cases is an fairly arbitrary starting point, e.g. the current users location, when the map is first shown. On iOS when the device is rotated I would expect the map to stay centered on the same point at the same zoom level. On Android if the map is resized I would also expect the map to be centered and zoomed as I left it.

suggyd commented Nov 14, 2017

It might be only me but I don't feel like using the Element.LastMoveToRegion in this way gives the correct behaviour in all cases because this is only set by calls to Map.MoveToRegion(..) and not when the user interacts with the map. For example on iOS changing the device orientation triggers Height changes and resets the map view, which is frustrating for users if they have panned or zoomed. On android anything that triggers OnLayout also resets the view. The LastMoveToRegion in many cases is an fairly arbitrary starting point, e.g. the current users location, when the map is first shown. On iOS when the device is rotated I would expect the map to stay centered on the same point at the same zoom level. On Android if the map is resized I would also expect the map to be centered and zoomed as I left it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment