fit map bug behoben fuer plan modus
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
|
||||
import '../../domain/waypoint/flat_waypoint_list.dart';
|
||||
import 'current_mission_provider.dart';
|
||||
@@ -99,16 +96,12 @@ class CurrentMissionMetaNotifier extends Notifier<MissionMeta> {
|
||||
/// bliebe die Kamera an der zuletzt betrachteten Stelle stehen, waehrend
|
||||
/// eine voellig andernorts gelegene Mission angezeigt wird. Analog
|
||||
/// fitToWaypoints() im HTML-Demonstrator bzw. _onFitPressed() in
|
||||
/// MapSearchControls, hier aber automatisch statt nutzerausgeloest.
|
||||
/// MapSearchControls, hier aber automatisch statt nutzerausgeloest -
|
||||
/// nutzt dieselbe Padding-Logik wie der manuelle Fit-Button
|
||||
/// (fitMapControllerToWaypoints), damit beide nicht wieder auseinander-
|
||||
/// laufen koennen.
|
||||
void _fitMapToWaypoints(List<Waypoint> waypoints) {
|
||||
if (waypoints.isEmpty) return;
|
||||
final points = [for (final w in waypoints) LatLng(w.lat, w.lon)];
|
||||
ref.read(mapControllerProvider).fitCamera(
|
||||
CameraFit.bounds(
|
||||
bounds: LatLngBounds.fromPoints(points),
|
||||
padding: const EdgeInsets.fromLTRB(50, 50, 50, 140),
|
||||
),
|
||||
);
|
||||
fitMapControllerToWaypoints(ref.read(mapControllerProvider), waypoints);
|
||||
}
|
||||
|
||||
/// Benennt eine gespeicherte Mission um (Doku 3.6: nur ueber die
|
||||
|
||||
Reference in New Issue
Block a user