|
83 | 83 |
|
84 | 84 | // add gmap markers |
85 | 85 | const { AdvancedMarkerElement, PinElement } = await google.maps.importLibrary("marker"); |
86 | | - |
87 | | - for (const marker of {{gmap.markers|tojson|safe}}) { |
88 | | - tempMarker = new AdvancedMarkerElement({ |
89 | | - position: new google.maps.LatLng(marker.lat, marker.lng), |
| 86 | + {% for marker in gmap.markers %} |
| 87 | +{# {% if "http" in marker.pin.glyph %}#} |
| 88 | + const {{ marker['pin'].uuid }} = document.createElement("img"); |
| 89 | + {{ marker['pin'].uuid }}.src = "{{marker['pin'].glyph}}"; |
| 90 | +{# {% else %}#} |
| 91 | +{# const {{ marker.pin.uuid }} = new PinElement({#} |
| 92 | +{# glyphColor: marker.pin.glyph_color,#} |
| 93 | +{# background: marker.pin.background,#} |
| 94 | +{# borderColor: marker.pin.border_color,#} |
| 95 | +{# glyph: marker.pin.glyph,#} |
| 96 | +{# }).element#} |
| 97 | +{# {% endif %}#} |
| 98 | + |
| 99 | + tempMarker = new AdvancedMarkerElement({ |
| 100 | + position: new google.maps.LatLng({{marker['lat']}}, {{marker['lng']}}), |
90 | 101 | map: {{gmap.varname}}, |
91 | | - title: marker.title ? marker.title : null, |
92 | | - content: new PinElement({ |
93 | | - glyphColor: marker.pin.glyph_color, |
94 | | - background: marker.pin.background, |
95 | | - borderColor: marker.pin.border_color, |
96 | | - glyph: marker.pin.glyph, |
97 | | - }).element, |
| 102 | + title: {{marker['title'] if marker['title'] is defined else 'null'}}, |
| 103 | + content: {{ marker['pin'].uuid }} |
98 | 104 | }); |
99 | 105 |
|
100 | 106 |
|
101 | | - if(marker.infobox) |
102 | | - { |
| 107 | + {% if marker['infobox'] is defined %} |
| 108 | + |
103 | 109 | google.maps.event.addListener( |
104 | 110 | tempMarker, |
105 | 111 | 'click', |
106 | | - getInfoCallback({{gmap.varname}}, marker.infobox) |
| 112 | + getInfoCallback({{gmap.varname}}, "{{marker['infobox']}}") |
107 | 113 | ); |
108 | | - } |
109 | 114 |
|
110 | | - if("{{gmap.report_markerClickpos}}" === "True" ) |
111 | | - { |
| 115 | + {% endif %} |
| 116 | + |
| 117 | + {% if gmap.report_markerClickpos %} |
112 | 118 | google.maps.event.addListener( |
113 | 119 | tempMarker, |
114 | 120 | 'click', |
115 | | - function (event) { markerClickposCallback('{{gmap.markerClickpos_uri}}', event.latLng, marker.title, marker.label)} |
| 121 | + function (event) { markerClickposCallback('{{gmap.markerClickpos_uri}}', event.latLng, marker['title'], marker['label'])} |
116 | 122 | ); |
117 | | - } |
| 123 | + {% endif %} |
118 | 124 | {{gmap.varname}}_markers.push(tempMarker); |
119 | 125 |
|
120 | | - } |
| 126 | + {% endfor %} |
| 127 | + |
| 128 | + {#for (const marker of {{gmap.markers|tojson|safe}}) {#} |
| 129 | + {##} |
| 130 | + {#}#} |
121 | 131 |
|
122 | 132 |
|
123 | 133 | {% if gmap.report_clickpos %} |
|
0 commit comments