diff --git a/app/lib/widgets/choropleth_map.dart b/app/lib/widgets/choropleth_map.dart index b9a4ffbdd68d4a66dd2dd22486b561f770308962..2946b7a51c30fd72b6fc395d0ef8d24bc2b2ec8a 100644 --- a/app/lib/widgets/choropleth_map.dart +++ b/app/lib/widgets/choropleth_map.dart @@ -38,9 +38,11 @@ class ChoroplethMapState extends State<ChoroplethMap> { _initDataSource(); } + /// Resets the map zoom level void resetZoom() { setState(() { _zoomPanBehavior.zoomLevel = 1; + _choroplethMapKey.currentState?.resetZoom(); }); } diff --git a/app/lib/widgets/main_layout.dart b/app/lib/widgets/main_layout.dart index e26e12553940d8aacf051d5af1be4f336a656ab3..2d451f7c6349135383e4561eb72b7c6227510543 100644 --- a/app/lib/widgets/main_layout.dart +++ b/app/lib/widgets/main_layout.dart @@ -77,13 +77,6 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { }); } - /// Reset the map zoom and centering - void resetZoom() { - setState(() { - _choroplethMapKey.currentState?.resetZoom(); - }); - } - @override Widget build(BuildContext context) { // Initialise selectedMarker to first element in markerList @@ -248,8 +241,8 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { onTapUp: (_) { setState(() { centerMap = false; + _choroplethMapKey.currentState?.resetZoom(); }); - resetZoom(); // Reset the map zoom }, onTapCancel: () { setState(() {