diff --git a/docs/files/svgcanvas-js.html b/docs/files/svgcanvas-js.html index ad72c38b..0f107813 100644 --- a/docs/files/svgcanvas-js.html +++ b/docs/files/svgcanvas-js.html @@ -11,7 +11,7 @@ if (browserType) {document.write("
The main SvgCanvas class that manages all SVG-related functions
container | The container HTML element that should hold the SVG root element |
config | An object that contains configuration data |
SvgCanvas | The main SvgCanvas class that manages all SVG-related functions |
toXml | Converts characters in a string to XML-friendly entities. |
fromXml | Converts XML entities in a string to single characters. |
Unit conversion functions | |
convertToNum | Converts given values to numbers. |
setUnitAttr | Sets an element’s attribute based on the unit in its current value. |
isValidUnit | Check if an attribute’s value is in a valid format |
Undo/ | |
ChangeElementCommand | History command to make a change to an element. |
ChangeElementCommand. | Performs the stored change action |
ChangeElementCommand. | Reverses the stored change action |
ChangeElementCommand. | Returns array with element associated with this command |
InsertElementCommand | History command for an element that was added to the DOM |
InsertElementCommand. | Re-Inserts the new element |
InsertElementCommand. | Removes the element |
InsertElementCommand. | Returns array with element associated with this command |
RemoveElementCommand | History command for an element removed from the DOM |
RemoveElementCommand. | Re-removes the new element |
RemoveElementCommand. | Re-adds the new element |
RemoveElementCommand. | Returns array with element associated with this command |
MoveElementCommand | History command for an element that had its DOM position changed |
MoveElementCommand. | Re-positions the element |
MoveElementCommand. | Positions the element back to its original location |
MoveElementCommand. | Returns array with element associated with this command |
BatchCommand | History command that can contain/execute multiple other commands |
BatchCommand. | Runs “apply” on all subcommands |
BatchCommand. | Runs “unapply” on all subcommands |
BatchCommand. | Iterate through all our subcommands and returns all the elements we are changing |
BatchCommand. | Adds a given command to the history stack |
BatchCommand. | Returns a boolean indicating whether or not the batch command is empty |
resetUndoStack | Resets the undo stack, effectively clearing the undo/redo history |
undoMgr. | Integer with the current size of the undo history stack |
undoMgr. | Integer with the current size of the redo history stack |
undoMgr. | String associated with the next undo command |
undoMgr. | String associated with the next redo command |
undoMgr.undo | Performs an undo step |
undoMgr.redo | Performs a redo step |
addCommandToHistory | Adds a command object to the undo history stack |
beginUndoableChange | This function tells the canvas to remember the old values of the attrName attribute for each element sent in. |
finishUndoableChange | This function returns a BatchCommand object which summarizes the change since beginUndoableChange was called. |
Selector | Private class for DOM element selection boxes |
Functions | |
Selector. | Used to reset the id and element that the selector is attached to |
Selector. | Show the resize grips of this selector |
Selector. | Updates cursors for corner grips on rotation so arrows point the right way |
Selector. | Updates the selector to match the element’s size |
SelectorManager | Public class to manage all selector objects (selection boxes) |
SelectorManager. | Resets the parent selector group element |
SelectorManager. | Returns the selector based on the given element |
SelectorManager. | Removes the selector of the given element (hides selection box) |
SelectorManager. | Returns the rubberBandBox DOM element. |
Helper functions | |
walkTree | Walks the tree and executes the callback on each element in a top-down fashion |
walkTreePost | Walks the tree and executes the callback on each element in a depth-first fashion |
assignAttributes | Assigns multiple attributes to an element. |
cleanupElement | Remove unneeded (default) attributes, makes resulting SVG smaller |
addSvgElementFromJson | Create a new SVG element based on the given object keys/values and add it to the current layer The element will be ran through cleanupElement before being returned |
shortFloat | Rounds a given value to a float with number of digits defined in save_options |
getId | Returns the last created DOM element ID string |
getNextId | Creates and returns a unique ID string for a DOM element |
bind | Attaches a callback function to an event |
setIdPrefix | Changes the ID prefix to the given value |
sanitizeSvg | Sanitizes the input node and its children It only keeps what is allowed from our whitelist defined above |
getUrlFromAttr | Extracts the URL from the url(...) |
Element Transforms | |
recalculateAllSelectedDimensions | Runs recalculateDimensions on the selected elements, adding the changes to a single batch command |
remapElement | Applies coordinate changes to an element based on the given matrix |
recalculateDimensions | Decides the course of action based on the element’s transform list |
transformPoint | A (hopefully) quicker function to transform a point by a matrix (this function avoids any DOM calls and just does the math) |
isIdentity | Helper function to check if the matrix performs no actual transform (i.e. |
matrixMultiply | This function tries to return a SVGMatrix that is the multiplication m1*m2. |
transformListToTransform | This returns a single matrix Transform for a given Transform List (this is the equivalent of SVGTransformList.consolidate() but unlike that method, this one does not modify the actual SVGTransformList) This function is very liberal with its min,max arguments |
hasMatrixTransform | See if the given transformlist includes a non-indentity matrix transform |
getMatrix | Get the matrix object for a given element |
transformBox | Transforms a rectangle based on the given matrix |
Selection | |
clearSelection | Clears the selection. |
addToSelection | Adds a list of elements to the selection. |
removeFromSelection | Removes elements from the selection. |
smoothControlPoints | Takes three points and creates a smoother line based on them |
getMouseTarget | Gets the desired element from a mouse event |
textActions | Functions relating to editing text elements |
pathActions | Functions relating to editing path elements |
Serialization | |
removeUnusedDefElems | Looks at DOM elements inside the <defs> to see if they are referred to, removes them from the DOM if they are not. |
svgCanvasToString | Main function to set up the SVG content for output |
svgToString | Sub function ran on each SVG element to convert it to a string as desired |
embedImage | Converts a given image file to a data URL when possible, then runs a given callback |
save | Serializes the current drawing into SVG XML text and returns it to the ‘saved’ handler. |
rasterExport | Generates a PNG Data URL based on the current image, then calls “exported” with an object including the string and any issues found |
getSvgString | Returns the current drawing as raw SVG XML text. |
setSvgString | This function sets the current drawing as the input SVG XML. |
importSvgString | This function imports the input SVG XML into the current layer in the drawing |
Layers | |
createLayer | Creates a new top-level layer in the drawing with the given name, sets the current layer to it, and then clears the selection This function then calls the ‘changed’ handler. |
deleteCurrentLayer | Deletes the current layer from the drawing and then clears the selection. |
getNumLayers | Returns the number of layers in the current drawing. |
getLayer | Returns the name of the ith layer. |
getCurrentLayer | Returns the name of the currently selected layer. |
setCurrentLayer | Sets the current layer. |
renameCurrentLayer | Renames the current layer. |
setCurrentLayerPosition | Changes the position of the current layer to the new value. |
getLayerVisibility | Returns whether the layer is visible. |
setLayerVisibility | Sets the visibility of the layer. |
moveSelectedToLayer | Moves the selected elements to layername. |
getLayerOpacity | Returns the opacity of the given layer. |
setLayerOpacity | Sets the opacity of the given layer. |
selectAllInCurrentLayer | Clears the selection, then adds all elements in the current layer to the selection. |
clear | Clears the current document. |
Fill and Stroke | |
convertToPath | Convert selected element to a path, or get the BBox of an element-as-path |
getVersion | Returns a string which describes the revision number of SvgCanvas. |
The main SvgCanvas class that manages all SVG-related functions
container | The container HTML element that should hold the SVG root element |
config | An object that contains configuration data |
SvgCanvas | The main SvgCanvas class that manages all SVG-related functions |
toXml | Converts characters in a string to XML-friendly entities. |
fromXml | Converts XML entities in a string to single characters. |
Unit conversion functions | |
convertToNum | Converts given values to numbers. |
setUnitAttr | Sets an element’s attribute based on the unit in its current value. |
isValidUnit | Check if an attribute’s value is in a valid format |
Undo/ | |
ChangeElementCommand | History command to make a change to an element. |
ChangeElementCommand. | Performs the stored change action |
ChangeElementCommand. | Reverses the stored change action |
ChangeElementCommand. | Returns array with element associated with this command |
InsertElementCommand | History command for an element that was added to the DOM |
InsertElementCommand. | Re-Inserts the new element |
InsertElementCommand. | Removes the element |
InsertElementCommand. | Returns array with element associated with this command |
RemoveElementCommand | History command for an element removed from the DOM |
RemoveElementCommand. | Re-removes the new element |
RemoveElementCommand. | Re-adds the new element |
RemoveElementCommand. | Returns array with element associated with this command |
MoveElementCommand | History command for an element that had its DOM position changed |
MoveElementCommand. | Re-positions the element |
MoveElementCommand. | Positions the element back to its original location |
MoveElementCommand. | Returns array with element associated with this command |
BatchCommand | History command that can contain/execute multiple other commands |
BatchCommand. | Runs “apply” on all subcommands |
BatchCommand. | Runs “unapply” on all subcommands |
BatchCommand. | Iterate through all our subcommands and returns all the elements we are changing |
BatchCommand. | Adds a given command to the history stack |
BatchCommand. | Returns a boolean indicating whether or not the batch command is empty |
resetUndoStack | Resets the undo stack, effectively clearing the undo/redo history |
undoMgr. | Integer with the current size of the undo history stack |
undoMgr. | Integer with the current size of the redo history stack |
undoMgr. | String associated with the next undo command |
undoMgr. | String associated with the next redo command |
undoMgr.undo | Performs an undo step |
undoMgr.redo | Performs a redo step |
addCommandToHistory | Adds a command object to the undo history stack |
beginUndoableChange | This function tells the canvas to remember the old values of the attrName attribute for each element sent in. |
finishUndoableChange | This function returns a BatchCommand object which summarizes the change since beginUndoableChange was called. |
Selector | Private class for DOM element selection boxes |
Functions | |
Selector. | Used to reset the id and element that the selector is attached to |
Selector. | Show the resize grips of this selector |
Selector. | Updates cursors for corner grips on rotation so arrows point the right way |
Selector. | Updates the selector to match the element’s size |
SelectorManager | Public class to manage all selector objects (selection boxes) |
SelectorManager. | Resets the parent selector group element |
SelectorManager. | Returns the selector based on the given element |
SelectorManager. | Removes the selector of the given element (hides selection box) |
SelectorManager. | Returns the rubberBandBox DOM element. |
Helper functions | |
walkTree | Walks the tree and executes the callback on each element in a top-down fashion |
walkTreePost | Walks the tree and executes the callback on each element in a depth-first fashion |
assignAttributes | Assigns multiple attributes to an element. |
cleanupElement | Remove unneeded (default) attributes, makes resulting SVG smaller |
addSvgElementFromJson | Create a new SVG element based on the given object keys/values and add it to the current layer The element will be ran through cleanupElement before being returned |
shortFloat | Rounds a given value to a float with number of digits defined in save_options |
getId | Returns the last created DOM element ID string |
getNextId | Creates and returns a unique ID string for a DOM element |
bind | Attaches a callback function to an event |
setIdPrefix | Changes the ID prefix to the given value |
sanitizeSvg | Sanitizes the input node and its children It only keeps what is allowed from our whitelist defined above |
getUrlFromAttr | Extracts the URL from the url(...) |
Element Transforms | |
recalculateAllSelectedDimensions | Runs recalculateDimensions on the selected elements, adding the changes to a single batch command |
remapElement | Applies coordinate changes to an element based on the given matrix |
recalculateDimensions | Decides the course of action based on the element’s transform list |
transformPoint | A (hopefully) quicker function to transform a point by a matrix (this function avoids any DOM calls and just does the math) |
isIdentity | Helper function to check if the matrix performs no actual transform (i.e. |
matrixMultiply | This function tries to return a SVGMatrix that is the multiplication m1*m2. |
transformListToTransform | This returns a single matrix Transform for a given Transform List (this is the equivalent of SVGTransformList.consolidate() but unlike that method, this one does not modify the actual SVGTransformList) This function is very liberal with its min,max arguments |
hasMatrixTransform | See if the given transformlist includes a non-indentity matrix transform |
getMatrix | Get the matrix object for a given element |
transformBox | Transforms a rectangle based on the given matrix |
Selection | |
clearSelection | Clears the selection. |
addToSelection | Adds a list of elements to the selection. |
removeFromSelection | Removes elements from the selection. |
selectAllInCurrentLayer | Clears the selection, then adds all elements in the current layer to the selection. |
smoothControlPoints | Takes three points and creates a smoother line based on them |
getMouseTarget | Gets the desired element from a mouse event |
textActions | Functions relating to editing text elements |
pathActions | Functions relating to editing path elements |
Serialization | |
removeUnusedDefElems | Looks at DOM elements inside the <defs> to see if they are referred to, removes them from the DOM if they are not. |
svgCanvasToString | Main function to set up the SVG content for output |
svgToString | Sub function ran on each SVG element to convert it to a string as desired |
embedImage | Converts a given image file to a data URL when possible, then runs a given callback |
save | Serializes the current drawing into SVG XML text and returns it to the ‘saved’ handler. |
rasterExport | Generates a PNG Data URL based on the current image, then calls “exported” with an object including the string and any issues found |
getSvgString | Returns the current drawing as raw SVG XML text. |
setSvgString | This function sets the current drawing as the input SVG XML. |
importSvgString | This function imports the input SVG XML into the current layer in the drawing |
Layers | |
identifyLayers | Updates layer system |
createLayer | Creates a new top-level layer in the drawing with the given name, sets the current layer to it, and then clears the selection This function then calls the ‘changed’ handler. |
deleteCurrentLayer | Deletes the current layer from the drawing and then clears the selection. |
getNumLayers | Returns the number of layers in the current drawing. |
getLayer | Returns the name of the ith layer. |
getCurrentLayer | Returns the name of the currently selected layer. |
setCurrentLayer | Sets the current layer. |
renameCurrentLayer | Renames the current layer. |
setCurrentLayerPosition | Changes the position of the current layer to the new value. |
getLayerVisibility | Returns whether the layer is visible. |
setLayerVisibility | Sets the visibility of the layer. |
moveSelectedToLayer | Moves the selected elements to layername. |
getLayerOpacity | Returns the opacity of the given layer. |
setLayerOpacity | Sets the opacity of the given layer. |
User actions | |
clear | Clears the current document. |
linkControlPoints | Alias function |
getContentElem | Returns the content DOM element |
getRootElem | Returns the root DOM element |
getSelectedElems | Returns the array with selected DOM elements |
getResolution | Returns the current dimensions and zoom level in an object |
getDocumentTitle | Returns the current document title or an empty string if not found |
setDocumentTitle | Adds/updates a title element for the document with the given name. |
Fill and Stroke | |
convertToPath | Convert selected element to a path, or get the BBox of an element-as-path |
getVersion | Returns a string which describes the revision number of SvgCanvas. |
Public class to manage all selector objects (selection boxes)
SelectorManager. | Resets the parent selector group element |
SelectorManager. | Returns the selector based on the given element |
SelectorManager. | Removes the selector of the given element (hides selection box) |
SelectorManager. | Returns the rubberBandBox DOM element. |
Helper functions | |
walkTree | Walks the tree and executes the callback on each element in a top-down fashion |
walkTreePost | Walks the tree and executes the callback on each element in a depth-first fashion |
assignAttributes | Assigns multiple attributes to an element. |
cleanupElement | Remove unneeded (default) attributes, makes resulting SVG smaller |
addSvgElementFromJson | Create a new SVG element based on the given object keys/values and add it to the current layer The element will be ran through cleanupElement before being returned |
shortFloat | Rounds a given value to a float with number of digits defined in save_options |
getId | Returns the last created DOM element ID string |
getNextId | Creates and returns a unique ID string for a DOM element |
bind | Attaches a callback function to an event |
setIdPrefix | Changes the ID prefix to the given value |
sanitizeSvg | Sanitizes the input node and its children It only keeps what is allowed from our whitelist defined above |
getUrlFromAttr | Extracts the URL from the url(...) |
Element Transforms | |
recalculateAllSelectedDimensions | Runs recalculateDimensions on the selected elements, adding the changes to a single batch command |
remapElement | Applies coordinate changes to an element based on the given matrix |
recalculateDimensions | Decides the course of action based on the element’s transform list |
transformPoint | A (hopefully) quicker function to transform a point by a matrix (this function avoids any DOM calls and just does the math) |
isIdentity | Helper function to check if the matrix performs no actual transform (i.e. |
matrixMultiply | This function tries to return a SVGMatrix that is the multiplication m1*m2. |
transformListToTransform | This returns a single matrix Transform for a given Transform List (this is the equivalent of SVGTransformList.consolidate() but unlike that method, this one does not modify the actual SVGTransformList) This function is very liberal with its min,max arguments |
hasMatrixTransform | See if the given transformlist includes a non-indentity matrix transform |
getMatrix | Get the matrix object for a given element |
transformBox | Transforms a rectangle based on the given matrix |
Selection | |
clearSelection | Clears the selection. |
addToSelection | Adds a list of elements to the selection. |
removeFromSelection | Removes elements from the selection. |
smoothControlPoints | Takes three points and creates a smoother line based on them |
getMouseTarget | Gets the desired element from a mouse event |
Public class to manage all selector objects (selection boxes)
SelectorManager. | Resets the parent selector group element |
SelectorManager. | Returns the selector based on the given element |
SelectorManager. | Removes the selector of the given element (hides selection box) |
SelectorManager. | Returns the rubberBandBox DOM element. |
Helper functions | |
walkTree | Walks the tree and executes the callback on each element in a top-down fashion |
walkTreePost | Walks the tree and executes the callback on each element in a depth-first fashion |
assignAttributes | Assigns multiple attributes to an element. |
cleanupElement | Remove unneeded (default) attributes, makes resulting SVG smaller |
addSvgElementFromJson | Create a new SVG element based on the given object keys/values and add it to the current layer The element will be ran through cleanupElement before being returned |
shortFloat | Rounds a given value to a float with number of digits defined in save_options |
getId | Returns the last created DOM element ID string |
getNextId | Creates and returns a unique ID string for a DOM element |
bind | Attaches a callback function to an event |
setIdPrefix | Changes the ID prefix to the given value |
sanitizeSvg | Sanitizes the input node and its children It only keeps what is allowed from our whitelist defined above |
getUrlFromAttr | Extracts the URL from the url(...) |
Element Transforms | |
recalculateAllSelectedDimensions | Runs recalculateDimensions on the selected elements, adding the changes to a single batch command |
remapElement | Applies coordinate changes to an element based on the given matrix |
recalculateDimensions | Decides the course of action based on the element’s transform list |
transformPoint | A (hopefully) quicker function to transform a point by a matrix (this function avoids any DOM calls and just does the math) |
isIdentity | Helper function to check if the matrix performs no actual transform (i.e. |
matrixMultiply | This function tries to return a SVGMatrix that is the multiplication m1*m2. |
transformListToTransform | This returns a single matrix Transform for a given Transform List (this is the equivalent of SVGTransformList.consolidate() but unlike that method, this one does not modify the actual SVGTransformList) This function is very liberal with its min,max arguments |
hasMatrixTransform | See if the given transformlist includes a non-indentity matrix transform |
getMatrix | Get the matrix object for a given element |
transformBox | Transforms a rectangle based on the given matrix |
Selection | |
clearSelection | Clears the selection. |
addToSelection | Adds a list of elements to the selection. |
removeFromSelection | Removes elements from the selection. |
selectAllInCurrentLayer | Clears the selection, then adds all elements in the current layer to the selection. |
smoothControlPoints | Takes three points and creates a smoother line based on them |
getMouseTarget | Gets the desired element from a mouse event |
var smoothControlPoints = this.smoothControlPoints = function( ct1, ct2, pt )
Takes three points and creates a smoother line based on them
ct1 | Object with x and y values (first control point) |
ct2 | Object with x and y values (second control point) |
pt | Object with x and y values (third point) |
Array of two “smoothed” point objects
Functions relating to editing path elements
Serialization | |
removeUnusedDefElems | Looks at DOM elements inside the <defs> to see if they are referred to, removes them from the DOM if they are not. |
svgCanvasToString | Main function to set up the SVG content for output |
svgToString | Sub function ran on each SVG element to convert it to a string as desired |
embedImage | Converts a given image file to a data URL when possible, then runs a given callback |
save | Serializes the current drawing into SVG XML text and returns it to the ‘saved’ handler. |
rasterExport | Generates a PNG Data URL based on the current image, then calls “exported” with an object including the string and any issues found |
getSvgString | Returns the current drawing as raw SVG XML text. |
setSvgString | This function sets the current drawing as the input SVG XML. |
importSvgString | This function imports the input SVG XML into the current layer in the drawing |
Layers | |
createLayer | Creates a new top-level layer in the drawing with the given name, sets the current layer to it, and then clears the selection This function then calls the ‘changed’ handler. |
deleteCurrentLayer | Deletes the current layer from the drawing and then clears the selection. |
getNumLayers | Returns the number of layers in the current drawing. |
getLayer | Returns the name of the ith layer. |
getCurrentLayer | Returns the name of the currently selected layer. |
setCurrentLayer | Sets the current layer. |
renameCurrentLayer | Renames the current layer. |
setCurrentLayerPosition | Changes the position of the current layer to the new value. |
getLayerVisibility | Returns whether the layer is visible. |
setLayerVisibility | Sets the visibility of the layer. |
moveSelectedToLayer | Moves the selected elements to layername. |
getLayerOpacity | Returns the opacity of the given layer. |
setLayerOpacity | Sets the opacity of the given layer. |
selectAllInCurrentLayer | Clears the selection, then adds all elements in the current layer to the selection. |
clear | Clears the current document. |
Fill and Stroke | |
convertToPath | Convert selected element to a path, or get the BBox of an element-as-path |
getVersion | Returns a string which describes the revision number of SvgCanvas. |
Functions relating to editing path elements
Serialization | |
removeUnusedDefElems | Looks at DOM elements inside the <defs> to see if they are referred to, removes them from the DOM if they are not. |
svgCanvasToString | Main function to set up the SVG content for output |
svgToString | Sub function ran on each SVG element to convert it to a string as desired |
embedImage | Converts a given image file to a data URL when possible, then runs a given callback |
save | Serializes the current drawing into SVG XML text and returns it to the ‘saved’ handler. |
rasterExport | Generates a PNG Data URL based on the current image, then calls “exported” with an object including the string and any issues found |
getSvgString | Returns the current drawing as raw SVG XML text. |
setSvgString | This function sets the current drawing as the input SVG XML. |
importSvgString | This function imports the input SVG XML into the current layer in the drawing |
Layers | |
identifyLayers | Updates layer system |
createLayer | Creates a new top-level layer in the drawing with the given name, sets the current layer to it, and then clears the selection This function then calls the ‘changed’ handler. |
deleteCurrentLayer | Deletes the current layer from the drawing and then clears the selection. |
getNumLayers | Returns the number of layers in the current drawing. |
getLayer | Returns the name of the ith layer. |
getCurrentLayer | Returns the name of the currently selected layer. |
setCurrentLayer | Sets the current layer. |
renameCurrentLayer | Renames the current layer. |
setCurrentLayerPosition | Changes the position of the current layer to the new value. |
getLayerVisibility | Returns whether the layer is visible. |
setLayerVisibility | Sets the visibility of the layer. |
moveSelectedToLayer | Moves the selected elements to layername. |
getLayerOpacity | Returns the opacity of the given layer. |
setLayerOpacity | Sets the opacity of the given layer. |
User actions | |
clear | Clears the current document. |
linkControlPoints | Alias function |
getContentElem | Returns the content DOM element |
getRootElem | Returns the root DOM element |
getSelectedElems | Returns the array with selected DOM elements |
getResolution | Returns the current dimensions and zoom level in an object |
getDocumentTitle | Returns the current document title or an empty string if not found |
setDocumentTitle | Adds/updates a title element for the document with the given name. |
Fill and Stroke | |
convertToPath | Convert selected element to a path, or get the BBox of an element-as-path |
getVersion | Returns a string which describes the revision number of SvgCanvas. |
this.importSvgString = function( xmlString )
This function imports the input SVG XML into the current layer in the drawing
xmlString | The SVG as XML text. |
This function returns false if the import was unsuccessful, true otherwise. TODO: properly handle if namespace is introduced by imported content (must add to svgcontent and update all prefixes in the imported node) TODO: properly handle recalculating dimensions, recalculateDimensions() doesn’t handle arbitrary transform lists, but makes some assumptions about how the transform list was obtained TODO: import should happen in top-left of current zoomed viewport TODO: create a new layer for the imported SVG
this.importSvgString = function( xmlString )
This function imports the input SVG XML into the current layer in the drawing
xmlString | The SVG as XML text. |
This function returns false if the import was unsuccessful, true otherwise. TODO:
this.setLayerOpacity = function( layername, opacity )
Sets the opacity of the given layer. If the input name is not a layer, nothing happens. This is not an undo-able action. NOTE: this function exists solely to apply a highlighting/de-emphasis effect to a layer, when it is possible for a user to affect the opacity of a layer, we will need to allow this function to produce an undo-able action. If opacity is not a value between 0.0 and 1.0, then nothing happens.
layername | name of the layer on which to set the opacity |
opacity | a float value in the range 0.0-1.0 |
this.convertToPath = function( elem, getBBox )
Convert selected element to a path, or get the BBox of an element-as-path
elem | The DOM element to be converted |
getBBox | Boolean on whether or not to only return the path’s BBox |
If the getBBox flag is true, the resulting path’s bounding box object. Otherwise the resulting path element is returned.
Converts characters in a string to XML-friendly entities.
toXml = function( str )
Converts XML entities in a string to single characters.
fromXml = function( str )
Converts given values to numbers.
convertToNum = function( attr, val )
Sets an element’s attribute based on the unit in its current value.
setUnitAttr = function( elem, attr, val )
Check if an attribute’s value is in a valid format
canvas.isValidUnit = function( attr, val )
History command to make a change to an element.
var ChangeElementCommand = this.undoCmd.changeElement = function( elem, attrs, text )
History command for an element that was added to the DOM
var InsertElementCommand = this.undoCmd.insertElement = function( elem, text )
History command for an element removed from the DOM
var RemoveElementCommand = this.undoCmd.removeElement = function( elem, parent, text )
History command for an element that had its DOM position changed
var MoveElementCommand = this.undoCmd.moveElement = function( elem, oldNextSibling, oldParent, text )
History command that can contain/execute multiple other commands
var BatchCommand = this.undoCmd.batch = function( text )
Resets the undo stack, effectively clearing the undo/redo history
resetUndoStack = function()
Adds a command object to the undo history stack
addCommandToHistory = c.undoCmd.add = function( cmd )
This function tells the canvas to remember the old values of the attrName attribute for each element sent in.
c.beginUndoableChange = function( attrName, elems )
This function returns a BatchCommand object which summarizes the change since beginUndoableChange was called.
c.finishUndoableChange = function()
Walks the tree and executes the callback on each element in a top-down fashion
function walkTree( elem, cbFn )
Walks the tree and executes the callback on each element in a depth-first fashion
function walkTreePost( elem, cbFn )
Assigns multiple attributes to an element.
var assignAttributes = this.assignAttributes = function( node, attrs, suspendLength, unitCheck )
Remove unneeded (default) attributes, makes resulting SVG smaller
var cleanupElement = this.cleanupElement = function( element )
Create a new SVG element based on the given object keys/values and add it to the current layer The element will be ran through cleanupElement before being returned
var addSvgElementFromJson = this.addSvgElementFromJson = function( data )
Rounds a given value to a float with number of digits defined in save_options
var shortFloat = function( val )
Returns the last created DOM element ID string
getId = c.getId = function()
Creates and returns a unique ID string for a DOM element
getNextId = c.getNextId = function()
Attaches a callback function to an event
c.bind = function( event, f )
Changes the ID prefix to the given value
c.setIdPrefix = function( p )
Sanitizes the input node and its children It only keeps what is allowed from our whitelist defined above
var sanitizeSvg = this.sanitizeSvg = function( node )
Extracts the URL from the url(...)
var getUrlFromAttr = this.getUrlFromAttr = function( attrVal )
Runs recalculateDimensions on the selected elements, adding the changes to a single batch command
var recalculateAllSelectedDimensions = this.recalculateAllSelectedDimensions = function()
Applies coordinate changes to an element based on the given matrix
var remapElement = this.remapElement = function( selected, changes, m )
Decides the course of action based on the element’s transform list
var recalculateDimensions = this.recalculateDimensions = function( selected )
A (hopefully) quicker function to transform a point by a matrix (this function avoids any DOM calls and just does the math)
var transformPoint = function( x, y, m )
Helper function to check if the matrix performs no actual transform (i.e.
var isIdentity = function( m )
This function tries to return a SVGMatrix that is the multiplication m1*m2.
var matrixMultiply = this.matrixMultiply = function()
This returns a single matrix Transform for a given Transform List (this is the equivalent of SVGTransformList.consolidate() but unlike that method, this one does not modify the actual SVGTransformList) This function is very liberal with its min,max arguments
var transformListToTransform = this.transformListToTransform = function( tlist, min, max )
See if the given transformlist includes a non-indentity matrix transform
var hasMatrixTransform = this.hasMatrixTransform = function( tlist )
Get the matrix object for a given element
var getMatrix = function( elem )
Transforms a rectangle based on the given matrix
var transformBox = this.transformBox = function( l, t, w, h, m )
Clears the selection.
this.clearSelection = function( noCall )
Adds a list of elements to the selection.
this.addToSelection = function( elemsToAdd, showGrips )
Removes elements from the selection.
this.removeFromSelection = function( elemsToRemove )
Takes three points and creates a smoother line based on them
var smoothControlPoints = this.smoothControlPoints = function( ct1, ct2, pt )
Gets the desired element from a mouse event
var getMouseTarget = this.getMouseTarget = function( evt )
Looks at DOM elements inside the defs to see if they are referred to, removes them from the DOM if they are not.
var removeUnusedDefElems = this.removeUnusedDefElems = function()
Main function to set up the SVG content for output
var svgCanvasToString = this.svgCanvasToString = function()
Sub function ran on each SVG element to convert it to a string as desired
var svgToString = this.svgToString = function( elem, indent )
Converts a given image file to a data URL when possible, then runs a given callback
this.embedImage = function( val, callback )
Serializes the current drawing into SVG XML text and returns it to the ‘saved’ handler.
this.save = function( opts )
Generates a PNG Data URL based on the current image, then calls “exported” with an object including the string and any issues found
this.rasterExport = function()
Returns the current drawing as raw SVG XML text.
this.getSvgString = function()
This function sets the current drawing as the input SVG XML.
this.setSvgString = function( xmlString )
This function imports the input SVG XML into the current layer in the drawing
this.importSvgString = function( xmlString )
Creates a new top-level layer in the drawing with the given name, sets the current layer to it, and then clears the selection This function then calls the ‘changed’ handler.
this.createLayer = function( name )
Deletes the current layer from the drawing and then clears the selection.
this.deleteCurrentLayer = function()
Returns the number of layers in the current drawing.
this.getNumLayers = function()
Returns the name of the ith layer.
this.getLayer = function( i )
Returns the name of the currently selected layer.
this.getCurrentLayer = function()
Sets the current layer.
this.setCurrentLayer = function( name )
Renames the current layer.
this.renameCurrentLayer = function( newname )
Changes the position of the current layer to the new value.
this.setCurrentLayerPosition = function( newpos )
Returns whether the layer is visible.
this.getLayerVisibility = function( layername )
Sets the visibility of the layer.
this.setLayerVisibility = function( layername, bVisible )
Moves the selected elements to layername.
this.moveSelectedToLayer = function( layername )
Returns the opacity of the given layer.
this.getLayerOpacity = function( layername )
Sets the opacity of the given layer.
this.setLayerOpacity = function( layername, opacity )
Clears the selection, then adds all elements in the current layer to the selection.
this.selectAllInCurrentLayer = function()
Clears the current document.
this.clear = function()
Convert selected element to a path, or get the BBox of an element-as-path
this.convertToPath = function( elem, getBBox )
Returns a string which describes the revision number of SvgCanvas.
this.getVersion = function()
Converts characters in a string to XML-friendly entities.
toXml = function( str )
Converts XML entities in a string to single characters.
fromXml = function( str )
Converts given values to numbers.
convertToNum = function( attr, val )
Sets an element’s attribute based on the unit in its current value.
setUnitAttr = function( elem, attr, val )
Check if an attribute’s value is in a valid format
canvas.isValidUnit = function( attr, val )
History command to make a change to an element.
var ChangeElementCommand = this.undoCmd.changeElement = function( elem, attrs, text )
History command for an element that was added to the DOM
var InsertElementCommand = this.undoCmd.insertElement = function( elem, text )
History command for an element removed from the DOM
var RemoveElementCommand = this.undoCmd.removeElement = function( elem, parent, text )
History command for an element that had its DOM position changed
var MoveElementCommand = this.undoCmd.moveElement = function( elem, oldNextSibling, oldParent, text )
History command that can contain/execute multiple other commands
var BatchCommand = this.undoCmd.batch = function( text )
Resets the undo stack, effectively clearing the undo/redo history
resetUndoStack = function()
Adds a command object to the undo history stack
addCommandToHistory = c.undoCmd.add = function( cmd )
This function tells the canvas to remember the old values of the attrName attribute for each element sent in.
c.beginUndoableChange = function( attrName, elems )
This function returns a BatchCommand object which summarizes the change since beginUndoableChange was called.
c.finishUndoableChange = function()
Walks the tree and executes the callback on each element in a top-down fashion
function walkTree( elem, cbFn )
Walks the tree and executes the callback on each element in a depth-first fashion
function walkTreePost( elem, cbFn )
Assigns multiple attributes to an element.
var assignAttributes = this.assignAttributes = function( node, attrs, suspendLength, unitCheck )
Remove unneeded (default) attributes, makes resulting SVG smaller
var cleanupElement = this.cleanupElement = function( element )
Create a new SVG element based on the given object keys/values and add it to the current layer The element will be ran through cleanupElement before being returned
var addSvgElementFromJson = this.addSvgElementFromJson = function( data )
Rounds a given value to a float with number of digits defined in save_options
var shortFloat = function( val )
Returns the last created DOM element ID string
getId = c.getId = function()
Creates and returns a unique ID string for a DOM element
getNextId = c.getNextId = function()
Attaches a callback function to an event
c.bind = function( event, f )
Changes the ID prefix to the given value
c.setIdPrefix = function( p )
Sanitizes the input node and its children It only keeps what is allowed from our whitelist defined above
var sanitizeSvg = this.sanitizeSvg = function( node )
Extracts the URL from the url(...)
var getUrlFromAttr = this.getUrlFromAttr = function( attrVal )
Runs recalculateDimensions on the selected elements, adding the changes to a single batch command
var recalculateAllSelectedDimensions = this.recalculateAllSelectedDimensions = function()
Applies coordinate changes to an element based on the given matrix
var remapElement = this.remapElement = function( selected, changes, m )
Decides the course of action based on the element’s transform list
var recalculateDimensions = this.recalculateDimensions = function( selected )
A (hopefully) quicker function to transform a point by a matrix (this function avoids any DOM calls and just does the math)
var transformPoint = function( x, y, m )
Helper function to check if the matrix performs no actual transform (i.e.
var isIdentity = function( m )
This function tries to return a SVGMatrix that is the multiplication m1*m2.
var matrixMultiply = this.matrixMultiply = function()
This returns a single matrix Transform for a given Transform List (this is the equivalent of SVGTransformList.consolidate() but unlike that method, this one does not modify the actual SVGTransformList) This function is very liberal with its min,max arguments
var transformListToTransform = this.transformListToTransform = function( tlist, min, max )
See if the given transformlist includes a non-indentity matrix transform
var hasMatrixTransform = this.hasMatrixTransform = function( tlist )
Get the matrix object for a given element
var getMatrix = function( elem )
Transforms a rectangle based on the given matrix
var transformBox = this.transformBox = function( l, t, w, h, m )
Clears the selection.
this.clearSelection = function( noCall )
Adds a list of elements to the selection.
this.addToSelection = function( elemsToAdd, showGrips )
Removes elements from the selection.
this.removeFromSelection = function( elemsToRemove )
Clears the selection, then adds all elements in the current layer to the selection.
this.selectAllInCurrentLayer = function()
Takes three points and creates a smoother line based on them
var smoothControlPoints = this.smoothControlPoints = function( ct1, ct2, pt )
Gets the desired element from a mouse event
var getMouseTarget = this.getMouseTarget = function( evt )
Looks at DOM elements inside the defs to see if they are referred to, removes them from the DOM if they are not.
var removeUnusedDefElems = this.removeUnusedDefElems = function()
Main function to set up the SVG content for output
var svgCanvasToString = this.svgCanvasToString = function()
Sub function ran on each SVG element to convert it to a string as desired
var svgToString = this.svgToString = function( elem, indent )
Converts a given image file to a data URL when possible, then runs a given callback
this.embedImage = function( val, callback )
Serializes the current drawing into SVG XML text and returns it to the ‘saved’ handler.
this.save = function( opts )
Generates a PNG Data URL based on the current image, then calls “exported” with an object including the string and any issues found
this.rasterExport = function()
Returns the current drawing as raw SVG XML text.
this.getSvgString = function()
This function sets the current drawing as the input SVG XML.
this.setSvgString = function( xmlString )
This function imports the input SVG XML into the current layer in the drawing
this.importSvgString = function( xmlString )
Updates layer system
var identifyLayers = function()
Creates a new top-level layer in the drawing with the given name, sets the current layer to it, and then clears the selection This function then calls the ‘changed’ handler.
this.createLayer = function( name )
Deletes the current layer from the drawing and then clears the selection.
this.deleteCurrentLayer = function()
Returns the number of layers in the current drawing.
this.getNumLayers = function()
Returns the name of the ith layer.
this.getLayer = function( i )
Returns the name of the currently selected layer.
this.getCurrentLayer = function()
Sets the current layer.
this.setCurrentLayer = function( name )
Renames the current layer.
this.renameCurrentLayer = function( newname )
Changes the position of the current layer to the new value.
this.setCurrentLayerPosition = function( newpos )
Returns whether the layer is visible.
this.getLayerVisibility = function( layername )
Sets the visibility of the layer.
this.setLayerVisibility = function( layername, bVisible )
Moves the selected elements to layername.
this.moveSelectedToLayer = function( layername )
Returns the opacity of the given layer.
this.getLayerOpacity = function( layername )
Sets the opacity of the given layer.
this.setLayerOpacity = function( layername, opacity )
Clears the current document.
this.clear = function()
Returns the content DOM element
this.getContentElem = function()
Returns the root DOM element
this.getRootElem = function()
Returns the array with selected DOM elements
this.getSelectedElems = function()
Returns the current dimensions and zoom level in an object
this.getResolution = function()
Returns the current document title or an empty string if not found
this.getDocumentTitle = function()
Adds/updates a title element for the document with the given name.
this.setDocumentTitle = function( newtitle )
Convert selected element to a path, or get the BBox of an element-as-path
this.convertToPath = function( elem, getBBox )
Returns a string which describes the revision number of SvgCanvas.
this.getVersion = function()
A | |
addCommandToHistory, SvgCanvas | |
addSubCommand, SvgCanvas. | |
addSvgElementFromJson, SelectorManager | |
addToSelection, SelectorManager | |
apply | |
assignAttributes, SelectorManager | |
B | |
BatchCommand, SvgCanvas | |
beginUndoableChange, SvgCanvas | |
bind, SelectorManager | |
C | |
ChangeElementCommand, SvgCanvas | |
cleanupElement, SelectorManager | |
clear, pathActions | |
clearSelection, SelectorManager | |
convertToNum, SvgCanvas | |
convertToPath, pathActions | |
createLayer, pathActions | |
D | |
deleteCurrentLayer, pathActions | |
E | |
elements | |
embedImage, pathActions | |
F | |
finishUndoableChange, SvgCanvas | |
fromXml, SvgCanvas | |
G | |
getCurrentLayer, pathActions | |
getId, SelectorManager | |
getLayer, pathActions | |
getLayerOpacity, pathActions | |
getLayerVisibility, pathActions | |
getMatrix, SelectorManager | |
getMouseTarget, SelectorManager | |
getNextId, SelectorManager | |
getNextRedoCommandText, SvgCanvas. | |
getNextUndoCommandText, SvgCanvas. | |
getNumLayers, pathActions | |
getRedoStackSize, SvgCanvas. | |
getRubberBandBox, SelectorManager. | |
getSvgString, pathActions | |
getUndoStackSize, SvgCanvas. | |
getUrlFromAttr, SelectorManager | |
getVersion, pathActions | |
H | |
hasMatrixTransform, SelectorManager | |
I | |
importSvgString, pathActions | |
initGroup, SelectorManager. | |
InsertElementCommand, SvgCanvas | |
isEmpty, SvgCanvas. | |
isIdentity, SelectorManager | |
isValidUnit, SvgCanvas | |
M | |
matrixMultiply, SelectorManager | |
MoveElementCommand, SvgCanvas | |
moveSelectedToLayer, pathActions | |
R | |
rasterExport, pathActions | |
recalculateAllSelectedDimensions, SelectorManager | |
recalculateDimensions, SelectorManager | |
redo, SvgCanvas. | |
releaseSelector, SelectorManager. | |
remapElement, SelectorManager | |
RemoveElementCommand, SvgCanvas | |
removeFromSelection, SelectorManager | |
removeUnusedDefElems, pathActions | |
renameCurrentLayer, pathActions | |
requestSelector, SelectorManager. | |
reset, Selector. | |
resetUndoStack, SvgCanvas | |
resize, Selector. |
A | |
addCommandToHistory, SvgCanvas | |
addSubCommand, SvgCanvas. | |
addSvgElementFromJson, SelectorManager | |
addToSelection, SelectorManager | |
apply | |
assignAttributes, SelectorManager | |
B | |
BatchCommand, SvgCanvas | |
beginUndoableChange, SvgCanvas | |
bind, SelectorManager | |
C | |
ChangeElementCommand, SvgCanvas | |
cleanupElement, SelectorManager | |
clear, pathActions | |
clearSelection, SelectorManager | |
convertToNum, SvgCanvas | |
convertToPath, pathActions | |
createLayer, pathActions | |
D | |
deleteCurrentLayer, pathActions | |
E | |
elements | |
embedImage, pathActions | |
F | |
finishUndoableChange, SvgCanvas | |
fromXml, SvgCanvas | |
G | |
getContentElem, pathActions | |
getCurrentLayer, pathActions | |
getDocumentTitle, pathActions | |
getId, SelectorManager | |
getLayer, pathActions | |
getLayerOpacity, pathActions | |
getLayerVisibility, pathActions | |
getMatrix, SelectorManager | |
getMouseTarget, SelectorManager | |
getNextId, SelectorManager | |
getNextRedoCommandText, SvgCanvas. | |
getNextUndoCommandText, SvgCanvas. | |
getNumLayers, pathActions | |
getRedoStackSize, SvgCanvas. | |
getResolution, pathActions | |
getRootElem, pathActions | |
getRubberBandBox, SelectorManager. | |
getSelectedElems, pathActions | |
getSvgString, pathActions | |
getUndoStackSize, SvgCanvas. | |
getUrlFromAttr, SelectorManager | |
getVersion, pathActions | |
H | |
hasMatrixTransform, SelectorManager | |
I | |
identifyLayers, pathActions | |
importSvgString, pathActions | |
initGroup, SelectorManager. | |
InsertElementCommand, SvgCanvas | |
isEmpty, SvgCanvas. | |
isIdentity, SelectorManager | |
isValidUnit, SvgCanvas | |
L | |
linkControlPoints, pathActions | |
M | |
matrixMultiply, SelectorManager | |
MoveElementCommand, SvgCanvas | |
moveSelectedToLayer, pathActions | |
R | |
rasterExport, pathActions | |
recalculateAllSelectedDimensions, SelectorManager | |
recalculateDimensions, SelectorManager | |
redo, SvgCanvas. | |
releaseSelector, SelectorManager. | |
remapElement, SelectorManager | |
RemoveElementCommand, SvgCanvas | |
removeFromSelection, SelectorManager | |
removeUnusedDefElems, pathActions | |
renameCurrentLayer, pathActions | |
requestSelector, SelectorManager. | |
reset, Selector. | |
resetUndoStack, SvgCanvas | |
resize, Selector. |
Adds a command object to the undo history stack
addCommandToHistory = c.undoCmd.add = function( cmd )
Create a new SVG element based on the given object keys/values and add it to the current layer The element will be ran through cleanupElement before being returned
var addSvgElementFromJson = this.addSvgElementFromJson = function( data )
Adds a list of elements to the selection.
this.addToSelection = function( elemsToAdd, showGrips )
Assigns multiple attributes to an element.
var assignAttributes = this.assignAttributes = function( node, attrs, suspendLength, unitCheck )
Returns the name of the currently selected layer.
this.getCurrentLayer = function()
Returns the last created DOM element ID string
getId = c.getId = function()
Returns the name of the ith layer.
this.getLayer = function( i )
Returns the opacity of the given layer.
this.getLayerOpacity = function( layername )
Returns whether the layer is visible.
this.getLayerVisibility = function( layername )
Get the matrix object for a given element
var getMatrix = function( elem )
Gets the desired element from a mouse event
var getMouseTarget = this.getMouseTarget = function( evt )
Creates and returns a unique ID string for a DOM element
getNextId = c.getNextId = function()
Returns the number of layers in the current drawing.
this.getNumLayers = function()
Returns the current drawing as raw SVG XML text.
this.getSvgString = function()
Extracts the URL from the url(...)
var getUrlFromAttr = this.getUrlFromAttr = function( attrVal )
Returns a string which describes the revision number of SvgCanvas.
this.getVersion = function()
Returns the content DOM element
this.getContentElem = function()
Returns the name of the currently selected layer.
this.getCurrentLayer = function()
Returns the current document title or an empty string if not found
this.getDocumentTitle = function()
Returns the last created DOM element ID string
getId = c.getId = function()
Returns the name of the ith layer.
this.getLayer = function( i )
Returns the opacity of the given layer.
this.getLayerOpacity = function( layername )
Returns whether the layer is visible.
this.getLayerVisibility = function( layername )
Get the matrix object for a given element
var getMatrix = function( elem )
Gets the desired element from a mouse event
var getMouseTarget = this.getMouseTarget = function( evt )
Creates and returns a unique ID string for a DOM element
getNextId = c.getNextId = function()
Returns the number of layers in the current drawing.
this.getNumLayers = function()
Returns the current dimensions and zoom level in an object
this.getResolution = function()
Returns the root DOM element
this.getRootElem = function()
Returns the array with selected DOM elements
this.getSelectedElems = function()
Returns the current drawing as raw SVG XML text.
this.getSvgString = function()
Extracts the URL from the url(...)
var getUrlFromAttr = this.getUrlFromAttr = function( attrVal )
Returns a string which describes the revision number of SvgCanvas.
this.getVersion = function()
See if the given transformlist includes a non-indentity matrix transform
var hasMatrixTransform = this.hasMatrixTransform = function( tlist )
See if the given transformlist includes a non-indentity matrix transform
var hasMatrixTransform = this.hasMatrixTransform = function( tlist )
This function imports the input SVG XML into the current layer in the drawing
this.importSvgString = function( xmlString )
History command for an element that was added to the DOM
var InsertElementCommand = this.undoCmd.insertElement = function( elem, text )
Helper function to check if the matrix performs no actual transform (i.e.
var isIdentity = function( m )
Check if an attribute’s value is in a valid format
canvas.isValidUnit = function( attr, val )
Updates layer system
var identifyLayers = function()
This function imports the input SVG XML into the current layer in the drawing
this.importSvgString = function( xmlString )
History command for an element that was added to the DOM
var InsertElementCommand = this.undoCmd.insertElement = function( elem, text )
Helper function to check if the matrix performs no actual transform (i.e.
var isIdentity = function( m )
Check if an attribute’s value is in a valid format
canvas.isValidUnit = function( attr, val )
This function tries to return a SVGMatrix that is the multiplication m1*m2.
var matrixMultiply = this.matrixMultiply = function()
History command for an element that had its DOM position changed
var MoveElementCommand = this.undoCmd.moveElement = function( elem, oldNextSibling, oldParent, text )
Moves the selected elements to layername.
this.moveSelectedToLayer = function( layername )
Generates a PNG Data URL based on the current image, then calls “exported” with an object including the string and any issues found
this.rasterExport = function()
Runs recalculateDimensions on the selected elements, adding the changes to a single batch command
var recalculateAllSelectedDimensions = this.recalculateAllSelectedDimensions = function()
Decides the course of action based on the element’s transform list
var recalculateDimensions = this.recalculateDimensions = function( selected )
Applies coordinate changes to an element based on the given matrix
var remapElement = this.remapElement = function( selected, changes, m )
History command for an element removed from the DOM
var RemoveElementCommand = this.undoCmd.removeElement = function( elem, parent, text )
Removes elements from the selection.
this.removeFromSelection = function( elemsToRemove )
Looks at DOM elements inside the defs to see if they are referred to, removes them from the DOM if they are not.
var removeUnusedDefElems = this.removeUnusedDefElems = function()
Renames the current layer.
this.renameCurrentLayer = function( newname )
Resets the undo stack, effectively clearing the undo/redo history
resetUndoStack = function()
This function tries to return a SVGMatrix that is the multiplication m1*m2.
var matrixMultiply = this.matrixMultiply = function()
History command for an element that had its DOM position changed
var MoveElementCommand = this.undoCmd.moveElement = function( elem, oldNextSibling, oldParent, text )
Moves the selected elements to layername.
this.moveSelectedToLayer = function( layername )
Generates a PNG Data URL based on the current image, then calls “exported” with an object including the string and any issues found
this.rasterExport = function()
Runs recalculateDimensions on the selected elements, adding the changes to a single batch command
var recalculateAllSelectedDimensions = this.recalculateAllSelectedDimensions = function()
Decides the course of action based on the element’s transform list
var recalculateDimensions = this.recalculateDimensions = function( selected )
Applies coordinate changes to an element based on the given matrix
var remapElement = this.remapElement = function( selected, changes, m )
History command for an element removed from the DOM
var RemoveElementCommand = this.undoCmd.removeElement = function( elem, parent, text )
Removes elements from the selection.
this.removeFromSelection = function( elemsToRemove )
Looks at DOM elements inside the defs to see if they are referred to, removes them from the DOM if they are not.
var removeUnusedDefElems = this.removeUnusedDefElems = function()
Renames the current layer.
this.renameCurrentLayer = function( newname )
Resets the undo stack, effectively clearing the undo/redo history
resetUndoStack = function()
A | |
addCommandToHistory, SvgCanvas | |
addSubCommand, SvgCanvas. | |
addSvgElementFromJson, SelectorManager | |
addToSelection, SelectorManager | |
apply | |
assignAttributes, SelectorManager | |
B | |
BatchCommand, SvgCanvas | |
beginUndoableChange, SvgCanvas | |
bind, SelectorManager | |
C | |
ChangeElementCommand, SvgCanvas | |
cleanupElement, SelectorManager | |
clear, pathActions | |
clearSelection, SelectorManager | |
convertToNum, SvgCanvas | |
convertToPath, pathActions | |
createLayer, pathActions | |
D | |
deleteCurrentLayer, pathActions | |
E | |
Element Transforms, SelectorManager | |
elements | |
embedImage, pathActions | |
F | |
Fill and Stroke, pathActions | |
finishUndoableChange, SvgCanvas | |
fromXml, SvgCanvas | |
Functions, Selector | |
G | |
getCurrentLayer, pathActions | |
getId, SelectorManager | |
getLayer, pathActions | |
getLayerOpacity, pathActions | |
getLayerVisibility, pathActions | |
getMatrix, SelectorManager | |
getMouseTarget, SelectorManager | |
getNextId, SelectorManager | |
getNextRedoCommandText, SvgCanvas. | |
getNextUndoCommandText, SvgCanvas. | |
getNumLayers, pathActions | |
getRedoStackSize, SvgCanvas. | |
getRubberBandBox, SelectorManager. | |
getSvgString, pathActions | |
getUndoStackSize, SvgCanvas. | |
getUrlFromAttr, SelectorManager | |
getVersion, pathActions | |
H | |
hasMatrixTransform, SelectorManager | |
Helper functions, SelectorManager | |
I | |
importSvgString, pathActions | |
initGroup, SelectorManager. | |
InsertElementCommand, SvgCanvas | |
isEmpty, SvgCanvas. | |
isIdentity, SelectorManager | |
isValidUnit, SvgCanvas | |
L | |
Layers, pathActions | |
M | |
matrixMultiply, SelectorManager | |
MoveElementCommand, SvgCanvas | |
moveSelectedToLayer, pathActions | |
P | |
pathActions | |
R | |
rasterExport, pathActions | |
recalculateAllSelectedDimensions, SelectorManager | |
recalculateDimensions, SelectorManager | |
redo, SvgCanvas. | |
releaseSelector, SelectorManager. | |
remapElement, SelectorManager | |
RemoveElementCommand, SvgCanvas | |
removeFromSelection, SelectorManager | |
removeUnusedDefElems, pathActions | |
renameCurrentLayer, pathActions | |
requestSelector, SelectorManager. | |
reset, Selector. | |
resetUndoStack, SvgCanvas | |
resize, Selector. |
A | |
addCommandToHistory, SvgCanvas | |
addSubCommand, SvgCanvas. | |
addSvgElementFromJson, SelectorManager | |
addToSelection, SelectorManager | |
apply | |
assignAttributes, SelectorManager | |
B | |
BatchCommand, SvgCanvas | |
beginUndoableChange, SvgCanvas | |
bind, SelectorManager | |
C | |
ChangeElementCommand, SvgCanvas | |
cleanupElement, SelectorManager | |
clear, pathActions | |
clearSelection, SelectorManager | |
convertToNum, SvgCanvas | |
convertToPath, pathActions | |
createLayer, pathActions | |
D | |
deleteCurrentLayer, pathActions | |
E | |
Element Transforms, SelectorManager | |
elements | |
embedImage, pathActions | |
F | |
Fill and Stroke, pathActions | |
finishUndoableChange, SvgCanvas | |
fromXml, SvgCanvas | |
Functions, Selector | |
G | |
getContentElem, pathActions | |
getCurrentLayer, pathActions | |
getDocumentTitle, pathActions | |
getId, SelectorManager | |
getLayer, pathActions | |
getLayerOpacity, pathActions | |
getLayerVisibility, pathActions | |
getMatrix, SelectorManager | |
getMouseTarget, SelectorManager | |
getNextId, SelectorManager | |
getNextRedoCommandText, SvgCanvas. | |
getNextUndoCommandText, SvgCanvas. | |
getNumLayers, pathActions | |
getRedoStackSize, SvgCanvas. | |
getResolution, pathActions | |
getRootElem, pathActions | |
getRubberBandBox, SelectorManager. | |
getSelectedElems, pathActions | |
getSvgString, pathActions | |
getUndoStackSize, SvgCanvas. | |
getUrlFromAttr, SelectorManager | |
getVersion, pathActions | |
H | |
hasMatrixTransform, SelectorManager | |
Helper functions, SelectorManager | |
I | |
identifyLayers, pathActions | |
importSvgString, pathActions | |
initGroup, SelectorManager. | |
InsertElementCommand, SvgCanvas | |
isEmpty, SvgCanvas. | |
isIdentity, SelectorManager | |
isValidUnit, SvgCanvas | |
L | |
Layers, pathActions | |
linkControlPoints, pathActions | |
M | |
matrixMultiply, SelectorManager | |
MoveElementCommand, SvgCanvas | |
moveSelectedToLayer, pathActions | |
P | |
pathActions | |
R | |
rasterExport, pathActions | |
recalculateAllSelectedDimensions, SelectorManager | |
recalculateDimensions, SelectorManager | |
redo, SvgCanvas. | |
releaseSelector, SelectorManager. | |
remapElement, SelectorManager | |
RemoveElementCommand, SvgCanvas | |
removeFromSelection, SelectorManager | |
removeUnusedDefElems, pathActions | |
renameCurrentLayer, pathActions | |
requestSelector, SelectorManager. | |
reset, Selector. | |
resetUndoStack, SvgCanvas | |
resize, Selector. |
Adds a command object to the undo history stack
addCommandToHistory = c.undoCmd.add = function( cmd )
Create a new SVG element based on the given object keys/values and add it to the current layer The element will be ran through cleanupElement before being returned
var addSvgElementFromJson = this.addSvgElementFromJson = function( data )
Adds a list of elements to the selection.
this.addToSelection = function( elemsToAdd, showGrips )
Assigns multiple attributes to an element.
var assignAttributes = this.assignAttributes = function( node, attrs, suspendLength, unitCheck )
Returns the name of the currently selected layer.
this.getCurrentLayer = function()
Returns the last created DOM element ID string
getId = c.getId = function()
Returns the name of the ith layer.
this.getLayer = function( i )
Returns the opacity of the given layer.
this.getLayerOpacity = function( layername )
Returns whether the layer is visible.
this.getLayerVisibility = function( layername )
Get the matrix object for a given element
var getMatrix = function( elem )
Gets the desired element from a mouse event
var getMouseTarget = this.getMouseTarget = function( evt )
Creates and returns a unique ID string for a DOM element
getNextId = c.getNextId = function()
Returns the number of layers in the current drawing.
this.getNumLayers = function()
Returns the current drawing as raw SVG XML text.
this.getSvgString = function()
Extracts the URL from the url(...)
var getUrlFromAttr = this.getUrlFromAttr = function( attrVal )
Returns a string which describes the revision number of SvgCanvas.
this.getVersion = function()
Returns the content DOM element
this.getContentElem = function()
Returns the name of the currently selected layer.
this.getCurrentLayer = function()
Returns the current document title or an empty string if not found
this.getDocumentTitle = function()
Returns the last created DOM element ID string
getId = c.getId = function()
Returns the name of the ith layer.
this.getLayer = function( i )
Returns the opacity of the given layer.
this.getLayerOpacity = function( layername )
Returns whether the layer is visible.
this.getLayerVisibility = function( layername )
Get the matrix object for a given element
var getMatrix = function( elem )
Gets the desired element from a mouse event
var getMouseTarget = this.getMouseTarget = function( evt )
Creates and returns a unique ID string for a DOM element
getNextId = c.getNextId = function()
Returns the number of layers in the current drawing.
this.getNumLayers = function()
Returns the current dimensions and zoom level in an object
this.getResolution = function()
Returns the root DOM element
this.getRootElem = function()
Returns the array with selected DOM elements
this.getSelectedElems = function()
Returns the current drawing as raw SVG XML text.
this.getSvgString = function()
Extracts the URL from the url(...)
var getUrlFromAttr = this.getUrlFromAttr = function( attrVal )
Returns a string which describes the revision number of SvgCanvas.
this.getVersion = function()
See if the given transformlist includes a non-indentity matrix transform
var hasMatrixTransform = this.hasMatrixTransform = function( tlist )
See if the given transformlist includes a non-indentity matrix transform
var hasMatrixTransform = this.hasMatrixTransform = function( tlist )
This function imports the input SVG XML into the current layer in the drawing
this.importSvgString = function( xmlString )
History command for an element that was added to the DOM
var InsertElementCommand = this.undoCmd.insertElement = function( elem, text )
Helper function to check if the matrix performs no actual transform (i.e.
var isIdentity = function( m )
Check if an attribute’s value is in a valid format
canvas.isValidUnit = function( attr, val )
Updates layer system
var identifyLayers = function()
This function imports the input SVG XML into the current layer in the drawing
this.importSvgString = function( xmlString )
History command for an element that was added to the DOM
var InsertElementCommand = this.undoCmd.insertElement = function( elem, text )
Helper function to check if the matrix performs no actual transform (i.e.
var isIdentity = function( m )
Check if an attribute’s value is in a valid format
canvas.isValidUnit = function( attr, val )
This function tries to return a SVGMatrix that is the multiplication m1*m2.
var matrixMultiply = this.matrixMultiply = function()
History command for an element that had its DOM position changed
var MoveElementCommand = this.undoCmd.moveElement = function( elem, oldNextSibling, oldParent, text )
Moves the selected elements to layername.
this.moveSelectedToLayer = function( layername )
This function tries to return a SVGMatrix that is the multiplication m1*m2.
var matrixMultiply = this.matrixMultiply = function()
History command for an element that had its DOM position changed
var MoveElementCommand = this.undoCmd.moveElement = function( elem, oldNextSibling, oldParent, text )
Moves the selected elements to layername.
this.moveSelectedToLayer = function( layername )
Generates a PNG Data URL based on the current image, then calls “exported” with an object including the string and any issues found
this.rasterExport = function()
Runs recalculateDimensions on the selected elements, adding the changes to a single batch command
var recalculateAllSelectedDimensions = this.recalculateAllSelectedDimensions = function()
Decides the course of action based on the element’s transform list
var recalculateDimensions = this.recalculateDimensions = function( selected )
Applies coordinate changes to an element based on the given matrix
var remapElement = this.remapElement = function( selected, changes, m )
History command for an element removed from the DOM
var RemoveElementCommand = this.undoCmd.removeElement = function( elem, parent, text )
Removes elements from the selection.
this.removeFromSelection = function( elemsToRemove )
Looks at DOM elements inside the defs to see if they are referred to, removes them from the DOM if they are not.
var removeUnusedDefElems = this.removeUnusedDefElems = function()
Renames the current layer.
this.renameCurrentLayer = function( newname )
Resets the undo stack, effectively clearing the undo/redo history
resetUndoStack = function()
Generates a PNG Data URL based on the current image, then calls “exported” with an object including the string and any issues found
this.rasterExport = function()
Runs recalculateDimensions on the selected elements, adding the changes to a single batch command
var recalculateAllSelectedDimensions = this.recalculateAllSelectedDimensions = function()
Decides the course of action based on the element’s transform list
var recalculateDimensions = this.recalculateDimensions = function( selected )
Applies coordinate changes to an element based on the given matrix
var remapElement = this.remapElement = function( selected, changes, m )
History command for an element removed from the DOM
var RemoveElementCommand = this.undoCmd.removeElement = function( elem, parent, text )
Removes elements from the selection.
this.removeFromSelection = function( elemsToRemove )
Looks at DOM elements inside the defs to see if they are referred to, removes them from the DOM if they are not.
var removeUnusedDefElems = this.removeUnusedDefElems = function()
Renames the current layer.
this.renameCurrentLayer = function( newname )
Resets the undo stack, effectively clearing the undo/redo history
resetUndoStack = function()