Constructor
A 2D vector that describes the size of an element.
Parameters:
Name | Type | Description |
---|---|---|
args |
object | An object used to initialize the size. If |
- Default Value:
- { width: 0, height: 0 }
Example
const size = new PSPDFKit.Geometry.Size({ width: 200, height: 100 });
size = size.set("height", 200);
size.height; // => 200
Extends
- Immutable.Record
Members
Methods
Members
The height
of the size.
Type:
- number
- Default Value:
- 0
The width
of the size.
Type:
- number
- Default Value:
- 0
Methods
Returns a new size with width
and height
rounded to a number which is greater than or equal
to the current value.
Returns:
A new Size
.
Example
var size = new PSPDFKit.Geometry.Size({ width: 20.5, height: 30.1 });
size.ceil(); // => Size {width: 21, height: 31}
Returns a new size with width
and height
rounded to a number which is smaller than or equal
to the current value.
Returns:
A new Size
.
Example
var size = new PSPDFKit.Geometry.Size({ width: 20.5, height: 30.1 });
size.floor(); // => Size {width: 20, height: 30}
Scales the width and height by a given factor
.
Parameters:
Name | Type | Description |
---|---|---|
factor |
number | The scale factor. |
Returns:
A new Size
.
Example
var size = new PSPDFKit.Geometry.Size({ width: 20, height: 30 });
size.scale(2); // => Size {width: 40, height: 60}
Returns a new size with the width
set to the current height
value and the height
set to the current width
value.
Returns:
A new Size
.
Example
var size = new PSPDFKit.Geometry.Size({ width: 20.5, height: 30.1 });
size.swapDimensions(); // => Size {width: 30.1, height: 20.5}