BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Howdy,
How can I achieve that when the user presses the "reset" button in maps toolbar the maps center on MapsCenterPosition with the initial ZoomFactor ?
I draw a geoshape (MapsLayer ShapeData) on the maps, I then compute the center points of the shape and set the MapsCenterPosition to it. Is there a way to zoom the map to fit the whole shape automatically? Or how am I supposed to compute the ZoomFactor to fit the shape?
Thanks, Sergio
Hi Sergio,
Please find the details for your queries from the below table.
Queries |
Details |
|
How can I achieve that when the user presses the "reset" button in maps toolbar the maps center on MapsCenterPosition with the initial ZoomFactor? |
To achieve your scenario, you can set the initial zoom factor in the "MinZoom" property of the "MapsZoomSettings" tag in the Maps component. Meanwhile, when we click on the reset button in the zoom toolbar of the Maps, "OnZoom" event will be triggered. In this event, "Scale" property of the event argument will be returned as "1". At that instance, you can call the "ZoomByPosition" method to reset the Maps to its initial center position with the initial zoom factor. Please find the code snippet for the same below.
Code Snippet:
You can find the sample and video from the below link. Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/ResetMaps587227249 Video: https://www.syncfusion.com/downloads/support/directtrac/general/ze/minzoom-1975847347 |
|
I draw a geoshape (MapsLayer ShapeData) on the maps, I then compute the center points of the shape and set the MapsCenterPosition to it. Is there a way to zoom the map to fit the whole shape automatically? Or how am I supposed to compute the ZoomFactor to fit the shape? |
We do not support to zoom the Maps to fit an entire shape. However, you can achieve this by obtaining the minimum and maximum latitude and longitude of the shape and passing it to the "ZoomToCoordinates" method of the Maps component. Now, the Maps will be zoomed to fit the shape.
You can find the sample from the below link. Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/MapsZoomtoCoordinates2087792284
Please find the documentation link below to know more about the "ZoomToCoordinates" method. https://blazor.syncfusion.com/documentation/maps/maps-method#zoomtocoordinates
However, currently we are facing an issue with the zoom factor calculation in this method. We are currently working to improve the zoom factor from this method to fit the shape. The fix will be available in our 2023 Volume 1 release. Please find the feedback link below to keep track of this issue.
|
Please let us know if the above sample meets
your requirement and let us know if you need any further assistance.
Hi Sergio,
Sorry for the inconvenience.
We have not included the fix for the reported issue in our 2023 Volume 1 release. However, the fix will be included in our next weekly patch release, which is expected to be available by the first week of April 2023.
Hi Indumathi,
Is the patch released yet?
Hi Sergio,
We have fixed the reported issue - “When the bound of the Maps is set as parameter to ‘ZoomToCoordinates’ method, position of the map is improper” and the fix is included in our latest weekly patch release (v21.1.41). Please update the “Syncfusion.Blazor.Maps” package to the latest version in your application to resolve the reported issue. Please find the package link below.