apneadiving / Google-Maps-for-Rails

Enables easy Google map + overlays creation in Ruby apps
https://apneadiving.github.io/
MIT License
2.26k stars 382 forks source link

Better documentation with samples. Unclear how to use this new version. #385

Closed jonathanng closed 10 years ago

jonathanng commented 10 years ago

Several things:

1) After looking at the marker.coffee file, I'm still not sure how to add a shadow.

My code looks like this:

{
  lat:      latitude,
  lng:      longitude,
  picture: {
    anchor:   [ 12, 39 ],
    url:    url,
    width:    24,
    height:   39
  },
  shadow: {
    anchor:   [ 12, 6 ],
    picture:  image_path('sprite/w24_location_shadow.png'),
    width:    24,
    height:   12
  }
}

The picture works fine. Shadows are not appearing. Do I need to add a special javascript file like RichMarker?

2) I have no idea how to set the zoom. Looking at map.coffee, it appears that I can just add a zoom parameter to the provider option, but that doesn't work.

I think it has something to do with

handler.bounds.extendWith(markers);
handler.fitMapToBounds();

3) Rich Marker is not working. Or at least the sample in the wiki

class RichMarkerBuilder extends Gmaps.Google.Builders.Marker #inherit from builtin builder
  #override create_marker method
  create_marker: ->
    options = _.extend @marker_options(), @rich_marker_options()
    @serviceObject = new RichMarker options #assign marker to @serviceObject
  rich_marker_options: ->
    boxText = document.createElement("div")
    boxText.setAttribute("class", 'yellow')
    boxText.innerHTML = @args.infowindow
    _.extend(@marker_options(), { content: boxText })

Why is @args.infowindow in the section for Rich Marker?

I think the gem is great. Was a huge fan of the previous version. I know this version is brand new. I think maybe even a sample rails app would be extremely useful. Thanks!

apneadiving commented 10 years ago

1) replace picture: image_path('sprite/w24_location_shadow.png'), with url: picture: image_path('sprite/w24_location_shadow.png'),

2) you have full access to the objects created by google. Example:

handler.getMap().setZoom( )

3) rich marker is a container with content, so you have to provide content, I put this in the infowindow property of the markers but you can put this anywhere.

4) thanks, but please feel free to suggest doc changes