Compare commits
No commits in common. "4c8815f7cfdb40307d81e61645db75d7b9c3a1cb" and "3feefd128d40f19a30d15bde6375814529a854d9" have entirely different histories.
4c8815f7cf
...
3feefd128d
1 changed files with 1 additions and 10 deletions
|
|
@ -42,18 +42,9 @@ class _MapScreenState extends ConsumerState<MapScreen> {
|
|||
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<MapState>(mapProvider, (previous, next) {
|
||||
if (previous?.center != next.center || previous?.zoom != next.zoom) {
|
||||
final camera = _mapController.camera;
|
||||
if (camera.center != next.center || camera.zoom != next.zoom) {
|
||||
_mapController.move(next.center, next.zoom);
|
||||
}
|
||||
_mapController.move(next.center, next.zoom);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue