Module: svgcanvas

Tools for SVG handle on JSON format.

License:
  • MIT
Source:
License:
  • MIT
Source:
License:
  • MIT
Source:

Classes

SvgCanvas

Methods

(static) svgRootElement svgRootElement the svg node and its children.(svgdoc, dimensions) → {svgRootElement}

Parameters:
Name Type Description
svgdoc Element

window.document

dimensions ArgumentsArray

dimensions of width and height

Source:
Returns:
Type
svgRootElement

(inner) ffClone(elem) → {Element}

Hack for Firefox bugs where text element features aren't updated or get messed up. See issue 136 and issue 137. This function clones the element and re-selects it.

Parameters:
Name Type Description
elem Element

The (text) DOM element to clone

Source:
To Do:
  • Test for this bug on load and add it to "support" object instead of browser sniffing
Returns:

Cloned element

Type
Element

(inner) findDuplicateGradient(grad) → {SVGGradientElement}

Check if exact gradient already exists.

Parameters:
Name Type Description
grad SVGGradientElement

The gradient DOM element to compare to others

Source:
Returns:

The existing gradient if found, null if not

Type
SVGGradientElement

Type Definitions

ChangedIDs

Type:
Source:

ExtensionNameFilter(name) → {boolean}

Parameters:
Name Type Description
name string
Source:
Returns:
Type
boolean

ExtensionStatus

Type:
  • module:svgcanvas.ExtensionMouseDownStatus | module:svgcanvas.ExtensionMouseUpStatus | module:svgcanvas.ExtensionIDsUpdatedStatus | Array.<module:locale.ExtensionLocaleData> | void
Source:
Tutorials:

