map: keep rotation when changing layer

This commit is contained in:
Thibault Deckers 2021-10-06 17:29:27 +09:00
parent 51c92fe6ed
commit 10e9caaffe
2 changed files with 3 additions and 1 deletions

View file

@ -171,13 +171,14 @@ class _EntryGoogleMapState extends State<EntryGoogleMap> with WidgetsBindingObse
builder: (context, dotEntry, child) {
return GoogleMap(
initialCameraPosition: CameraPosition(
bearing: -bounds.rotation,
target: _toGoogleLatLng(bounds.center),
zoom: bounds.zoom,
),
onMapCreated: (controller) async {
_googleMapController = controller;
final zoom = await controller.getZoomLevel();
await _updateVisibleRegion(zoom: zoom, rotation: 0);
await _updateVisibleRegion(zoom: zoom, rotation: bounds.rotation);
setState(() {});
},
// compass disabled to use provider agnostic controls

View file

@ -151,6 +151,7 @@ class _EntryLeafletMapState extends State<EntryLeafletMap> with TickerProviderSt
options: MapOptions(
center: bounds.center,
zoom: bounds.zoom,
rotation: bounds.rotation,
minZoom: widget.minZoom,
maxZoom: widget.maxZoom,
// TODO TLAD [map] as of flutter_map v0.14.0, `doubleTapZoom` does not move when zoom is already maximal