boutils 10 лет назад
Родитель
Сommit
d1d12a8a7e
1 измененных файлов с 16 добавлено и 8 удалено
  1. 16 8
      js/app.js

+ 16 - 8
js/app.js

@@ -647,7 +647,7 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
           },
           valueField: 'suggestions',
           preProcess: function (data) {
-            //console.log('suggestions', data && data.suggestions);
+            console.log('suggestions', data && data.suggestions);
 
             $scope.suggestions = data.suggestions;
             $scope.magicKey = null;
@@ -832,7 +832,7 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
       }
 
       if(adresse)
-      //console.log('Reverse', data, '=>', data && data.address);
+      console.debug('Reverse', geoCode, address, '=>', adresse, data.address);
       callback(adresse, data.address);
       $scope.$evalAsync();
     });
@@ -875,7 +875,6 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
   };
 
   $scope.getGeoCode = function(address, magicKey, callback) {
-    console.debug('address, magicKey', address, magicKey);
 
     var findURL    = 'https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?f=pjson&searchExtent=' + JSON.stringify(searchExtent);
 
@@ -892,17 +891,21 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
       if (status === 'success' && data.locations[0]) {
 
         if(data.locations[0].extent.xmax < searchExtent.xmin &&
-          data.locations[0].extent.xmax > searchExtent.xmax &&
-          data.locations[0].extent.xmin > searchExtent.xmax&&
-          data.locations[0].extent.xmin > searchExtent.xmax) {
+           data.locations[0].extent.xmax > searchExtent.xmax &&
+           data.locations[0].extent.xmin > searchExtent.xmax &&
+           data.locations[0].extent.xmin > searchExtent.xmax) {
 
           getGeoCodeInProgress = false;
+          console.debug('getGeoCode', address, magicKey, '=>', data);
           return callback(null, data);
         }
         getGeoCodeInProgress = false;
+        console.debug('getGeoCode', address, magicKey, '=>', 'No result');
         callback('No result for ' + address);
       } else {
         getGeoCodeInProgress = false;
+        console.debug('getGeoCode', address, magicKey, '=>', 'No result');
+
         callback(status !== 'success' ? status : 'No result for ' + address);
       }
     });
@@ -1197,10 +1200,15 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
   };
 
   $scope.showResultPane = function() {
-    $('#result').animate({height: ($('body').height() / 2) + 'px'}, 1000);
+    var bodyHeight = $('body').height();
+    var height     = Math.max(300, bodyHeight / 3);
+    var heightMap = bodyHeight - height;
+
+    $('#result').animate({height: height + 'px'}, 1000);
+
 
     $('#map').animate({
-      height: ($('body').height() / 2) + 'px',
+      height: heightMap + 'px',
     }, 1000, function() {
 
       // Animation complete.