Class Size
A Size describes a width and a height in two-dimensional coordinates. The width and height must both be non-negative.
Use the static functions Size.parse and Size.stringify to convert to and from a standard string representation that is independent of the current locale.
When an instance of this class is the value of a property of a GraphObject class or Diagram or CommandHandler or a Tool class, you should treat the object as if it were frozen or read-only -- you cannot modify its properties. This allows the property to return a value without allocating a new instance. If you need to do your own calculations with the value, call copy to make a new instance with the same values that you can modify.
Many methods modify the object's properties and then return a reference to "this" object. The only instance method to allocate a new object is the copy method. The static Size.parse method also allocates a new object.
The "Debug" implementation of this class is significantly slower than the "Release" implementation, mostly due to additional error checking.
You cannot inherit from this class.
Constructor Summary Details
Name | Description |
---|---|
Size(w, h)
|
The default constructor produces the Size(0,0).More... This constructor may take either zero arguments or two arguments.
|
Properties Summary Details
Name, Value Type | Description |
---|---|
height
{number}
|
Gets or sets the height value of the Size.More... The value must not be negative. |
width
{number}
|
Gets or sets the width value of the Size.More... The value must not be negative. |
Method Summary Details
Name, Return Type | Description |
---|---|
copy()
{Size}
|
Create a copy of this Size, with the same values.
|
equals(s)
{boolean}
|
|
equalTo(w, h)
{boolean}
|
|
isReal()
{boolean}
|
True if this Size has Width and Height values that are real numbers and not infinity.
|
<static>
Size.parse(str)
{Size}
|
This static function can be used to read in a Size from a string that was produced by Size.stringify.More...
|
set(s)
{Size}
|
|
setTo(w, h)
{Size}
|
|
<static>
Size.stringify(val)
{string}
|
This static function can be used to write out a Size as a string that can be read by Size.parse.More...
|