svgcanvas.js

Summary
svgcanvas.js
Functions
saveSerializes the current drawing into SVG XML text and returns it to the ‘saved’ handler.
getSvgStringReturns the current drawing as raw SVG XML text.
setSvgStringThis function sets the current drawing as the input SVG XML.
createLayerThis function clears the selection and then creates a new top-level layer in the drawing with the given name and sets the current layer to it.
deleteCurrentLayerThis function clears the selection and then deletes the current layer from the drawing.
getNumLayersThis function returns the number of layers in the current drawing.

Functions

save

this.save = function()

Serializes the current drawing into SVG XML text and returns it to the ‘saved’ handler.  This function also includes the XML prolog.

Returns

Nothing

getSvgString

this.getSvgString = function()

Returns the current drawing as raw SVG XML text.

Returns

The current drawing as raw SVG XML text.

setSvgString

this.setSvgString = function(xmlString)

This function sets the current drawing as the input SVG XML.

Parameters

xmlStringThe SVG as XML text.

Returns

This function returns false if the set was unsuccessful, true otherwise.

createLayer

this.createLayer = function(name)

This function clears the selection and then creates a new top-level layer in the drawing with the given name and sets the current layer to it.  This function then calls the ‘changed’ handler.

Parameters

nameThe given name

deleteCurrentLayer

this.deleteCurrentLayer = function()

This function clears the selection and then deletes the current layer from the drawing.  This function then calls the ‘changed’ handler.

getNumLayers

this.getNumLayers = function()

This function returns the number of layers in the current drawing.

Returns

The number of layers in the current drawing.

this.save = function()
Serializes the current drawing into SVG XML text and returns it to the ‘saved’ handler.
this.getSvgString = function()
Returns the current drawing as raw SVG XML text.
this.setSvgString = function(xmlString)
This function sets the current drawing as the input SVG XML.
this.createLayer = function(name)
This function clears the selection and then creates a new top-level layer in the drawing with the given name and sets the current layer to it.
this.deleteCurrentLayer = function()
This function clears the selection and then deletes the current layer from the drawing.
this.getNumLayers = function()
This function returns the number of layers in the current drawing.
Close