Search code examples
ruby-on-railsrubyruby-on-rails-3google-mapsgmaps4rails

How to set an offset for a RichMarker?


Failed enough to ask another question: Using

  • gmaps4rails v0.11.1 - great gem!
  • RichMarker

Managed to make markers flat using :marker_anchor => [10, true]

But i have an arrow on the bottom of the marker, so how to set an offset for a marker`s html(RichMarker) to be placed?

Now it is done by setting a css offset for a div in the richmarker html. But that seems kind a wierd.

Is it possible to set an offset using Gmaps4rails methods?


Solution

  • Have a look at the wiki in the markers section:

    "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 
    

    So basically, the first element of 'marker_anchor => [10, true]' represents the offset.

    Have a look at the link I provide: Richmarker's offset aren't expressed with pixels but are integers meaning TOP_LEFT etc...

    If you desire precise offset, keep your css!