[英]How to update google map circle through ajax in Gmaps4rails 1.5.6
在我的rails应用程序中,我使用1.5.6版本的gmaps4rails gem。 我想通过ajax更新我的地图圈子属性
任何人都可以建议我这样做的程序吗?
首先,得到你的圈子,应该在Gmaps.map.circles
然后:
circle.serviceObject.setRadius(number)
在ajax的成功函数中,您可以这样编码:
Gmaps.loadMaps()
// if you are using markers
markers_json = JSON.parse(markers)
Gmaps.map.replaceMarkers(markers_json)
// if you are using circle
Gmaps.map.clear_circles()
circle_json = JSON.parse(circle)
Gmaps.map.circles = circle_json
Gmaps.map.create_circles()
谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.