Constructor
new SVGDocumentWrapper(svgRoot)
Initialize a new wrapper for a given SVG root element.
Parameters:
Name | Type | Description |
---|---|---|
svgRoot |
SVGSVGElement | An SVG root element. |
- Source:
Members
asText :string
A serialized representation of the current SVG document.
Type:
- string
- Source:
handler :function
The SVG handler class for the current SVG document.
Type:
- function
- Source:
(readonly) isValidSVG :boolean
Does the current root element belong to a valid SVG document?
Type:
- boolean
- Source:
root :SVGSVGElement
The current SVG root element.
Type:
- SVGSVGElement
- Source:
Methods
(static) fromString(data) → {module:svg/SVGDocumentWrapper.SVGDocumentWrapper}
Parse the given string into a new SVG document wrapper.
This method will also apply several preprocessing operations, some generic and some specific to a SVG handler.
Parameters:
Name | Type | Description |
---|---|---|
data |
string | A string containing a serialized SVG document. |
- Source:
- See:
Returns:
- A new SVG document wrapper.
disableHyperlinks(styledopt)
Disable the hyperlinks inside the document.
Hyperlinks are disabled in the editor only. This operation does not affect the saved presentation.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
styled |
boolean |
<optional> |
false | If |
- Source:
isLayer(svgNode) → {boolean}
Check whether an SVG element represents a layer.
The given node is a valid layer if it has the following characteristics:
- it is an SVG group element,
- it has an ID that has not been met before,
- it is recognized as a layer by the current SVG handler.
Parameters:
Name | Type | Description |
---|---|---|
svgNode |
Node | An XML node to check. |
- Source:
Returns:
true
if the given node represents a layer.
- Type
- boolean
removeScripts()
Remove the scripts embedded in the SVG.
The presentation editor operates on static SVG documents. Third-party scripts are removed because they could interfere with the editor.
Custom scripts can be added into the generated HTML via the presentation editor.
- Source:
removeViewbox()
Remove the viewBox
attribute from the SVG root element.
This attribute conflicts with the Sozi viewport. This method also sets the dimensions of the SVG root to 100%.
- Source: