We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

the map goes crazy when i zoom

Hello everyone, I'm having problems with sfmaps, what happens is that when I zoom in and zoom out if I scroll the screen while the map is loading, the map gets out of control and jumps to a distant location. I have tried many things but I have not been able to solve this error, I even tried to use onWillZoom to deactivate the panning, wait for the map to finish loading and reactivate the panning but still the error continues. Does anyone have any idea what is going on and how I can fix it?, the problem is in android


here is my code:

import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_maps/maps.dart';


void main() {
return runApp(MapsApp());
}


/// This widget will be the root of application.
class MapsApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: 'Maps Demo',
home: MyHomePage(),
);
}
}


/// This widget is the home page of the application.
class MyHomePage extends StatefulWidget {
/// Initialize the instance of the [MyHomePage] class.
const MyHomePage({Key? key}) : super(key: key);


@override
State<MyHomePage> createState() => _MyHomePageState();
}


class _MyHomePageState extends State<MyHomePage> {
_MyHomePageState();


bool _onZoom = false;


late MapTileLayerController _mapController;
late MapZoomPanBehavior _zoomPanBehavior;
@override




void recurrentPanningControl() async{
if ( _onZoom ){
print('Esperando reconstrucción del mapa');
await Future.delayed(const Duration(seconds: 2));
_zoomPanBehavior.enablePanning = true;
_onZoom = false;
setState(() {});
recurrentPanningControl();


} else{
print('Ejecutando');
await Future.delayed(const Duration(milliseconds: 100));
recurrentPanningControl();
}
}



@override
void initState() {
super.initState();



_mapController = MapTileLayerController();
_zoomPanBehavior = MapZoomPanBehavior(
//enablePanning: false,
//enablePinching: false,
zoomLevel: 13,
minZoomLevel: 3,
maxZoomLevel: 19,
focalLatLng: const MapLatLng(6.263208604725203, -75.57770846194757),
enableDoubleTapZooming: true,
toolbarSettings: const MapToolbarSettings(direction: Axis.vertical)
);


Future.delayed(const Duration(seconds: 0), () async {
recurrentPanningControl();
});
}


@override
Widget build(BuildContext context) {
return Scaffold(
body: SizedBox(
height: double.infinity,
width: double.infinity,
child: Center(
child: SfMaps(
layers: <MapLayer>[
MapTileLayer(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
zoomPanBehavior: _zoomPanBehavior,
controller: _mapController,
tooltipSettings: const MapTooltipSettings(color: Colors.transparent),
onWillZoom: (MapZoomDetails map){
_zoomPanBehavior.enablePanning = false;
_onZoom = true;
return true;
},
),
],
),
),
),
);
}
}

8 Replies

YG Yuvaraj Gajaraj Syncfusion Team April 3, 2023 01:44 PM UTC

Hi Ricardo,


We have checked your query and the reported issue is getting reproduced at our end. Currently, we are checking for a feasible solution to achieve your requirement. We will check and update the further details tomorrow and we appreciate your patience until then.


Regards,

Yuvaraj.



YG Yuvaraj Gajaraj Syncfusion Team April 4, 2023 03:06 PM UTC

Hi Ricardo,


Unfortunately, we couldn't able to achieve your requirement in a workaround sample. So, currently, we are investigating the root cause for this issue in our source. We will share the detailed information tomorrow and we appreciate your patience until then.


Regards,

Yuvaraj.



RM Ricardo Montoya Lopez April 4, 2023 05:26 PM UTC

I really appreciate the help, take your time, I'll be on the lookout for new



YG Yuvaraj Gajaraj Syncfusion Team April 5, 2023 01:43 PM UTC

Hi Ricardo,


We are able to replicate the reported issue regarding While panning during the fling zooming animation, the tile layer jumps to a distant location at our end, and we have logged a bug report for it in our feedback portal. We will fix and include the changes in our upcoming weekly patch release which is expected to be rolled out in 3rd week of April. We will update you here once the release is rolled out and we appreciate your patience until then. You can also track the status of the bug with the feedback below.


Feedback, https://www.syncfusion.com/feedback/42695


Regards,

Yuvaraj.



LP Lokesh Palani Syncfusion Team April 18, 2023 04:01 PM UTC

Hi Ricardo,


Sorry for the inconvenience. We are facing complexity to fix the issue and cannot include the fix in today’s weekly patch. We are working on this issue with high priority and will include the issue fix in our upcoming weekly patch release it would be expected to be rolled out on 25 April 2023. We will let you know once the release has been rolled out, and we appreciate your patience until then.


Regards,

Lokesh.





RM Ricardo Montoya Lopez April 25, 2023 08:06 PM UTC

Hi Syncfusion Team, thank you for the help, do you know if in this update was solved the problem?



LP Lokesh Palani Syncfusion Team April 26, 2023 06:48 AM UTC

Hi Ricardo,


We have resolved the reported issue While panning during the fling zooming animation, the tile layer jumps to a distant location, but it has been postponed to the SP release, which will be available in the first week of May. We will notify you once the release has been rolled out. We appreciate your patience until then.


Regards,

Lokesh.



LP Lokesh Palani Syncfusion Team May 4, 2023 10:13 AM UTC

Hi Ricardo,


The reported issue regarding While panning during the fling zooming animation, the tile layer jumps to a distant location has been fixed and rolled out in our SP release. Therefore, we kindly request that you upgrade the syncfusion_flutter_maps package to the latest version below to avoid this issue.


Version: https://pub.dev/packages/syncfusion_flutter_maps/versions/21.2.3


Regards,

Lokesh.


Loader.
Live Chat Icon For mobile
Up arrow icon