Ticket #10072: overlays.py.diff

File overlays.py.diff, 1.5 KB (added by prairiedogg, 15 years ago)

Patch to add draggabillity option to Gmarker objects

  • overlays.py

     
    184184          return render_to_response('mytemplate.html',
    185185                 {'google' : GoogleMap(markers=[marker])})
    186186    """
    187     def __init__(self, geom, title=None):
     187    def __init__(self, geom, title=None, draggable=False):
    188188        """
    189189        The GMarker object may initialize on GEOS Points or a parameter
    190190        that may be instantiated into a GEOS point.  Keyword options map to
     
    193193        Keyword Options:
    194194         title:
    195195           Title option for GMarker, will be displayed as a tooltip.
     196         
     197         draggable:
     198           Draggable option for GMarker, disabled by default
     199           
    196200        """
    197201        # If a GEOS geometry isn't passed in, try to construct one.
    198202        if isinstance(geom, basestring): geom = fromstr(geom)
     
    205209        self.envelope = geom.envelope
    206210        # TODO: Add support for more GMarkerOptions
    207211        self.title = title
     212        self.draggable = draggable
    208213        super(GMarker, self).__init__()
    209214
    210215    def latlng_from_coords(self, coords):
     
    212217   
    213218    def options(self):
    214219        result = []
    215         if self.title: result.append('title: "%s"' % self.title)
     220        if self.title: result.append('title: "%s"' % self.title)
     221        if self.draggable: result.append('draggable: true')
    216222        return '{%s}' % ','.join(result)
    217223
    218224    @property
Back to Top