Simultaneous animations for smoothness

This commit is contained in:
stopflock
2025-10-01 13:45:23 -05:00
parent 322b9fae62
commit b440629ad6
3 changed files with 21 additions and 5 deletions

View File

@@ -36,10 +36,10 @@ const double kAddPinYOffset = 0.0;
// Client name and version for OSM uploads ("created_by" tag)
const String kClientName = 'DeFlock';
const String kClientVersion = '0.9.15';
const String kClientVersion = '0.9.16';
// Development/testing features - set to false for production builds
const bool kEnableDevelopmentModes = false; // Set to false to hide sandbox/simulate modes and force production mode
const bool kEnableDevelopmentModes = true; // Set to false to hide sandbox/simulate modes and force production mode
// Marker/node interaction
const int kCameraMinZoomLevel = 10; // Minimum zoom to show nodes (Overpass)

View File

@@ -165,6 +165,24 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
_selectedNodeId = node.id; // Track selected node for highlighting
});
// Start smooth centering animation simultaneously with sheet opening
// Use the same duration as SheetAwareMap (300ms) for coordinated animation
try {
_mapController.animateTo(
dest: node.coord,
zoom: _mapController.mapController.camera.zoom,
duration: const Duration(milliseconds: 300),
curve: Curves.easeOut,
);
} catch (_) {
// Map controller not ready, fallback to immediate move
try {
_mapController.mapController.move(node.coord, _mapController.mapController.camera.zoom);
} catch (_) {
// Controller really not ready, skip centering
}
}
final controller = _scaffoldKey.currentState!.showBottomSheet(
(ctx) => MeasuredSheet(
onHeightChanged: (height) {

View File

@@ -32,9 +32,7 @@ class _CameraMapMarkerState extends State<CameraMapMarker> {
void _onTap() {
_tapTimer = Timer(tapTimeout, () {
// Center on the node when opening the tag sheet
// This prevents jumping when transitioning to edit mode
widget.mapController.move(widget.node.coord, widget.mapController.camera.zoom);
// Don't center immediately - let the sheet opening handle the coordinated animation
// Use callback if provided, otherwise fallback to direct modal
if (widget.onNodeTap != null) {