Skip to content

Commit 210ba30

Browse files
committed
Fix clamping of lon and lat
1 parent ea879e7 commit 210ba30

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/OpenLayers/Control/Graticule.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ OpenLayers.Control.Graticule = OpenLayers.Class(OpenLayers.Control, {
462462
centerLon = Math.floor(centerLonLat.lon / interval) * interval;
463463

464464
lon = Math.max(centerLon, this.minLon);
465-
lon = Math.min(centerLon, this.maxLon);
465+
lon = Math.min(lon, this.maxLon);
466466

467467
idx = this.addMeridian(
468468
lon, minLat, maxLat, squaredTolerance, extentGeom, 0);
@@ -479,7 +479,7 @@ OpenLayers.Control.Graticule = OpenLayers.Class(OpenLayers.Control, {
479479
}
480480

481481
lon = Math.max(centerLon, this.minLon);
482-
lon = Math.min(centerLon, this.maxLon);
482+
lon = Math.min(lon, this.maxLon);
483483

484484
while (lon != this.maxLon) {
485485
lon = Math.min(lon + interval, this.maxLon);
@@ -509,7 +509,7 @@ OpenLayers.Control.Graticule = OpenLayers.Class(OpenLayers.Control, {
509509
centerLat = Math.floor(centerLonLat.lat / interval) * interval;
510510

511511
lat = Math.max(centerLat, this.minLat);
512-
lat = Math.min(centerLat, this.maxLat);
512+
lat = Math.min(lat, this.maxLat);
513513

514514
idx = this.addParallel(
515515
lat, minLon, maxLon, squaredTolerance, extentGeom, 0);
@@ -526,7 +526,7 @@ OpenLayers.Control.Graticule = OpenLayers.Class(OpenLayers.Control, {
526526
}
527527

528528
lat = Math.max(centerLat, this.minLat);
529-
lat = Math.min(centerLat, this.maxLat);
529+
lat = Math.min(lat, this.maxLat);
530530

531531
while (lat != this.maxLat) {
532532
lat = Math.min(lat + interval, this.maxLat);

0 commit comments

Comments
 (0)