SVGLength
The SVGLength interface correspond to the <length> basic data type.
Methods
convertToSpecifiedUnits()
convertToSpecifiedUnits(unitType): void;
The convertToSpecifiedUnits() method of the SVGLength interface allows you to convert the length's value to the specified unit type.
Parameters
| Parameter | Type |
|---|---|
unitType | number |
Returns
void
newValueSpecifiedUnits()
newValueSpecifiedUnits(unitType, valueInSpecifiedUnits): void;
The newValueSpecifiedUnits() method of the SVGLength interface resets the value as a number with an associated unitType, thereby replacing the values for all of the attributes on the object.
Parameters
| Parameter | Type |
|---|---|
unitType | number |
valueInSpecifiedUnits | number |
Returns
void
Properties
SVG_LENGTHTYPE_CM
readonly SVG_LENGTHTYPE_CM: 6;
SVG_LENGTHTYPE_EMS
readonly SVG_LENGTHTYPE_EMS: 3;
SVG_LENGTHTYPE_EXS
readonly SVG_LENGTHTYPE_EXS: 4;
SVG_LENGTHTYPE_IN
readonly SVG_LENGTHTYPE_IN: 8;
SVG_LENGTHTYPE_MM
readonly SVG_LENGTHTYPE_MM: 7;
SVG_LENGTHTYPE_NUMBER
readonly SVG_LENGTHTYPE_NUMBER: 1;
SVG_LENGTHTYPE_PC
readonly SVG_LENGTHTYPE_PC: 10;
SVG_LENGTHTYPE_PERCENTAGE
readonly SVG_LENGTHTYPE_PERCENTAGE: 2;
SVG_LENGTHTYPE_PT
readonly SVG_LENGTHTYPE_PT: 9;
SVG_LENGTHTYPE_PX
readonly SVG_LENGTHTYPE_PX: 5;
SVG_LENGTHTYPE_UNKNOWN
readonly SVG_LENGTHTYPE_UNKNOWN: 0;
unitType
readonly unitType: number;
The unitType property of the SVGLength interface that represents type of the value as specified by one of the SVG_LENGTHTYPE_* constants defined on this interface.
value
value: number;
The value property of the SVGLength interface represents the floating point value of the <length> in user units.
valueAsString
valueAsString: string;
The valueAsString property of the SVGLength interface represents the <length>'s value as a string, in the units expressed by unitType.
valueInSpecifiedUnits
valueInSpecifiedUnits: number;
The valueInSpecifiedUnits property of the SVGLength interface represents floating point value, in the units expressed by unitType.