objectivehtml / Google-Maps-for-Craft

The complete geolocation toolkit for Craft CMS.
Other
94 stars 20 forks source link

Bug on Route and setting map ID #63

Open lboaretto opened 8 years ago

lboaretto commented 8 years ago

Hello,

If I use dynamic ID and Route, I get this error:

ReferenceError: map is not defined
    marker = new GoogleMaps.Marker(map, {(...)

Map with Route only accept ID 'map'

{% set mapID = 'map' ~ entry.id %}
{% set options = {
    id: mapID, 
    width: '940px', 
    height: '520px',
    options: {
        disableDoubleClickZoom: true,
        zoom: 20,
        zoomControlOptions: {
            position: 'google.maps.ControlPosition.LEFT_CENTER',
            style: 'google.maps.ZoomControlStyle.LARGE'
        }
    }
} %}
    {{ craft.googleMaps.map(options) }}
    {{ craft.googleMaps.data(mapID, blocoMapa) }}

I think the problem is on: "initializeApi: function() {" it should be "initializeApi: function(map) {"