尝试使用custom时,我对gmaps4rails(2.1.2)有问题marker.picture
。
这段代码可以完美地工作:
显示常规的GoogleMaps Pin(红色)。如果单击“固定”,则会打开“信息窗口”。
@hash = Gmaps4rails.build_markers(@nearbys) do |location, marker|
marker.title location[:name]
marker.lat location[:coordinates].y
marker.lng location[:coordinates].x
marker.json({title: location[:name]})
end
当我添加marker.picture
图像时,将显示该图像。但是它不再可单击。
@hash = Gmaps4rails.build_markers(@nearbys) do |location, marker|
marker.title location[:name]
marker.lat location[:coordinates].y
marker.lng location[:coordinates].x
marker.json({title: location[:name]})
marker.picture({
marker_anchor: [40, 58], # added this optionally <- doesn't work either
url: "#{view_context.image_path("map/icons/3dmarker.png") }",
width: "44",
height: "58"
})
end
有什么建议我做错了吗?
先感谢您
几件事:
我怀疑您是否有任何信息窗口在工作:您没有传递数据来创建它(marker.infowindow
),所以不会创建它
替换marker_anchor
为anchor
这样做marker.title location[:name]
是一样的,marker.json({title: location[:name]})
所以你有太多
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句