Changeset 1587085
- Timestamp:
- 02/02/2017 08:46:11 AM (9 years ago)
- Location:
- scale-lite-tools/trunk/assets/js
- Files:
-
- 2 edited
-
admin.sl-maps.js (modified) (3 diffs)
-
frontend.sl-google-maps.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
scale-lite-tools/trunk/assets/js/admin.sl-maps.js
r1587053 r1587085 39 39 position: results[0].geometry.location 40 40 }); 41 document.getElementById("slt_meta-latitude").value = results[0].geometry.location.l ng();42 document.getElementById("slt_meta-longitude").value = results[0].geometry.location.l at();41 document.getElementById("slt_meta-latitude").value = results[0].geometry.location.lat(); 42 document.getElementById("slt_meta-longitude").value = results[0].geometry.location.lng(); 43 43 callback(results[0].geometry.location,map); 44 44 } else { … … 55 55 }); 56 56 } 57 58 59 60 61 62 63 64 65 66 57 67 58 68 … … 83 93 infowindow.open(map, marker); 84 94 } 85 function codeAddress( callback) {95 function codeAddress(map,callback) { 86 96 var address = document.getElementById('slt_meta-center-map-location').value; 87 97 geocoder.geocode({ 88 98 'address': address 89 99 }, function(results, status) { 100 document.getElementById("slt_meta-latitude").value = results[0].geometry.location.lat(); 101 document.getElementById("slt_meta-longitude").value = results[0].geometry.location.lng(); 102 map.setCenter(results[0].geometry.location); 90 103 callback(results[0].geometry.location); 91 104 }); 92 105 93 if (status == 'OK') {94 map.setCenter(results[0].geometry.location);95 var marker = new google.maps.Marker({96 map: map,97 position: results[0].geometry.location98 });99 document.getElementById("slt_meta-latitude").value = results[0].geometry.location.lat();100 document.getElementById("slt_meta-longitude").value = results[0].geometry.location.lng();101 callback(results[0].geometry.location,map);102 }103 106 } 104 codeAddress( function(myLocation) { mapCreate(myLocation);});107 codeAddress(map,function(myLocation) { mapCreate(myLocation);}); 105 108 }; 106 109 sl_preview_map(); -
scale-lite-tools/trunk/assets/js/frontend.sl-google-maps.js
r1587030 r1587085 6 6 typeof scaleLiteMarkersBuffer != 'undefined') { 7 7 console.log(scaleLiteMapsBuffer); 8 console.log(scaleLiteMa psBuffer);8 console.log(scaleLiteMarkersBuffer); 9 9 var geocoder = new google.maps.Geocoder(); 10 10 for (var prop in scaleLiteMapsBuffer) { … … 32 32 33 33 function addMarker(position, title) { 34 console.log(position); 34 35 var marker = new google.maps.Marker({ 35 36 position: position, … … 44 45 45 46 for (var i = 0; i < mapObject.map_markers.length; i++) { 46 var marker_lat = parse Int(scaleLiteMarkersBuffer[mapObject.map_markers[i]].marker_lat);47 var marker_lng = parse Int(scaleLiteMarkersBuffer[mapObject.map_markers[i]].marker_lng);47 var marker_lat = parseFloat(scaleLiteMarkersBuffer[mapObject.map_markers[i]].marker_lat); 48 var marker_lng = parseFloat(scaleLiteMarkersBuffer[mapObject.map_markers[i]].marker_lng); 48 49 var title = "<h4>" + scaleLiteMarkersBuffer[mapObject.map_markers[ 49 50 i]].title + "</h4>";
Note: See TracChangeset
for help on using the changeset viewer.