Class: ViewBox
ViewBox class for managing the view box of the map. The view box is a rectangular area of the SVG canvas that is visible to the user. It is used to define the portion of the SVG canvas that is visible to the user.
Constructors
Constructor
new ViewBox(
x?,
y?,
width?,
height?): ViewBox;
Constructs a new ViewBox object.
Parameters
Parameter | Type | Description |
---|---|---|
x? | | string | number | ViewBox | ViewBoxLiteral | ViewBoxArray | The x-coordinate of the viewBox. Can be a number, a ViewBox object, a ViewBoxLiteral object, a ViewBoxArray, or a string in the format "x y width height". |
y? | string | number | The y-coordinate of the viewBox. Can be a number or a string. |
width? | string | number | The width of the viewBox. Can be a number or a string. |
height? | string | number | The height of the viewBox. Can be a number or a string. |
Returns
ViewBox
Methods
addPadding()
addPadding(padding): void;
Adds padding to the viewBox
Parameters
Parameter | Type |
---|---|
padding | { bottom : number ; left : number ; right : number ; top : number ; } |
padding.bottom | number |
padding.left | number |
padding.right | number |
padding.top | number |
Returns
void
clone()
clone(): ViewBox;
Returns
ViewBox
fitsInViewBox()
fitsInViewBox(viewBox, atLeastByOneDimension?): boolean;
Check whether current viewBox fits inside of another viewBox
Parameters
Parameter | Type |
---|---|
viewBox | ViewBox |
atLeastByOneDimension? | boolean |
Returns
boolean
toArray()
toArray(): number[];
Returns an array containing viewBox numbers
Returns
number
[]
toString()
toString(): string;
Returns a string with viewBox numbers
Returns
string
update()
update(
x,
y?,
width?,
height?): void;
Updates the viewBox with new coordinates and dimensions.
Parameters
Parameter | Type |
---|---|
x | | string | number | ViewBox | ViewBoxLiteral | ViewBoxArray |
y? | string | number |
width? | string | number |
height? | string | number |
Returns
void
Properties
height
height: number = 0;
initialized
initialized: boolean = false;
width
width: number = 0;
x
x: number = 0;
y
y: number = 0;