Currently, module only provides options to center and zoom the map with a default, static zoom level, such as 8, 7, 10, etc...
But when there are several Markers or Geometries to be displayed on the map, it is rather hard to know what could be an acceptable level of zooming to be able to display all values in the same Viewport.
For example, if there are 2 or 3 different values displayed with Markers on the Map and a zoom level of 10, then maybe only a single Marker will be visible in Map's Viewport upon loading.
Ideally, it would be great if there could be an option in the Map's display formatter to let the Map dynamically center and adjust the zoom level to show ALL markers and Geometries in Map's Viewport, upon loading.
Baidu Map JS API would seem to provide a method for adjusting the Viewport, see: setViewport, which could probably be used to dynamically Center and Zoom to show all displayed values automatically.
Please let me know if you would have any questions, objections, comments, suggestions, recommendations or concerns on any aspects of feature request, I would be glad to provide more information or explain in more details.
Any questions, feedback, testing, changes, ideas or recommendations would be highly appreciated.
Thanks to all in advance.
Comments
Comment #1
xiukun.zhou commentedQuick follow-up on this feature request:
Modified previous default static zooming method using Baidu Map JS API's
centerAndZoomto also support Automatic zoom and center with the methodsetViewport.If Automatic is selected in the display formatter settings form for the default Zoom level, the Map's Zoom and Center would be automatically adjusted to display all the Markers or Geometries visible in the same Viewport.
This is surely a great improvement and definitely makes the display of the values very clean and convenient.
Even if there is only a single Marker to be displayed, the zoom level will be adjusted to display the location closer, with street names and crossroads much more visible than if there was a default static zoom level defined.
I went ahead and committed the changes against the 7.x-1.x branch at e5d44a4.
I allowed myself to mark this issue as fixed for now, but feel free to re-open it, or post a new ticket, at any time if you have any further objections with this issue or related commit e5d44a4 (we would surely be happy to hear your feedback).
Please let me know if you would have any further comments, feedback, questions, issues, objections, suggestions or concerns on the commit or this feature request in general, I would be glad to provide more information or explain in more details.
Thanks in advance to everyone for your testing, reviews, feedback and comments on this issue.
Cheers!