Class: DefaultSVGHandler

svg/SVGDocumentWrapper.DefaultSVGHandler()

Base class for SVG handlers.

An SVG handler provides support for SVG documents created by a given authoring application.

Constructor

new DefaultSVGHandler()

Source:

Methods

(static) getLabel(svgElement) → (nullable) {string}

Get the label of a layer represented by the given SVG group.

If a group has been identified as a layer, this method will return the name/title/label of this layer if it exists.

Parameters:
Name Type Description
svgElement SVGGElement

A group to check.

Source:
Returns:
  • The label of the layer.
Type
string

(static) isLayer(svgElement) → {boolean}

Check whether an SVG group represents a layer.

The concept of layer is not specified in the SVG standard. This method will check the given element against the implementation of layers according to a given application.

Parameters:
Name Type Description
svgElement SVGGElement

A group to check.

Source:
Returns:
  • true if the given element represents a layer.
Type
boolean

(static) matches(svgRoot) → {boolean}

Check that an SVG document has been created with a given application.

Parameters:
Name Type Description
svgRoot SVGSVGElement

The root SVG element to check.

Source:
Returns:
  • true if the given SVG root has been created by the application handled by this class.
Type
boolean

(static) transform(svgRoot)

Preprocess an SVG document.

This method will transform an SVG document to make it suitable for the Sozi editor.

Typical transformations consist in removing unsupported XML elements, or fixing properties that could conflict with Sozi.

Parameters:
Name Type Description
svgRoot SVGSVGElement

The root SVG element to check.

Source: