fix for #746 - add console.error()s when wrong number of argumetns passed to add()

git-svn-id: http://svn.openlayers.org/trunk/openlayers@3731 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2007-07-13 15:41:33 +00:00
parent e420ec851c
commit 9dd9289f88
6 changed files with 83 additions and 11 deletions

View File

@@ -191,6 +191,11 @@ OpenLayers.Bounds.prototype = {
* x and y values
*/
add:function(x, y) {
if ( (x == null) || (y == null) ) {
var msg = "You must pass both x and y values to the add function.";
OpenLayers.Console.error(msg);
return null;
}
return new OpenLayers.Bounds(this.left + x, this.bottom + y,
this.right + x, this.top + y);
},

View File

@@ -84,6 +84,12 @@ OpenLayers.LonLat.prototype = {
* lat passed-in added to this's.
*/
add:function(lon, lat) {
if ( (lon == null) || (lat == null) ) {
var msg = "You must pass both lon and lat values " +
"to the add function.";
OpenLayers.Console.error(msg);
return null;
}
return new OpenLayers.LonLat(this.lon + lon, this.lat + lat);
},

View File

@@ -91,6 +91,11 @@ OpenLayers.Pixel.prototype = {
* values passed in.
*/
add:function(x, y) {
if ( (x == null) || (y == null) ) {
var msg = "You must pass both x and y values to the add function.";
OpenLayers.Console.error(msg);
return null;
}
return new OpenLayers.Pixel(this.x + x, this.y + y);
},