diff --git a/lib/OpenLayers/Util.js b/lib/OpenLayers/Util.js index 6b9b308751..e3ab4c064d 100644 --- a/lib/OpenLayers/Util.js +++ b/lib/OpenLayers/Util.js @@ -91,21 +91,58 @@ OpenLayers.Pixel.prototype = { CLASS_NAME: "OpenLayers.Pixel" }; + +/** +* @class This class represents a width and height pair +*/ OpenLayers.Size = Class.create(); OpenLayers.Size.prototype = { - initialize: function(w,h) { - this.w=w; - this.h=h; + + /** @type float */ + w: 0.0, + + /** @type float */ + h: 0.0, + + + /** + * @param {float} w + * @param {float} h + */ + initialize: function(w, h) { + this.w = w; + this.h = h; }, - toString:function(){ + + /** + * @return String representation of OpenLayers.Size object. (ex. "w=55,h=66") + * @type String + */ + toString:function() { return ("w="+this.w+",h="+this.h); }, - copyOf:function(){ + + /** + * @return New OpenLayers.Size object with the same w and h values + * @type OpenLayers.Size + */ + copyOf:function() { return new OpenLayers.Size(this.w, this.h); }, - sameSize:function(pt){ - return (this.w==pt.w && this.h==pt.h); + + /** + * @param {OpenLayers.Size} sz + * @returns Boolean value indicating whether the passed-in OpenLayers.Size + * object has the same w and h components as this + * + * @type bool + */ + equals:function(sz) { + return ((this.w == sz.w) && /this.h == sz.h)); } + + /** @type String */ + CLASS_NAME: "OpenLayers.Size" }; OpenLayers.LatLon = Class.create();