Use ol.math.clamp()

This commit is contained in:
Tim Schaub
2015-09-27 09:54:11 -06:00
parent 5cac9d61cc
commit f746cb7f57
12 changed files with 67 additions and 30 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
goog.provide('ol.ResolutionConstraint');
goog.provide('ol.ResolutionConstraintType');
goog.require('goog.math');
goog.require('ol.array');
goog.require('ol.math');
/**
@@ -28,7 +28,7 @@ ol.ResolutionConstraint.createSnapToResolutions =
if (resolution !== undefined) {
var z =
ol.array.linearFindNearest(resolutions, resolution, direction);
z = goog.math.clamp(z + delta, 0, resolutions.length - 1);
z = ol.math.clamp(z + delta, 0, resolutions.length - 1);
return resolutions[z];
} else {
return undefined;