Proper centering for all node sheets. still jumps between tags and edit.

This commit is contained in:
stopflock
2025-10-01 12:34:02 -05:00
parent adec4b175f
commit 96b82ef416
3 changed files with 66 additions and 19 deletions
+5 -10
View File
@@ -35,11 +35,13 @@ class MapView extends StatefulWidget {
required this.followMeMode,
required this.onUserGesture,
this.sheetHeight = 0.0,
this.onNodeTap,
});
final FollowMeMode followMeMode;
final VoidCallback onUserGesture;
final double sheetHeight;
final void Function(OsmNode)? onNodeTap;
@override
State<MapView> createState() => MapViewState();
@@ -308,16 +310,8 @@ class MapViewState extends State<MapView> {
} catch (_) {/* controller not ready yet */}
}
// For edit sessions, center the map on the camera being edited initially
if (editSession != null && _controller.mapController.camera.center != editSession.target) {
WidgetsBinding.instance.addPostFrameCallback(
(_) {
try {
_controller.mapController.move(editSession.target, _controller.mapController.camera.zoom);
} catch (_) {/* controller not ready yet */}
},
);
}
// Edit sessions don't need to center - we're already centered from the node tap
// SheetAwareMap handles the visual positioning
// Fetch cached cameras for current map bounds (using Consumer so overlays redraw instantly)
Widget cameraLayers = Consumer<CameraProviderWithCache>(
@@ -336,6 +330,7 @@ class MapViewState extends State<MapView> {
cameras: cameras,
mapController: _controller.mapController,
userLocation: _gpsController.currentLocation,
onNodeTap: widget.onNodeTap,
);
// Get current zoom level for direction cones