You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by jo...@apache.org on 2014/03/05 23:40:50 UTC
svn commit: r1574704 -
/climate/trunk/ocw-ui/frontend/app/js/controllers/ParameterSelectCtrl.js
Author: joyce
Date: Wed Mar 5 22:40:49 2014
New Revision: 1574704
URL: http://svn.apache.org/r1574704
Log:
CLIMATE-357 - Only allow users to select lat/lons on an integer grid
Modified:
climate/trunk/ocw-ui/frontend/app/js/controllers/ParameterSelectCtrl.js
Modified: climate/trunk/ocw-ui/frontend/app/js/controllers/ParameterSelectCtrl.js
URL: http://svn.apache.org/viewvc/climate/trunk/ocw-ui/frontend/app/js/controllers/ParameterSelectCtrl.js?rev=1574704&r1=1574703&r2=1574704&view=diff
==============================================================================
--- climate/trunk/ocw-ui/frontend/app/js/controllers/ParameterSelectCtrl.js (original)
+++ climate/trunk/ocw-ui/frontend/app/js/controllers/ParameterSelectCtrl.js Wed Mar 5 22:40:49 2014
@@ -225,6 +225,11 @@ function($rootScope, $scope, $http, $tim
if ($scope.displayParams.end > $scope.end)
$scope.displayParams.end = $scope.end;
+ $scope.displayParams.latMin = $scope.truncateFloat($scope.displayParams.latMin);
+ $scope.displayParams.latMax = $scope.truncateFloat($scope.displayParams.latMax);
+ $scope.displayParams.lonMin = $scope.truncateFloat($scope.displayParams.lonMin);
+ $scope.displayParams.lonMax = $scope.truncateFloat($scope.displayParams.lonMax);
+
$scope.$apply();
$rootScope.$broadcast('redrawOverlays', []);
}
@@ -262,10 +267,10 @@ function($rootScope, $scope, $http, $tim
}
// Update the display parameters with the new valid overlap that we've found!
- $scope.displayParams.latMin = latMin;
- $scope.displayParams.latMax = latMax;
- $scope.displayParams.lonMin = lonMin;
- $scope.displayParams.lonMax = lonMax;
+ $scope.displayParams.latMin = $scope.truncateFloat(latMin);
+ $scope.displayParams.latMax = $scope.truncateFloat(latMax);
+ $scope.displayParams.lonMin = $scope.truncateFloat(lonMin);
+ $scope.displayParams.lonMax = $scope.truncateFloat(lonMax);
$scope.displayParams.start = (typeof start == 'undefined') ? "" : start.split(" ")[0];
$scope.displayParams.end = (typeof end == 'undefined') ? "" : end.split(" ")[0];
@@ -280,4 +285,12 @@ function($rootScope, $scope, $http, $tim
$scope.displayParams.areValid = true;
$rootScope.$broadcast('redrawOverlays', []);
}, true);
+
+ $scope.truncateFloat = function(floatVal) {
+ if (floatVal > 0) {
+ return Math.floor(floatVal);
+ } else {
+ return Math.ceil(floatVal);
+ }
+ }
}]);