flask-extensions / Flask-GoogleMaps

Easy way to add GoogleMaps to Flask applications. maintainer: @getcake
https://flask-googlemaps.com
MIT License
647 stars 196 forks source link

Added configurable collapse, i.e. show or hide map by default, fixes #73 #129

Closed Herugrim closed 4 years ago

Herugrim commented 4 years ago

Apologies for the second PR, I had some troubles with the original one #114. I added a 'mapdisplay' attribute to configure default behaviour of map, in my usecase this is a user-preference so i take initiate a Map object with a 'mapdisplay' parameter:

             sndmap = Map(
                identifier = "sndmap",
                varname = "sndmap",
                lng=longitude,
                lat=latitude,
                markers=[(latitude, longitude)],
                style = "height:600px;",
                collapsible = True,
                fullscreen_control = True,
                streetview_control = False,
                mapdisplay = mapdisplay
               )

Added a simple if statement in gmapjs.html to click on the button in case mapdisplay = True. This could probably be coded in a more efficient way but it works.