diff --git a/mobile/lib/features/map/presentation/screens/map_screen.dart b/mobile/lib/features/map/presentation/screens/map_screen.dart index ce03ec4..b6ea8a8 100644 --- a/mobile/lib/features/map/presentation/screens/map_screen.dart +++ b/mobile/lib/features/map/presentation/screens/map_screen.dart @@ -42,9 +42,18 @@ class _MapScreenState extends ConsumerState { final styleAsync = ref.watch(mapStyleProvider(apiClient.baseUrl)); // Listen for zoom/center changes from the provider and move the map. + // Skip the move if the map controller is already at the target position + // (meaning the state change came from a user gesture via onPositionChanged). + // Without this guard, every gesture-driven pan calls _mapController.move() + // with the position the map is already at, which triggers a tile + // recalculation that cancels in-flight tile loads and produces a + // partially-rendered (diagonal) map. ref.listen(mapProvider, (previous, next) { if (previous?.center != next.center || previous?.zoom != next.zoom) { - _mapController.move(next.center, next.zoom); + final camera = _mapController.camera; + if (camera.center != next.center || camera.zoom != next.zoom) { + _mapController.move(next.center, next.zoom); + } } });