Search code examples
google-mapsgoogle-maps-api-3gmaps4rails

Markers icons cropped on zoom Google Maps for Rails (gmaps4rails)


I'm using gmaps4rails to create an application and I'm with one problem. When I zoom (in or out) map the icons are cropped.

Cropped markers

This is my method to show markers:

def gmaps4rails_marker_picture
{
    "picture" => "/assets/pins/pin_#{tipo_assalto_id}.png",          
    "width" => "32" ,         
    "height" => "32",
    "marker_anchor" => [12,34],
    "shadow_picture" => "http://www.google.com/mapfiles/shadow50.png",
    "shadow_width" => "58" ,    
    "shadow_height" =>  "42",   
    "shadow_anchor" => [6,38]

}
end

Somebody can help me in this question?


Solution

  • Ok guys, sorry because my ignorance. I set width, and height like as string instead a int. Fixing:

    def gmaps4rails_marker_picture
    {
    "picture" => "/assets/pins/pin_#{tipo_assalto_id}.png",          
    "width" => 32 ,         
    "height" => 32,
    "marker_anchor" => [12,34],
    "shadow_picture" => "http://www.google.com/mapfiles/shadow50.png",
    "shadow_width" => 58 ,    
    "shadow_height" =>  42,   
    "shadow_anchor" => [6,38]
    }
    end