Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example code for my DragMarkers project (part 3)
class App.Marker extends Spine.Model
@configure 'Marker', 'latitude', 'longitude', 'icon'
@extend Spine.Model.Ajax
constructor: ->
@gmarker = new google.maps.Marker(
position: new google.maps.LatLng(@latitude, @longitude)
icon: @icon
draggable: true
google.maps.event.addListener(@gmarker, 'dragend', (event) => @dragEnd(event))
google.maps.event.addListener(@gmarker, 'rightclick', (event) => @rightClick(event))
setMap: (map) -> @gmarker.setMap(map)
dragEnd: (event) ->
latitude: @gmarker.getPosition().lat()
longitude: @gmarker.getPosition().lng()
rightClick: (event) ->
rightClick: (event) ->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment