Programmatically changing zoomLevel and focalLatLng from MapZoomPanBehavior causes animation errors

Hi,

I need to change the zoomlevel and the focalLatLng at the same time, but the animation will show very weird and stuttering/laggy/janky.
I created an example so you can see what I'm trying to do: https://pastebin.com/Rn1q8mER
Also I noticed some weird animation affects when the zoomlevel is to low, for example 3.

See video: https://streamable.com/h9i2xs

Would be nice if somehow these two animations would blend in together, or would be fired one after the other to prevent this behaviour.

Lastly I'm also looking for a way to control the time length of the animation, I haven't found a way to control this so far.

Kind regards, Tim.





5 Replies 1 reply marked as answer

LR Lakshmi Radha Krishnan Syncfusion Team April 28, 2021 01:51 PM UTC

Hi Tim,

Regarding the animation lagging in the shape layer, we have already reported this issue to the framework and we are yet to get an update from them. We will be able to provide a solution for this once this issue is fixed from the framework side.

https://github.com/flutter/flutter/issues/72718

For your expected interaction behavior, will tile layer work?

https://flutter.syncfusion.com/#/maps/tile-layer/polylines

Regarding "control the time of the animation", we have done the internal calculation for the duration which will vary depends on the distance between the current location and next location. That means, if the distance is smaller, the duration will be smaller and vice versa. If you still need to customize this, please provide more information about this requirement which will be helpful to check on this further.

Regards,

Lakshmi R.



TI Tim April 29, 2021 11:16 AM UTC

Hi, 

Thanks for your answer.
I was looking through the github isseu and see that it's already an issue for 4 months.
Also I noticed that people named the fact that it was a big map the reason for the animation performance, but I also have it with very small maps like a country such as the Netherlands (haven't tested other maps yet)
I was thinking myself about a possible patch, but I don't know if you guys agree with it.

I can see for both panning and zooming a current duration is set for 650milliseconds
_state.focalLatLngAnimationController.duration =
const Duration(milliseconds: 650);

  1. Set a timestamp for both last zoom action of zoomlevel and panning:  Datetime lastZoomAction = DateTime.now().millisecondsSinceEpoch - Datetime lastPanAction = DateTime.now().millisecondsSinceEpoch 
  2. In both methods _handleFocalLatLngChange and _handleZoomLevelChange and check if the other one is animating with the existing check: _state.focalLatLngAnimationController.isAnimating and _state.zoomLevelAnimationController.isAnimating
  3. Check if the current time DateTime.now().millisecondsSinceEpoch is still lower than lastZoomAction or lastPanAction and wait the remaining difference in microseconds like: sleep(Duration(milliseconds: remainingMicroseconds))
This way you can sequence the animations and hopefully it look's sort of smooth.

The other thing I was talking about was not really the speed, but the animation time itself.
It looks like both are set in the _handle methods

/lib/src/layer/shape_layer.dart:4309 
_state.zoomLevelAnimationController.duration =
const Duration(milliseconds: 650);
/lib/src/layer/shape_layer.dart:4441

_state.focalLatLngAnimationController.duration =
const Duration(milliseconds: 650);
It would be nice if you can set these params in the MapZoomPanBehavior like:
Params are in microseconds
MapZoomPanBehavior(
focalLatLngAnimationDuration: 500,
zoomLevelAnimationDuraction: 500
)



LR Lakshmi Radha Krishnan Syncfusion Team April 30, 2021 01:49 PM UTC

Hi Tim,

Though we are not able to fix the performance issue in the larger sized maps due to the bug we mentioned in the framework, we will improve the animation behavior and include this in the weekly release which is scheduled on May 11, 2021.

Regarding customization option for the animation duration, we have logged an improvement for this and it will be available in any of our upcoming releases.

Feedback: https://www.syncfusion.com/feedback/24912/provide-an-option-to-customize-the-animation-duration-while-changing-zooming-and

Regards,

Lakshmi R.



LR Lakshmi Radha Krishnan Syncfusion Team May 12, 2021 09:08 AM UTC

Hi Tim,  

As we promised earlier, we have included the animation improvement in the Vol1 SP release which is expected to be rolled out by today (May 12, 2021). We will inform you once it is rolled out. Kindly check and get back to us if you have any concerns.  

Regards,  
Lakshmi R.  



LR Lakshmi Radha Krishnan Syncfusion Team May 13, 2021 11:30 AM UTC

Hi Tim,

 

We are glad to announce that our Essential Studio 2021 Volume 1 Service pack release v19.1.0.63 is rolled out and is available for download under the following link. The mentioned animation improvement is included in this release. 

 

Essential Studio 2021 Volume 1 Service Pack Release v19.1.0.63 is available for download | General Discussion Forums | Syncfusion

 

We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.

 

Regards,

Lakshmi R.


Marked as answer
Loader.
Up arrow icon