Represents the size of a rectangular object with a given width and height.
Remarks
This is a convertible type that can be used with the following notation(s) in parameter lists, parameter objects or setters.
It is possible to specify an Object or plain Object to define the Size:
[20, 20] // width, height
{ width: 20, height: 20 }
Examples
The following example shows a few ways to use Size:
// Create a new size
const size = new Size(10, 15)
console.log(
`The size has width ${size.width} and height ${size.height} representing an area of ${size.area}`
)
// Create another size
const size2 = new Size(5, 17)
// Enlarge it by multiplying with a factor
const larger = size2.multiply(1.5)
// Make the first size only half as large
const half = size.multiply(0.5)
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.geometry.Size
Sample Graphs
Constructors
Properties
Methods
Converts this instance to an MutableSize instance
Returns
- ↪MutableSize
- The MutableSize instance, whose attributes have been initialized with the values of this instance.
Creates a YDimension from a given Size.
Returns
- ↪YDimension
- The YDimension.
This method is not available unless the module view-layout-bridge is loaded. Either load the module 'view-layout-bridge' explicitly or call
Class.ensure(LayoutExecutor)
More information.Constants
The "infinite" size that has width and height set to Number.POSITIVE_INFINITY.
Static Methods
Performs an implicit conversion from MutableSize to Size.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- size - MutableSize
- The size.
Returns
- ↪Size
- The result of the conversion.
Performs an explicit conversion from Size to MutableSize.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- size - Size
- The size.
Returns
- ↪MutableSize
- The result of the conversion.
Creates a Size instance from the given size-like object by performing automatic type conversion.