Plugin Directory

Changeset 1587085


Ignore:
Timestamp:
02/02/2017 08:46:11 AM (9 years ago)
Author:
ionutmorariu
Message:

CHG: multimple maps generation works, needs JS refactoring

Location:
scale-lite-tools/trunk/assets/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • scale-lite-tools/trunk/assets/js/admin.sl-maps.js

    r1587053 r1587085  
    3939                  position: results[0].geometry.location
    4040              });
    41               document.getElementById("slt_meta-latitude").value = results[0].geometry.location.lng();
    42               document.getElementById("slt_meta-longitude").value = results[0].geometry.location.lat();
     41              document.getElementById("slt_meta-latitude").value = results[0].geometry.location.lat();
     42              document.getElementById("slt_meta-longitude").value = results[0].geometry.location.lng();
    4343              callback(results[0].geometry.location,map);
    4444            } else {
     
    5555    });
    5656  }
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
    5767
    5868
     
    8393        infowindow.open(map, marker);
    8494      }
    85       function codeAddress(callback) {
     95      function codeAddress(map,callback) {
    8696        var address = document.getElementById('slt_meta-center-map-location').value;
    8797        geocoder.geocode({
    8898          'address': address
    8999        }, 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);
    90103          callback(results[0].geometry.location);
    91104        });
    92105
    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.location
    98           });
    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         }
    103106      }
    104       codeAddress(function(myLocation) { mapCreate(myLocation);});
     107      codeAddress(map,function(myLocation) { mapCreate(myLocation);});
    105108    };
    106109    sl_preview_map();
  • scale-lite-tools/trunk/assets/js/frontend.sl-google-maps.js

    r1587030 r1587085  
    66    typeof scaleLiteMarkersBuffer != 'undefined') {
    77    console.log(scaleLiteMapsBuffer);
    8     console.log(scaleLiteMapsBuffer);
     8    console.log(scaleLiteMarkersBuffer);
    99    var geocoder = new google.maps.Geocoder();
    1010    for (var prop in scaleLiteMapsBuffer) {
     
    3232
    3333      function addMarker(position, title) {
     34        console.log(position);
    3435        var marker = new google.maps.Marker({
    3536          position: position,
     
    4445
    4546      for (var i = 0; i < mapObject.map_markers.length; i++) {
    46         var marker_lat = parseInt(scaleLiteMarkersBuffer[mapObject.map_markers[i]].marker_lat);
    47         var marker_lng = parseInt(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);
    4849        var title = "<h4>" + scaleLiteMarkersBuffer[mapObject.map_markers[
    4950          i]].title + "</h4>";
Note: See TracChangeset for help on using the changeset viewer.