Example
Create and update a size.
const size = new NutrientViewer.Geometry.Size({ width: 200, height: 100 });
size = size.set("height", 200);
size.height; // => 200
Default Value
{ width: 0, height: 0 }Hierarchy
Constructors
Parameters
options{ height?: number; width?: number }Optional
Properties
Methods
Applies a transformation to the point by scaling to the dimension [width, height]
Parameters
matrixTransformationMatrixReturns
Returns a new size with
widthandheightrounded to a number which is greater than or equal to the current value.Returns
A new
Size.Example
var size = new NutrientViewer.Geometry.Size({ width: 20.5, height: 30.1 });
size.ceil(); // => Size {width: 21, height: 31}
Returns a new size with
widthandheightrounded to a number which is smaller than or equal to the current value.Returns
A new
Size.Example
var size = new NutrientViewer.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
factornumberThe scale factor.
Returns
A new
Size.Example
var size = new NutrientViewer.Geometry.Size({ width: 20, height: 30 });
size.scale(2); // => Size {width: 40, height: 60}
Returns a new size with the
widthset to the currentheightvalue and theheightset to the currentwidthvalue.Returns
A new
Size.Example
var size = new NutrientViewer.Geometry.Size({ width: 20.5, height: 30.1 });
size.swapDimensions(); // => Size {width: 30.1, height: 20.5}
Immutable Record API
24
asImmutable
- Deprecated
Returns
thisDeprecated
Not part of the collection API the Nutrient Web SDK supports. Build the value once, or use withMutations().
See Also
Map#asImmutable
asMutable
- Deprecated
Returns
thisDeprecated
Not part of the collection API the Nutrient Web SDK supports. Use withMutations().
See Also
Map#asMutable
Returns a new instance of this Record type with all values set to their default values.
Returns
this
Returns a new instance of this Record type with the value for the specific key set to its default value.
Returns a new instance of this Record type with the value at the given key path removed.
Also available as
removeIn.Parameters
keyPathIterable<unknown>Returns
this
Parameters
otherunknownReturns
boolean
Returns the value associated with the provided key, which may be the default value defined when creating the Record factory function.
If the requested key is not defined by this Record type, then notSetValue will be returned if provided. Note that this scenario would produce an error when using Flow or TypeScript.
Parameters
keyPathIterable<unknown>notSetValueunknownOptionalReturns
unknown
Parameters
keyunknownReturns
boolean
Parameters
...collectionsPartial<{ height: number; width: number }>[]Returns
this
mergeIn
removeIn
- Deprecated
Parameters
keyPathIterable<unknown>Returns
thisDeprecated
Not part of the collection API the Nutrient Web SDK supports. Use deleteIn(), or update() followed by delete().
Parameters
keyPathIterable<unknown>valueunknownReturns
this
Deeply converts this Record to equivalent native JavaScript Object.
Note: This method may not be overridden. Objects with custom serialization to plain JS may override toJSON() instead.
Returns
{ height: number; width: number }height: number
The
heightof the size.Default Value
0width: number
The
widthof the size.Default Value
0
Shallowly converts this Record to equivalent native JavaScript Object.
Returns
{ height: number; width: number }height: number
The
heightof the size.Default Value
0width: number
The
widthof the size.Default Value
0
toSeq
- Deprecated
Returns
Keyed<string, unknown>Deprecated
Not part of the collection API the Nutrient Web SDK supports. Use entries().
Note: Not all methods can be used on a mutable collection or within
withMutations! Onlysetmay be used mutatively.Parameters
mutator(mutable: this) => unknownReturns
thisSee Also
Map#withMutations
A size is a 2D vector that describes the size of an element. It has the values
widthandheight. Provided values are defined in same units used by the page, point units. Point units are only equal to pixels when zoom value is1.It is an Immutable.Record and thus can be updated using
set(key, value), for example:size.set("width", 20).