Dart API Referencedart:htmlSVGLength

SVGLength Interface

The SVGLength interface correspond to the <length> basic data type.

An SVGLength object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown.

Static Fields

Code final int SVG_LENGTHTYPE_CM #

static final int SVG_LENGTHTYPE_CM = 6;

Code final int SVG_LENGTHTYPE_EMS #

static final int SVG_LENGTHTYPE_EMS = 3;

Code final int SVG_LENGTHTYPE_EXS #

static final int SVG_LENGTHTYPE_EXS = 4;

Code final int SVG_LENGTHTYPE_IN #

static final int SVG_LENGTHTYPE_IN = 8;

Code final int SVG_LENGTHTYPE_MM #

static final int SVG_LENGTHTYPE_MM = 7;

Code final int SVG_LENGTHTYPE_NUMBER #

static final int SVG_LENGTHTYPE_NUMBER = 1;

Code final int SVG_LENGTHTYPE_PC #

static final int SVG_LENGTHTYPE_PC = 10;

Code final int SVG_LENGTHTYPE_PERCENTAGE #

static final int SVG_LENGTHTYPE_PERCENTAGE = 2;

Code final int SVG_LENGTHTYPE_PT #

static final int SVG_LENGTHTYPE_PT = 9;

Code final int SVG_LENGTHTYPE_PX #

static final int SVG_LENGTHTYPE_PX = 5;

Code final int SVG_LENGTHTYPE_UNKNOWN #

static final int SVG_LENGTHTYPE_UNKNOWN = 0;

Methods

Code void convertToSpecifiedUnits(int unitType) #

Preserve the same underlying stored value, but reset the stored unit identifier to the given unitType. Object attributes unitType, valueInSpecifiedUnits and valueAsString might be modified as a result of this method. For example, if the original value were "0.5cm" and the method was invoked to convert to millimeters, then the unitType would be changed to SVG_LENGTHTYPE_MM, valueInSpecifiedUnits would be changed to the numeric value 5 and valueAsString would be changed to "5mm".
void convertToSpecifiedUnits(int unitType);

Code void newValueSpecifiedUnits(int unitType, num valueInSpecifiedUnits) #

Reset the value as a number with an associated unitType, thereby replacing the values for all of the attributes on the object.

Exceptions:

  • a DOMException with code NOT_SUPPORTED_ERR is raised if unitType is SVG_LENGTHTYPE_UNKNOWN or not a valid unit type constant (one of the other SVG_LENGTHTYPE_* constants defined on this interface).
  • a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the length corresponds to a read only attribute or when the object itself is read only.
void newValueSpecifiedUnits(int unitType, num valueInSpecifiedUnits);

Fields

Code final int unitType #

The type of the value as specified by one of the SVG_LENGTHTYPE_* constants defined on this interface.
final int unitType;

Code num value #

The value as a floating point value, in user units. Setting this attribute will cause valueInSpecifiedUnits and valueAsString to be updated automatically to reflect this setting.

Exceptions on setting: a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the length corresponds to a read only attribute or when the object itself is read only.

num value;

Code String valueAsString #

The value as a string value, in the units expressed by unitType. Setting this attribute will cause value, valueInSpecifiedUnits and unitType to be updated automatically to reflect this setting.

Exceptions on setting:

  • a DOMException with code SYNTAX_ERR is raised if the assigned string cannot be parsed as a valid <length>.
  • a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the length corresponds to a read only attribute or when the object itself is read only.
String valueAsString;

Code num valueInSpecifiedUnits #

The value as a floating point value, in the units expressed by unitType. Setting this attribute will cause value and valueAsString to be updated automatically to reflect this setting.

Exceptions on setting: a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the length corresponds to a read only attribute or when the object itself is read only.

num valueInSpecifiedUnits;

This page includes content from the Mozilla Foundation that is graciously licensed under a Creative Commons: Attribution-Sharealike license. Mozilla has no other association with Dart or dartlang.org. We encourage you to improve the web by contributing to The Mozilla Developer Network.