ruby-on-rails - 如何设置 RichMarker 的偏移量?

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

无法提出另一个问题: 使用

  • gmaps4rails v0.11.1 - 很棒的 gem !
  • RichMarker

使用 :marker_anchor => [10, true] 设法使标记变平

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

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

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

最佳答案

查看 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!

关于ruby-on-rails - 如何设置 RichMarker 的偏移量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7216197/

相关文章:

ruby - 具有 HTTPS、SSL 客户端证书和 Keep-Alive 支持的 Ruby HTTP 库?

ruby-on-rails - 如何在 Rails 中加载 ActiveRecord 但在启动应用程序时跳过连接到数据库

python - 将十六进制字符转换为位串(Python 或 Ruby)

ruby-on-rails - ruby rails : redirect_to not working after create and save

ruby-on-rails-3 - ActiveAdmin 表单不允许批量分配

mysql - 连接表格和 map 显示

ruby-on-rails - 您如何限制对某个网页的访问?

ruby-on-rails - 在 Rails 中提交嵌套表单时出现 500 Internal Server Error

javascript - 如何将javascript变量传递给rails部分 View

ruby-on-rails - 如何处理 Rspec 中的 Mongoid::Errors::DocumentNotFound?