ExtensionVarBuilder(name) → {module:svgcanvas.SvgCanvas#event:ext_addLangData}

Parameters:
Name Type Description
name string

The name of the extension

Source:
Returns:
Type
module:svgcanvas.SvgCanvas#event:ext_addLangData

ImageEmbeddedCallback(result) → {void}

Function to run when image data is found.

Parameters:
Name Type Description
result string | false

Data URL

Source:
Returns:
Type
void

ImageExportedResults

Type:
Properties:
Name Type Description
datauri string

Contents as a Data URL

bloburl string

May be the empty string

svg string

The SVG contents as a string

issues Array.<string>

The localization messages of issueCodes

issueCodes Array.<module:svgcanvas.IssueCode>

CanVG issues found with the SVG

type "PNG" | "JPEG" | "BMP" | "WEBP" | "ICO"

The chosen image type

mimeType "image/png" | "image/jpeg" | "image/bmp" | "image/webp"

The image MIME type

quality Float

A decimal between 0 and 1 (for use with JPEG or WEBP)

exportWindowName string

A convenience for passing along a window.name to target a window on which the export could be added

Source:

IssuesAndCodes

Type:
Properties:
Name Type Description
issueCodes Array.<string>

The locale-independent code names

issues Array.<string>

The localized descriptions

Source:

PDFExportedResults

Type:
Properties:
Name Type Description
svg string

The SVG PDF output

output string | ArrayBuffer | Blob | window

The output based on the outputType; if undefined, "datauristring", "dataurlstring", "datauri", or "dataurl", will be a string (undefined gives a document, while the others build as Data URLs; "datauri" and "dataurl" change the location of the current page); if "arraybuffer", will return ArrayBuffer; if "blob", returns a Blob; if "dataurlnewwindow", will change the current page's location and return a string if in Safari and no window object is found; otherwise opens in, and returns, a new window object; if "save", will have the same return as "dataurlnewwindow" if navigator.getUserMedia support is found without URL.createObjectURL support; otherwise returns undefined but attempts to save

outputType external:jsPDF.OutputType
issues Array.<string>

The human-readable localization messages of corresponding issueCodes

issueCodes Array.<module:svgcanvas.IssueCode>
exportWindowName string
Source:

Numerous tools for working with the editor's "canvas".

License:
  • MIT
Source:
License:
  • MIT
Source:
License:
  • MIT
Source:

Classes

SvgCanvas

Methods

(static) svgRootElement svgRootElement the svg node and its children.(svgdoc, dimensions) → {svgRootElement}

Parameters:
Name Type Description
svgdoc Element

window.document

dimensions ArgumentsArray

dimensions of width and height

Source:
Returns:
Type
svgRootElement

(inner) ffClone(elem) → {Element}

Hack for Firefox bugs where text element features aren't updated or get messed up. See issue 136 and issue 137. This function clones the element and re-selects it.

Parameters:
Name Type Description
elem Element

The (text) DOM element to clone

Source:
To Do:
  • Test for this bug on load and add it to "support" object instead of browser sniffing
Returns:

Cloned element

Type
Element

(inner) findDuplicateGradient(grad) → {SVGGradientElement}

Check if exact gradient already exists.

Parameters:
Name Type Description
grad SVGGradientElement

The gradient DOM element to compare to others

Source:
Returns:

The existing gradient if found, null if not

Type
SVGGradientElement

Type Definitions

ChangedIDs

Type:
Source:

ExtensionNameFilter(name) → {boolean}

Parameters:
Name Type Description
name string
Source:
Returns:
Type
boolean

ExtensionStatus

Type:
  • module:svgcanvas.ExtensionMouseDownStatus | module:svgcanvas.ExtensionMouseUpStatus | module:svgcanvas.ExtensionIDsUpdatedStatus | Array.<module:locale.ExtensionLocaleData> | void
Source:
Tutorials:

ExtensionVarBuilder(name) → {module:svgcanvas.SvgCanvas#event:ext_addLangData}

Parameters:
Name Type Description
name string

The name of the extension

Source:
Returns:
Type
module:svgcanvas.SvgCanvas#event:ext_addLangData

ImageEmbeddedCallback(result) → {void}

Function to run when image data is found.

Parameters:
Name Type Description
result string | false

Data URL

Source:
Returns:
Type
void

ImageExportedResults

Type:
Properties:
Name Type Description
datauri string

Contents as a Data URL

bloburl string

May be the empty string

svg string

The SVG contents as a string

issues Array.<string>

The localization messages of issueCodes

issueCodes Array.<module:svgcanvas.IssueCode>

CanVG issues found with the SVG

type "PNG" | "JPEG" | "BMP" | "WEBP" | "ICO"

The chosen image type

mimeType "image/png" | "image/jpeg" | "image/bmp" | "image/webp"

The image MIME type

quality Float

A decimal between 0 and 1 (for use with JPEG or WEBP)

exportWindowName string

A convenience for passing along a window.name to target a window on which the export could be added

Source:

IssuesAndCodes

Type:
Properties:
Name Type Description
issueCodes Array.<string>

The locale-independent code names

issues Array.<string>

The localized descriptions

Source:

PDFExportedResults

Type:
Properties:
Name Type Description
svg string

The SVG PDF output

output string | ArrayBuffer | Blob | window

The output based on the outputType; if undefined, "datauristring", "dataurlstring", "datauri", or "dataurl", will be a string (undefined gives a document, while the others build as Data URLs; "datauri" and "dataurl" change the location of the current page); if "arraybuffer", will return ArrayBuffer; if "blob", returns a Blob; if "dataurlnewwindow", will change the current page's location and return a string if in Safari and no window object is found; otherwise opens in, and returns, a new window object; if "save", will have the same return as "dataurlnewwindow" if navigator.getUserMedia support is found without URL.createObjectURL support; otherwise returns undefined but attempts to save

outputType external:jsPDF.OutputType
issues Array.<string>

The human-readable localization messages of corresponding issueCodes

issueCodes Array.<module:svgcanvas.IssueCode>
exportWindowName string
Source:

Tools for SVG Root Element.

License:
  • MIT
Source:
License:
  • MIT
Source:
License:
  • MIT
Source:

Classes

SvgCanvas

Methods

(static) svgRootElement svgRootElement the svg node and its children.(svgdoc, dimensions) → {svgRootElement}

Parameters:
Name Type Description
svgdoc Element

window.document

dimensions ArgumentsArray

dimensions of width and height

Source:
Returns:
Type
svgRootElement

(inner) ffClone(elem) → {Element}

Hack for Firefox bugs where text element features aren't updated or get messed up. See issue 136 and issue 137. This function clones the element and re-selects it.

Parameters:
Name Type Description
elem Element

The (text) DOM element to clone

Source:
To Do:
  • Test for this bug on load and add it to "support" object instead of browser sniffing
Returns:

Cloned element

Type
Element

(inner) findDuplicateGradient(grad) → {SVGGradientElement}

Check if exact gradient already exists.

Parameters:
Name Type Description
grad SVGGradientElement

The gradient DOM element to compare to others

Source:
Returns:

The existing gradient if found, null if not

Type
SVGGradientElement

Type Definitions

ChangedIDs

Type:
Source:

ExtensionNameFilter(name) → {boolean}

Parameters:
Name Type Description
name string
Source:
Returns:
Type
boolean

ExtensionStatus

Type:
  • module:svgcanvas.ExtensionMouseDownStatus | module:svgcanvas.ExtensionMouseUpStatus | module:svgcanvas.ExtensionIDsUpdatedStatus | Array.<module:locale.ExtensionLocaleData> | void
Source:
Tutorials:

ExtensionVarBuilder(name) → {module:svgcanvas.SvgCanvas#event:ext_addLangData}

Parameters:
Name Type Description
name string

The name of the extension

Source:
Returns:
Type
module:svgcanvas.SvgCanvas#event:ext_addLangData

ImageEmbeddedCallback(result) → {void}

Function to run when image data is found.

Parameters:
Name Type Description
result string | false

Data URL

Source:
Returns:
Type
void

ImageExportedResults

Type:
Properties:
Name Type Description
datauri string

Contents as a Data URL

bloburl string

May be the empty string

svg string

The SVG contents as a string

issues Array.<string>

The localization messages of issueCodes

issueCodes Array.<module:svgcanvas.IssueCode>

CanVG issues found with the SVG

type "PNG" | "JPEG" | "BMP" | "WEBP" | "ICO"

The chosen image type

mimeType "image/png" | "image/jpeg" | "image/bmp" | "image/webp"

The image MIME type

quality Float

A decimal between 0 and 1 (for use with JPEG or WEBP)

exportWindowName string

A convenience for passing along a window.name to target a window on which the export could be added

Source:

IssuesAndCodes

Type:
Properties:
Name Type Description
issueCodes Array.<string>

The locale-independent code names

issues Array.<string>

The localized descriptions

Source:

PDFExportedResults

Type:
Properties:
Name Type Description
svg string

The SVG PDF output

output string | ArrayBuffer | Blob | window

The output based on the outputType; if undefined, "datauristring", "dataurlstring", "datauri", or "dataurl", will be a string (undefined gives a document, while the others build as Data URLs; "datauri" and "dataurl" change the location of the current page); if "arraybuffer", will return ArrayBuffer; if "blob", returns a Blob; if "dataurlnewwindow", will change the current page's location and return a string if in Safari and no window object is found; otherwise opens in, and returns, a new window object; if "save", will have the same return as "dataurlnewwindow" if navigator.getUserMedia support is found without URL.createObjectURL support; otherwise returns undefined but attempts to save

outputType external:jsPDF.OutputType
issues Array.<string>

The human-readable localization messages of corresponding issueCodes

issueCodes Array.<module:svgcanvas.IssueCode>
exportWindowName string
Source: