Ticket #11211: django_overlays.patch

File django_overlays.patch, 2.9 KB (added by travisjeffery, 15 years ago)

patch to add gmarkeroptions

  • django/contrib/gis/maps/google/overlays.py

     
    250250          return render_to_response('mytemplate.html',
    251251                 {'google' : GoogleMap(markers=[marker])})
    252252    """
    253     def __init__(self, geom, title=None, draggable=False, icon=None):
     253    def __init__(self, geom, title=None, draggable=False, clickable=False,
     254                 bouncy=False, dragCrossMove=False, bounceGravity=1,
     255                 autoPan=True, hide=False, icon=None):
    254256        """
    255257        The GMarker object may initialize on GEOS Points or a parameter
    256258        that may be instantiated into a GEOS point.  Keyword options map to
     
    262264
    263265         draggable:
    264266           Draggable option for GMarker, disabled by default.
     267
     268        clickable:
     269            Clickable option for GMarker, disabled by default.
     270
     271        bouncy:
     272            Bouncy option for GMarker, disabled by default.
     273
     274        dragCrossMove:
     275            Drag cross move option for GMarker, disabled by default.
     276
     277        bounceGravity:
     278            Bounce gravity option for GMarker, 1 by default.
     279
     280        autoPan:
     281            Auto pan option for GMarker, enabled by default.
     282
     283        hide:
     284            Hide option for GMarker, disabled by default.
     285
     286        icon:
     287            Icon option for GMarker, disabled by default.
    265288        """
    266289        # If a GEOS geometry isn't passed in, try to construct one.
    267290        if isinstance(geom, basestring): geom = fromstr(geom)
     
    273296        # Getting the envelope for automatic zoom determination.
    274297        self.envelope = geom.envelope
    275298        # TODO: Add support for more GMarkerOptions
     299        # TODO: zIndexProcess is all that is left currently (05-27-2009)
    276300        self.title = title
    277301        self.draggable = draggable
    278302        self.icon = icon
     303        self.clickable = clickable
     304        self.bouncy = bouncy
     305        self.dragCrossMove = dragCrossMove
     306        self.bounceGravity = bounceGravity
     307        self.autoPan = autoPan
    279308        super(GMarker, self).__init__()
    280309
    281310    def latlng_from_coords(self, coords):
     
    286315        if self.title: result.append('title: "%s"' % self.title)
    287316        if self.icon: result.append('icon: %s' % self.icon.varname)
    288317        if self.draggable: result.append('draggable: true')
     318        if self.clickable: result.append('clickable: true')
     319        if self.bouncy: result.append('bouncy: true')
     320        if self.dragCrossMove: result.append('dragCrossMove: true')
     321        if self.bounceGravity: result.append('bounceGravity: %s' %
     322                                             self.bounceGravity)
     323        if not self.autoPan: result.append('autoPan: false')
    289324        return '{%s}' % ','.join(result)
    290325
    291326    @property
Back to Top