Skip to content

Commit

Permalink
Fixed #10072 -- GMarker overlays now have draggable option. Thank…
Browse files Browse the repository at this point in the history
…s to prairiedogg for ticket and patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10002 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
jbronn committed Mar 8, 2009
1 parent 392f81c commit cee3173
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions django/contrib/gis/maps/google/overlays.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def sample_request(request):
return render_to_response('mytemplate.html',
{'google' : GoogleMap(markers=[marker])})
"""
def __init__(self, geom, title=None):
def __init__(self, geom, title=None, draggable=False):
"""
The GMarker object may initialize on GEOS Points or a parameter
that may be instantiated into a GEOS point. Keyword options map to
Expand All @@ -193,6 +193,9 @@ def __init__(self, geom, title=None):
Keyword Options:
title:
Title option for GMarker, will be displayed as a tooltip.
draggable:
Draggable option for GMarker, disabled by default.
"""
# If a GEOS geometry isn't passed in, try to construct one.
if isinstance(geom, basestring): geom = fromstr(geom)
Expand All @@ -205,14 +208,16 @@ def __init__(self, geom, title=None):
self.envelope = geom.envelope
# TODO: Add support for more GMarkerOptions
self.title = title
self.draggable = draggable
super(GMarker, self).__init__()

def latlng_from_coords(self, coords):
return 'new GLatLng(%s,%s)' %(coords[1], coords[0])

def options(self):
result = []
if self.title: result.append('title: "%s"' % self.title)
if self.title: result.append('title: "%s"' % self.title)
if self.draggable: result.append('draggable: true')
return '{%s}' % ','.join(result)

@property
Expand Down

0 comments on commit cee3173

Please sign in to comment.