在gmaps4rails中,如何移动地图以使标记处于可见状态? [英] In gmaps4rails, how do I move the map so the marker is in view?
本文介绍了在gmaps4rails中,如何移动地图以使标记处于可见状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过ajax调用分别设置一组位置,其中一些不在地图的当前范围内.有没有一种方法可以移动地图,从而使标记处于可见状态?
I have a set of locations that I want to bring up, individually through ajax calls, and some of them aren't within the current bounds of the map. Is there a way to move the map so the marker is in view?
我不需要它在中心,只要它在视野中即可.
I don't need it to be in the center, just as long as it's in view.
推荐答案
Jim张贴答案时可能是正确的.但是到目前为止,正确的方法是:
Jim's answer was probably right when he posted it. But as of now the right way to do it would be :
var centerpoint = new google.maps.LatLng(lat_value, long_value);
Gmaps.map.map.setCenter(centerpoint);
这篇关于在gmaps4rails中,如何移动地图以使标记处于可见状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文