1 /* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
2 * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
3 * full text of the license. */
6 * Class: OpenLayers.Size
7 * Instances of this class represent a width/height pair
9 OpenLayers.Size = OpenLayers.Class({
25 * Constructor: OpenLayers.Size
26 * Create an instance of OpenLayers.Size
32 initialize: function(w, h) {
33 this.w = parseFloat(w);
34 this.h = parseFloat(h);
39 * Return the string representation of a size object
42 * {String} The string representation of OpenLayers.Size object.
43 * (ex. <i>"w=55,h=66"</i>)
46 return ("w=" + this.w + ",h=" + this.h);
51 * Create a clone of this size object
54 * {<OpenLayers.Size>} A new OpenLayers.Size object with the same w and h
58 return new OpenLayers.Size(this.w, this.h);
64 * Determine where this size is equal to another
67 * sz - {<OpenLayers.Size>}
70 * {Boolean} The passed in size has the same h and w properties as this one.
71 * Note that if sz passed in is null, returns false.
77 equals = ((this.w == sz.w && this.h == sz.h) ||
78 (isNaN(this.w) && isNaN(this.h) && isNaN(sz.w) && isNaN(sz.h)));
83 CLASS_NAME: "OpenLayers.Size"