如何为RichMarker设置偏移量?

时间:2011-08-27 17:37:26

标签: ruby-on-rails ruby ruby-on-rails-3 google-maps gmaps4rails

未能提出另一个问题: 使用

  • gmaps4rails v0.11.1 - 伟大的宝石!
  • RichMarker

使用:marker_anchor => [10, true]

管理标记

但是我在标记的底部有一个箭头,那么如何设置标记html(RichMarker)的偏移量?

现在通过在richmarker html中为div设置css偏移来完成。但这似乎很奇怪。

是否可以使用Gmaps4rails方法设置偏移量?

1 个答案:

答案 0 :(得分:4)

查看标记部分中的wiki:

"rich_marker" =>   ,   # html, facultative
                        # If used, all other attributes skipped except "marker_anchor". This array is used as follows:
                        # [ anchor , flat ] : flat is a boolean, anchor is an int. 
                        # See doc here: http://google-maps-utility-library-v3.googlecode.com/svn/trunk/richmarker/docs/reference.html 

所以基本上,'marker_anchor =>的第一个元素[10,true]'代表偏移。

看看我提供的链接:Richmarker的偏移量不是用像素表示,而是整数意味着TOP_LEFT等...

如果您需要精确的偏移,请保留您的CSS!

相关问题