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("
");if (browserV -

SvgCanvas

The main SvgCanvas class that manages all SVG-related functions

Parameters

containerThe container HTML element that should hold the SVG root element
configAn object that contains configuration data
Summary
SvgCanvasThe main SvgCanvas class that manages all SVG-related functions
toXmlConverts characters in a string to XML-friendly entities.
fromXmlConverts XML entities in a string to single characters.
Unit conversion functions
convertToNumConverts given values to numbers.
setUnitAttrSets an element’s attribute based on the unit in its current value.
isValidUnitCheck if an attribute’s value is in a valid format
Undo/Redo history management
ChangeElementCommandHistory command to make a change to an element.
ChangeElementCommand.applyPerforms the stored change action
ChangeElementCommand.unapplyReverses the stored change action
ChangeElementCommand.elementsReturns array with element associated with this command
InsertElementCommandHistory command for an element that was added to the DOM
InsertElementCommand.applyRe-Inserts the new element
InsertElementCommand.unapplyRemoves the element
InsertElementCommand.elementsReturns array with element associated with this command
RemoveElementCommandHistory command for an element removed from the DOM
RemoveElementCommand.applyRe-removes the new element
RemoveElementCommand.unapplyRe-adds the new element
RemoveElementCommand.elementsReturns array with element associated with this command
MoveElementCommandHistory command for an element that had its DOM position changed
MoveElementCommand.unapplyRe-positions the element
MoveElementCommand.unapplyPositions the element back to its original location
MoveElementCommand.elementsReturns array with element associated with this command
BatchCommandHistory command that can contain/execute multiple other commands
BatchCommand.applyRuns “apply” on all subcommands
BatchCommand.unapplyRuns “unapply” on all subcommands
BatchCommand.elementsIterate through all our subcommands and returns all the elements we are changing
BatchCommand.addSubCommandAdds a given command to the history stack
BatchCommand.isEmptyReturns a boolean indicating whether or not the batch command is empty
resetUndoStackResets the undo stack, effectively clearing the undo/redo history
undoMgr.getUndoStackSizeInteger with the current size of the undo history stack
undoMgr.getRedoStackSizeInteger with the current size of the redo history stack
undoMgr.getNextUndoCommandTextString associated with the next undo command
undoMgr.getNextRedoCommandTextString associated with the next redo command
undoMgr.undoPerforms an undo step
undoMgr.redoPerforms a redo step
addCommandToHistoryAdds a command object to the undo history stack
beginUndoableChangeThis function tells the canvas to remember the old values of the attrName attribute for each element sent in.
finishUndoableChangeThis function returns a BatchCommand object which summarizes the change since beginUndoableChange was called.
SelectorPrivate class for DOM element selection boxes
Functions
Selector.resetUsed to reset the id and element that the selector is attached to
Selector.showGripsShow the resize grips of this selector
Selector.updateGripCursorsUpdates cursors for corner grips on rotation so arrows point the right way
Selector.resizeUpdates the selector to match the element’s size
SelectorManagerPublic class to manage all selector objects (selection boxes)
SelectorManager.initGroupResets the parent selector group element
SelectorManager.requestSelectorReturns the selector based on the given element
SelectorManager.releaseSelectorRemoves the selector of the given element (hides selection box)
SelectorManager.getRubberBandBoxReturns the rubberBandBox DOM element.
Helper functions
walkTreeWalks the tree and executes the callback on each element in a top-down fashion
walkTreePostWalks the tree and executes the callback on each element in a depth-first fashion
assignAttributesAssigns multiple attributes to an element.
cleanupElementRemove unneeded (default) attributes, makes resulting SVG smaller
addSvgElementFromJsonCreate 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
shortFloatRounds a given value to a float with number of digits defined in save_options
getIdReturns the last created DOM element ID string
getNextIdCreates and returns a unique ID string for a DOM element
bindAttaches a callback function to an event
setIdPrefixChanges the ID prefix to the given value
sanitizeSvgSanitizes the input node and its children It only keeps what is allowed from our whitelist defined above
getUrlFromAttrExtracts the URL from the url(...)
Element Transforms
recalculateAllSelectedDimensionsRuns recalculateDimensions on the selected elements, adding the changes to a single batch command
remapElementApplies coordinate changes to an element based on the given matrix
recalculateDimensionsDecides the course of action based on the element’s transform list
transformPointA (hopefully) quicker function to transform a point by a matrix (this function avoids any DOM calls and just does the math)
isIdentityHelper function to check if the matrix performs no actual transform (i.e.
matrixMultiplyThis function tries to return a SVGMatrix that is the multiplication m1*m2.
transformListToTransformThis 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
hasMatrixTransformSee if the given transformlist includes a non-indentity matrix transform
getMatrixGet the matrix object for a given element
transformBoxTransforms a rectangle based on the given matrix
Selection
clearSelectionClears the selection.
addToSelectionAdds a list of elements to the selection.
removeFromSelectionRemoves elements from the selection.
smoothControlPointsTakes three points and creates a smoother line based on them
getMouseTargetGets the desired element from a mouse event
textActionsFunctions relating to editing text elements
pathActionsFunctions relating to editing path elements
Serialization
removeUnusedDefElemsLooks at DOM elements inside the <defs> to see if they are referred to, removes them from the DOM if they are not.
svgCanvasToStringMain function to set up the SVG content for output
svgToStringSub function ran on each SVG element to convert it to a string as desired
embedImageConverts a given image file to a data URL when possible, then runs a given callback
saveSerializes the current drawing into SVG XML text and returns it to the ‘saved’ handler.
rasterExportGenerates a PNG Data URL based on the current image, then calls “exported” with an object including the string and any issues found
getSvgStringReturns the current drawing as raw SVG XML text.
setSvgStringThis function sets the current drawing as the input SVG XML.
importSvgStringThis function imports the input SVG XML into the current layer in the drawing
Layers
createLayerCreates 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.
deleteCurrentLayerDeletes the current layer from the drawing and then clears the selection.
getNumLayersReturns the number of layers in the current drawing.
getLayerReturns the name of the ith layer.
getCurrentLayerReturns the name of the currently selected layer.
setCurrentLayerSets the current layer.
renameCurrentLayerRenames the current layer.
setCurrentLayerPositionChanges the position of the current layer to the new value.
getLayerVisibilityReturns whether the layer is visible.
setLayerVisibilitySets the visibility of the layer.
moveSelectedToLayerMoves the selected elements to layername.
getLayerOpacityReturns the opacity of the given layer.
setLayerOpacitySets the opacity of the given layer.
selectAllInCurrentLayerClears the selection, then adds all elements in the current layer to the selection.
clearClears the current document.
Fill and Stroke
convertToPathConvert selected element to a path, or get the BBox of an element-as-path
getVersionReturns a string which describes the revision number of SvgCanvas.
+

SvgCanvas

The main SvgCanvas class that manages all SVG-related functions

Parameters

containerThe container HTML element that should hold the SVG root element
configAn object that contains configuration data
Summary
SvgCanvasThe main SvgCanvas class that manages all SVG-related functions
toXmlConverts characters in a string to XML-friendly entities.
fromXmlConverts XML entities in a string to single characters.
Unit conversion functions
convertToNumConverts given values to numbers.
setUnitAttrSets an element’s attribute based on the unit in its current value.
isValidUnitCheck if an attribute’s value is in a valid format
Undo/Redo history management
ChangeElementCommandHistory command to make a change to an element.
ChangeElementCommand.applyPerforms the stored change action
ChangeElementCommand.unapplyReverses the stored change action
ChangeElementCommand.elementsReturns array with element associated with this command
InsertElementCommandHistory command for an element that was added to the DOM
InsertElementCommand.applyRe-Inserts the new element
InsertElementCommand.unapplyRemoves the element
InsertElementCommand.elementsReturns array with element associated with this command
RemoveElementCommandHistory command for an element removed from the DOM
RemoveElementCommand.applyRe-removes the new element
RemoveElementCommand.unapplyRe-adds the new element
RemoveElementCommand.elementsReturns array with element associated with this command
MoveElementCommandHistory command for an element that had its DOM position changed
MoveElementCommand.unapplyRe-positions the element
MoveElementCommand.unapplyPositions the element back to its original location
MoveElementCommand.elementsReturns array with element associated with this command
BatchCommandHistory command that can contain/execute multiple other commands
BatchCommand.applyRuns “apply” on all subcommands
BatchCommand.unapplyRuns “unapply” on all subcommands
BatchCommand.elementsIterate through all our subcommands and returns all the elements we are changing
BatchCommand.addSubCommandAdds a given command to the history stack
BatchCommand.isEmptyReturns a boolean indicating whether or not the batch command is empty
resetUndoStackResets the undo stack, effectively clearing the undo/redo history
undoMgr.getUndoStackSizeInteger with the current size of the undo history stack
undoMgr.getRedoStackSizeInteger with the current size of the redo history stack
undoMgr.getNextUndoCommandTextString associated with the next undo command
undoMgr.getNextRedoCommandTextString associated with the next redo command
undoMgr.undoPerforms an undo step
undoMgr.redoPerforms a redo step
addCommandToHistoryAdds a command object to the undo history stack
beginUndoableChangeThis function tells the canvas to remember the old values of the attrName attribute for each element sent in.
finishUndoableChangeThis function returns a BatchCommand object which summarizes the change since beginUndoableChange was called.
SelectorPrivate class for DOM element selection boxes
Functions
Selector.resetUsed to reset the id and element that the selector is attached to
Selector.showGripsShow the resize grips of this selector
Selector.updateGripCursorsUpdates cursors for corner grips on rotation so arrows point the right way
Selector.resizeUpdates the selector to match the element’s size
SelectorManagerPublic class to manage all selector objects (selection boxes)
SelectorManager.initGroupResets the parent selector group element
SelectorManager.requestSelectorReturns the selector based on the given element
SelectorManager.releaseSelectorRemoves the selector of the given element (hides selection box)
SelectorManager.getRubberBandBoxReturns the rubberBandBox DOM element.
Helper functions
walkTreeWalks the tree and executes the callback on each element in a top-down fashion
walkTreePostWalks the tree and executes the callback on each element in a depth-first fashion
assignAttributesAssigns multiple attributes to an element.
cleanupElementRemove unneeded (default) attributes, makes resulting SVG smaller
addSvgElementFromJsonCreate 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
shortFloatRounds a given value to a float with number of digits defined in save_options
getIdReturns the last created DOM element ID string
getNextIdCreates and returns a unique ID string for a DOM element
bindAttaches a callback function to an event
setIdPrefixChanges the ID prefix to the given value
sanitizeSvgSanitizes the input node and its children It only keeps what is allowed from our whitelist defined above
getUrlFromAttrExtracts the URL from the url(...)
Element Transforms
recalculateAllSelectedDimensionsRuns recalculateDimensions on the selected elements, adding the changes to a single batch command
remapElementApplies coordinate changes to an element based on the given matrix
recalculateDimensionsDecides the course of action based on the element’s transform list
transformPointA (hopefully) quicker function to transform a point by a matrix (this function avoids any DOM calls and just does the math)
isIdentityHelper function to check if the matrix performs no actual transform (i.e.
matrixMultiplyThis function tries to return a SVGMatrix that is the multiplication m1*m2.
transformListToTransformThis 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
hasMatrixTransformSee if the given transformlist includes a non-indentity matrix transform
getMatrixGet the matrix object for a given element
transformBoxTransforms a rectangle based on the given matrix
Selection
clearSelectionClears the selection.
addToSelectionAdds a list of elements to the selection.
removeFromSelectionRemoves elements from the selection.
selectAllInCurrentLayerClears the selection, then adds all elements in the current layer to the selection.
smoothControlPointsTakes three points and creates a smoother line based on them
getMouseTargetGets the desired element from a mouse event
textActionsFunctions relating to editing text elements
pathActionsFunctions relating to editing path elements
Serialization
removeUnusedDefElemsLooks at DOM elements inside the <defs> to see if they are referred to, removes them from the DOM if they are not.
svgCanvasToStringMain function to set up the SVG content for output
svgToStringSub function ran on each SVG element to convert it to a string as desired
embedImageConverts a given image file to a data URL when possible, then runs a given callback
saveSerializes the current drawing into SVG XML text and returns it to the ‘saved’ handler.
rasterExportGenerates a PNG Data URL based on the current image, then calls “exported” with an object including the string and any issues found
getSvgStringReturns the current drawing as raw SVG XML text.
setSvgStringThis function sets the current drawing as the input SVG XML.
importSvgStringThis function imports the input SVG XML into the current layer in the drawing
Layers
identifyLayersUpdates layer system
createLayerCreates 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.
deleteCurrentLayerDeletes the current layer from the drawing and then clears the selection.
getNumLayersReturns the number of layers in the current drawing.
getLayerReturns the name of the ith layer.
getCurrentLayerReturns the name of the currently selected layer.
setCurrentLayerSets the current layer.
renameCurrentLayerRenames the current layer.
setCurrentLayerPositionChanges the position of the current layer to the new value.
getLayerVisibilityReturns whether the layer is visible.
setLayerVisibilitySets the visibility of the layer.
moveSelectedToLayerMoves the selected elements to layername.
getLayerOpacityReturns the opacity of the given layer.
setLayerOpacitySets the opacity of the given layer.
User actions
clearClears the current document.
linkControlPointsAlias function
getContentElemReturns the content DOM element
getRootElemReturns the root DOM element
getSelectedElemsReturns the array with selected DOM elements
getResolutionReturns the current dimensions and zoom level in an object
getDocumentTitleReturns the current document title or an empty string if not found
setDocumentTitleAdds/updates a title element for the document with the given name.
Fill and Stroke
convertToPathConvert selected element to a path, or get the BBox of an element-as-path
getVersionReturns a string which describes the revision number of SvgCanvas.

toXml

toXml = function(str)

Converts characters in a string to XML-friendly entities.

Example: “&” becomes “&amp;”

Parameters

strThe string to be converted

Returns

The converted string

@@ -103,7 +103,7 @@ if (browserType) {document.write("
");if (browserV

Selector.resize

Updates the selector to match the element’s size

-

SelectorManager

Public class to manage all selector objects (selection boxes)

Summary
SelectorManager.initGroupResets the parent selector group element
SelectorManager.requestSelectorReturns the selector based on the given element
SelectorManager.releaseSelectorRemoves the selector of the given element (hides selection box)
SelectorManager.getRubberBandBoxReturns the rubberBandBox DOM element.
Helper functions
walkTreeWalks the tree and executes the callback on each element in a top-down fashion
walkTreePostWalks the tree and executes the callback on each element in a depth-first fashion
assignAttributesAssigns multiple attributes to an element.
cleanupElementRemove unneeded (default) attributes, makes resulting SVG smaller
addSvgElementFromJsonCreate 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
shortFloatRounds a given value to a float with number of digits defined in save_options
getIdReturns the last created DOM element ID string
getNextIdCreates and returns a unique ID string for a DOM element
bindAttaches a callback function to an event
setIdPrefixChanges the ID prefix to the given value
sanitizeSvgSanitizes the input node and its children It only keeps what is allowed from our whitelist defined above
getUrlFromAttrExtracts the URL from the url(...)
Element Transforms
recalculateAllSelectedDimensionsRuns recalculateDimensions on the selected elements, adding the changes to a single batch command
remapElementApplies coordinate changes to an element based on the given matrix
recalculateDimensionsDecides the course of action based on the element’s transform list
transformPointA (hopefully) quicker function to transform a point by a matrix (this function avoids any DOM calls and just does the math)
isIdentityHelper function to check if the matrix performs no actual transform (i.e.
matrixMultiplyThis function tries to return a SVGMatrix that is the multiplication m1*m2.
transformListToTransformThis 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
hasMatrixTransformSee if the given transformlist includes a non-indentity matrix transform
getMatrixGet the matrix object for a given element
transformBoxTransforms a rectangle based on the given matrix
Selection
clearSelectionClears the selection.
addToSelectionAdds a list of elements to the selection.
removeFromSelectionRemoves elements from the selection.
smoothControlPointsTakes three points and creates a smoother line based on them
getMouseTargetGets the desired element from a mouse event
+

SelectorManager

Public class to manage all selector objects (selection boxes)

Summary
SelectorManager.initGroupResets the parent selector group element
SelectorManager.requestSelectorReturns the selector based on the given element
SelectorManager.releaseSelectorRemoves the selector of the given element (hides selection box)
SelectorManager.getRubberBandBoxReturns the rubberBandBox DOM element.
Helper functions
walkTreeWalks the tree and executes the callback on each element in a top-down fashion
walkTreePostWalks the tree and executes the callback on each element in a depth-first fashion
assignAttributesAssigns multiple attributes to an element.
cleanupElementRemove unneeded (default) attributes, makes resulting SVG smaller
addSvgElementFromJsonCreate 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
shortFloatRounds a given value to a float with number of digits defined in save_options
getIdReturns the last created DOM element ID string
getNextIdCreates and returns a unique ID string for a DOM element
bindAttaches a callback function to an event
setIdPrefixChanges the ID prefix to the given value
sanitizeSvgSanitizes the input node and its children It only keeps what is allowed from our whitelist defined above
getUrlFromAttrExtracts the URL from the url(...)
Element Transforms
recalculateAllSelectedDimensionsRuns recalculateDimensions on the selected elements, adding the changes to a single batch command
remapElementApplies coordinate changes to an element based on the given matrix
recalculateDimensionsDecides the course of action based on the element’s transform list
transformPointA (hopefully) quicker function to transform a point by a matrix (this function avoids any DOM calls and just does the math)
isIdentityHelper function to check if the matrix performs no actual transform (i.e.
matrixMultiplyThis function tries to return a SVGMatrix that is the multiplication m1*m2.
transformListToTransformThis 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
hasMatrixTransformSee if the given transformlist includes a non-indentity matrix transform
getMatrixGet the matrix object for a given element
transformBoxTransforms a rectangle based on the given matrix
Selection
clearSelectionClears the selection.
addToSelectionAdds a list of elements to the selection.
removeFromSelectionRemoves elements from the selection.
selectAllInCurrentLayerClears the selection, then adds all elements in the current layer to the selection.
smoothControlPointsTakes three points and creates a smoother line based on them
getMouseTargetGets the desired element from a mouse event

SelectorManager.initGroup

Resets the parent selector group element

@@ -169,13 +169,15 @@ if (browserType) {document.write("
");if (browserV

removeFromSelection

this.removeFromSelection = function(elemsToRemove)

Removes elements from the selection.

Parameters

elemsToRemovean array of elements to remove from selection
+

selectAllInCurrentLayer

this.selectAllInCurrentLayer = function()

Clears the selection, then adds all elements in the current layer to the selection.  This function then fires the selected event.

+

smoothControlPoints

var smoothControlPoints = this.smoothControlPoints = function(ct1,
ct2,
pt)

Takes three points and creates a smoother line based on them

Parameters

ct1Object with x and y values (first control point)
ct2Object with x and y values (second control point)
ptObject with x and y values (third point)

Returns

Array of two “smoothed” point objects

getMouseTarget

var getMouseTarget = this.getMouseTarget = function(evt)

Gets the desired element from a mouse event

Parameters

evtEvent object from the mouse event

Returns

DOM element we want

textActions

Functions relating to editing text elements

-

pathActions

Functions relating to editing path elements

Summary
Serialization
removeUnusedDefElemsLooks at DOM elements inside the <defs> to see if they are referred to, removes them from the DOM if they are not.
svgCanvasToStringMain function to set up the SVG content for output
svgToStringSub function ran on each SVG element to convert it to a string as desired
embedImageConverts a given image file to a data URL when possible, then runs a given callback
saveSerializes the current drawing into SVG XML text and returns it to the ‘saved’ handler.
rasterExportGenerates a PNG Data URL based on the current image, then calls “exported” with an object including the string and any issues found
getSvgStringReturns the current drawing as raw SVG XML text.
setSvgStringThis function sets the current drawing as the input SVG XML.
importSvgStringThis function imports the input SVG XML into the current layer in the drawing
Layers
createLayerCreates 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.
deleteCurrentLayerDeletes the current layer from the drawing and then clears the selection.
getNumLayersReturns the number of layers in the current drawing.
getLayerReturns the name of the ith layer.
getCurrentLayerReturns the name of the currently selected layer.
setCurrentLayerSets the current layer.
renameCurrentLayerRenames the current layer.
setCurrentLayerPositionChanges the position of the current layer to the new value.
getLayerVisibilityReturns whether the layer is visible.
setLayerVisibilitySets the visibility of the layer.
moveSelectedToLayerMoves the selected elements to layername.
getLayerOpacityReturns the opacity of the given layer.
setLayerOpacitySets the opacity of the given layer.
selectAllInCurrentLayerClears the selection, then adds all elements in the current layer to the selection.
clearClears the current document.
Fill and Stroke
convertToPathConvert selected element to a path, or get the BBox of an element-as-path
getVersionReturns a string which describes the revision number of SvgCanvas.
+

pathActions

Functions relating to editing path elements

Summary
Serialization
removeUnusedDefElemsLooks at DOM elements inside the <defs> to see if they are referred to, removes them from the DOM if they are not.
svgCanvasToStringMain function to set up the SVG content for output
svgToStringSub function ran on each SVG element to convert it to a string as desired
embedImageConverts a given image file to a data URL when possible, then runs a given callback
saveSerializes the current drawing into SVG XML text and returns it to the ‘saved’ handler.
rasterExportGenerates a PNG Data URL based on the current image, then calls “exported” with an object including the string and any issues found
getSvgStringReturns the current drawing as raw SVG XML text.
setSvgStringThis function sets the current drawing as the input SVG XML.
importSvgStringThis function imports the input SVG XML into the current layer in the drawing
Layers
identifyLayersUpdates layer system
createLayerCreates 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.
deleteCurrentLayerDeletes the current layer from the drawing and then clears the selection.
getNumLayersReturns the number of layers in the current drawing.
getLayerReturns the name of the ith layer.
getCurrentLayerReturns the name of the currently selected layer.
setCurrentLayerSets the current layer.
renameCurrentLayerRenames the current layer.
setCurrentLayerPositionChanges the position of the current layer to the new value.
getLayerVisibilityReturns whether the layer is visible.
setLayerVisibilitySets the visibility of the layer.
moveSelectedToLayerMoves the selected elements to layername.
getLayerOpacityReturns the opacity of the given layer.
setLayerOpacitySets the opacity of the given layer.
User actions
clearClears the current document.
linkControlPointsAlias function
getContentElemReturns the content DOM element
getRootElemReturns the root DOM element
getSelectedElemsReturns the array with selected DOM elements
getResolutionReturns the current dimensions and zoom level in an object
getDocumentTitleReturns the current document title or an empty string if not found
setDocumentTitleAdds/updates a title element for the document with the given name.
Fill and Stroke
convertToPathConvert selected element to a path, or get the BBox of an element-as-path
getVersionReturns a string which describes the revision number of SvgCanvas.

Serialization

@@ -195,10 +197,12 @@ if (browserType) {document.write("
");if (browserV

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.

-

importSvgString

this.importSvgString = function(xmlString)

This function imports the input SVG XML into the current layer in the drawing

Parameters

xmlStringThe SVG as XML text.

Returns

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

+

importSvgString

this.importSvgString = function(xmlString)

This function imports the input SVG XML into the current layer in the drawing

Parameters

xmlStringThe SVG as XML text.

Returns

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)
  • properly handle recalculating dimensions, recalculateDimensions() doesn’t handle arbitrary transform lists, but makes some assumptions about how the transform list was obtained
  • import should happen in top-left of current zoomed viewport
  • create a new layer for the imported SVG

Layers

+

identifyLayers

var identifyLayers = function()

Updates layer system

+

createLayer

this.createLayer = function(name)

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 is an undoable action.

Parameters

nameThe given name

deleteCurrentLayer

this.deleteCurrentLayer = function()

Deletes the current layer from the drawing and then clears the selection.  This function then calls the ‘changed’ handler.  This is an undoable action.

@@ -225,10 +229,24 @@ if (browserType) {document.write("
");if (browserV

setLayerOpacity

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.

Parameters

layernamename of the layer on which to set the opacity
opacitya float value in the range 0.0-1.0
-

selectAllInCurrentLayer

this.selectAllInCurrentLayer = function()

Clears the selection, then adds all elements in the current layer to the selection.  This function then fires the selected event.

+

User actions

clear

this.clear = function()

Clears the current document.  This is not an undoable action.

+

linkControlPoints

Alias function

+ +

getContentElem

this.getContentElem = function()

Returns the content DOM element

+ +

getRootElem

this.getRootElem = function()

Returns the root DOM element

+ +

getSelectedElems

this.getSelectedElems = function()

Returns the array with selected DOM elements

+ +

getResolution

this.getResolution = function()

Returns the current dimensions and zoom level in an object

+ +

getDocumentTitle

this.getDocumentTitle = function()

Returns the current document title or an empty string if not found

+ +

setDocumentTitle

this.setDocumentTitle = function(newtitle)

Adds/updates a title element for the document with the given name.  This is an undoable action

Parameters

newtitleString with the new title
+

Fill and Stroke

convertToPath

this.convertToPath = function(elem,
getBBox)

Convert selected element to a path, or get the BBox of an element-as-path

Parameters

elemThe DOM element to be converted
getBBoxBoolean on whether or not to only return the path’s BBox

Returns

If the getBBox flag is true, the resulting path’s bounding box object.  Otherwise the resulting path element is returned.

@@ -248,7 +266,7 @@ var searchPanel = new SearchPanel("searchPanel", "HTML", "../search"); -
toXml = function(str)
Converts characters in a string to XML-friendly entities.
fromXml = function(str)
Converts XML entities in a string to single characters.
convertToNum = function(attr,
val)
Converts given values to numbers.
setUnitAttr = function(elem,
attr,
val)
Sets an element’s attribute based on the unit in its current value.
canvas.isValidUnit = function(attr,
val)
Check if an attribute’s value is in a valid format
var ChangeElementCommand = this.undoCmd.changeElement = function(elem,
attrs,
text)
History command to make a change to an element.
var InsertElementCommand = this.undoCmd.insertElement = function(elem,
text)
History command for an element that was added to the DOM
var RemoveElementCommand = this.undoCmd.removeElement = function(elem,
parent,
text)
History command for an element removed from the DOM
var MoveElementCommand = this.undoCmd.moveElement = function(elem,
oldNextSibling,
oldParent,
text)
History command for an element that had its DOM position changed
var BatchCommand = this.undoCmd.batch = function(text)
History command that can contain/execute multiple other commands
resetUndoStack = function()
Resets the undo stack, effectively clearing the undo/redo history
addCommandToHistory = c.undoCmd.add = function(cmd)
Adds a command object to the undo history stack
c.beginUndoableChange = function(attrName,
elems)
This function tells the canvas to remember the old values of the attrName attribute for each element sent in.
c.finishUndoableChange = function()
This function returns a BatchCommand object which summarizes the change since beginUndoableChange was called.
function walkTree(elem,
cbFn)
Walks the tree and executes the callback on each element in a top-down fashion
function walkTreePost(elem,
cbFn)
Walks the tree and executes the callback on each element in a depth-first fashion
var assignAttributes = this.assignAttributes = function(node,
attrs,
suspendLength,
unitCheck)
Assigns multiple attributes to an element.
var cleanupElement = this.cleanupElement = function(element)
Remove unneeded (default) attributes, makes resulting SVG smaller
var addSvgElementFromJson = this.addSvgElementFromJson = function(data)
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 shortFloat = function(val)
Rounds a given value to a float with number of digits defined in save_options
getId = c.getId = function()
Returns the last created DOM element ID string
getNextId = c.getNextId = function()
Creates and returns a unique ID string for a DOM element
c.bind = function(event,
f)
Attaches a callback function to an event
c.setIdPrefix = function(p)
Changes the ID prefix to the given value
var sanitizeSvg = this.sanitizeSvg = function(node)
Sanitizes the input node and its children It only keeps what is allowed from our whitelist defined above
var getUrlFromAttr = this.getUrlFromAttr = function(attrVal)
Extracts the URL from the url(...)
var recalculateAllSelectedDimensions = this.recalculateAllSelectedDimensions = function()
Runs recalculateDimensions on the selected elements, adding the changes to a single batch command
var remapElement = this.remapElement = function(selected,
changes,
m)
Applies coordinate changes to an element based on the given matrix
var recalculateDimensions = this.recalculateDimensions = function(selected)
Decides the course of action based on the element’s transform list
var transformPoint = function(x,
y,
m)
A (hopefully) quicker function to transform a point by a matrix (this function avoids any DOM calls and just does the math)
var isIdentity = function(m)
Helper function to check if the matrix performs no actual transform (i.e.
var matrixMultiply = this.matrixMultiply = function()
This function tries to return a SVGMatrix that is the multiplication m1*m2.
var transformListToTransform = this.transformListToTransform = function(tlist,
min,
max)
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 hasMatrixTransform = this.hasMatrixTransform = function(tlist)
See if the given transformlist includes a non-indentity matrix transform
var getMatrix = function(elem)
Get the matrix object for a given element
var transformBox = this.transformBox = function(l,
t,
w,
h,
m)
Transforms a rectangle based on the given matrix
this.clearSelection = function(noCall)
Clears the selection.
this.addToSelection = function(elemsToAdd,
showGrips)
Adds a list of elements to the selection.
this.removeFromSelection = function(elemsToRemove)
Removes elements from the selection.
var smoothControlPoints = this.smoothControlPoints = function(ct1,
ct2,
pt)
Takes three points and creates a smoother line based on them
var getMouseTarget = this.getMouseTarget = function(evt)
Gets the desired element from a mouse event
var removeUnusedDefElems = this.removeUnusedDefElems = function()
Looks at DOM elements inside the defs to see if they are referred to, removes them from the DOM if they are not.
var svgCanvasToString = this.svgCanvasToString = function()
Main function to set up the SVG content for output
var svgToString = this.svgToString = function(elem,
indent)
Sub function ran on each SVG element to convert it to a string as desired
this.embedImage = function(val,
callback)
Converts a given image file to a data URL when possible, then runs a given callback
this.save = function(opts)
Serializes the current drawing into SVG XML text and returns it to the ‘saved’ handler.
this.rasterExport = 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.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.importSvgString = function(xmlString)
This function imports the input SVG XML into the current layer in the drawing
this.createLayer = function(name)
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.deleteCurrentLayer = function()
Deletes the current layer from the drawing and then clears the selection.
this.getNumLayers = function()
Returns the number of layers in the current drawing.
this.getLayer = function(i)
Returns the name of the ith layer.
this.getCurrentLayer = function()
Returns the name of the currently selected layer.
this.setCurrentLayer = function(name)
Sets the current layer.
this.renameCurrentLayer = function(newname)
Renames the current layer.
this.setCurrentLayerPosition = function(newpos)
Changes the position of the current layer to the new value.
this.getLayerVisibility = function(layername)
Returns whether the layer is visible.
this.setLayerVisibility = function(layername,
bVisible)
Sets the visibility of the layer.
this.moveSelectedToLayer = function(layername)
Moves the selected elements to layername.
this.getLayerOpacity = function(layername)
Returns the opacity of the given layer.
this.setLayerOpacity = function(layername,
opacity)
Sets the opacity of the given layer.
this.selectAllInCurrentLayer = function()
Clears the selection, then adds all elements in the current layer to the selection.
this.clear = function()
Clears the current document.
this.convertToPath = function(elem,
getBBox)
Convert selected element to a path, or get the BBox of an element-as-path
this.getVersion = function()
Returns a string which describes the revision number of SvgCanvas.
+
toXml = function(str)
Converts characters in a string to XML-friendly entities.
fromXml = function(str)
Converts XML entities in a string to single characters.
convertToNum = function(attr,
val)
Converts given values to numbers.
setUnitAttr = function(elem,
attr,
val)
Sets an element’s attribute based on the unit in its current value.
canvas.isValidUnit = function(attr,
val)
Check if an attribute’s value is in a valid format
var ChangeElementCommand = this.undoCmd.changeElement = function(elem,
attrs,
text)
History command to make a change to an element.
var InsertElementCommand = this.undoCmd.insertElement = function(elem,
text)
History command for an element that was added to the DOM
var RemoveElementCommand = this.undoCmd.removeElement = function(elem,
parent,
text)
History command for an element removed from the DOM
var MoveElementCommand = this.undoCmd.moveElement = function(elem,
oldNextSibling,
oldParent,
text)
History command for an element that had its DOM position changed
var BatchCommand = this.undoCmd.batch = function(text)
History command that can contain/execute multiple other commands
resetUndoStack = function()
Resets the undo stack, effectively clearing the undo/redo history
addCommandToHistory = c.undoCmd.add = function(cmd)
Adds a command object to the undo history stack
c.beginUndoableChange = function(attrName,
elems)
This function tells the canvas to remember the old values of the attrName attribute for each element sent in.
c.finishUndoableChange = function()
This function returns a BatchCommand object which summarizes the change since beginUndoableChange was called.
function walkTree(elem,
cbFn)
Walks the tree and executes the callback on each element in a top-down fashion
function walkTreePost(elem,
cbFn)
Walks the tree and executes the callback on each element in a depth-first fashion
var assignAttributes = this.assignAttributes = function(node,
attrs,
suspendLength,
unitCheck)
Assigns multiple attributes to an element.
var cleanupElement = this.cleanupElement = function(element)
Remove unneeded (default) attributes, makes resulting SVG smaller
var addSvgElementFromJson = this.addSvgElementFromJson = function(data)
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 shortFloat = function(val)
Rounds a given value to a float with number of digits defined in save_options
getId = c.getId = function()
Returns the last created DOM element ID string
getNextId = c.getNextId = function()
Creates and returns a unique ID string for a DOM element
c.bind = function(event,
f)
Attaches a callback function to an event
c.setIdPrefix = function(p)
Changes the ID prefix to the given value
var sanitizeSvg = this.sanitizeSvg = function(node)
Sanitizes the input node and its children It only keeps what is allowed from our whitelist defined above
var getUrlFromAttr = this.getUrlFromAttr = function(attrVal)
Extracts the URL from the url(...)
var recalculateAllSelectedDimensions = this.recalculateAllSelectedDimensions = function()
Runs recalculateDimensions on the selected elements, adding the changes to a single batch command
var remapElement = this.remapElement = function(selected,
changes,
m)
Applies coordinate changes to an element based on the given matrix
var recalculateDimensions = this.recalculateDimensions = function(selected)
Decides the course of action based on the element’s transform list
var transformPoint = function(x,
y,
m)
A (hopefully) quicker function to transform a point by a matrix (this function avoids any DOM calls and just does the math)
var isIdentity = function(m)
Helper function to check if the matrix performs no actual transform (i.e.
var matrixMultiply = this.matrixMultiply = function()
This function tries to return a SVGMatrix that is the multiplication m1*m2.
var transformListToTransform = this.transformListToTransform = function(tlist,
min,
max)
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 hasMatrixTransform = this.hasMatrixTransform = function(tlist)
See if the given transformlist includes a non-indentity matrix transform
var getMatrix = function(elem)
Get the matrix object for a given element
var transformBox = this.transformBox = function(l,
t,
w,
h,
m)
Transforms a rectangle based on the given matrix
this.clearSelection = function(noCall)
Clears the selection.
this.addToSelection = function(elemsToAdd,
showGrips)
Adds a list of elements to the selection.
this.removeFromSelection = function(elemsToRemove)
Removes elements from the selection.
this.selectAllInCurrentLayer = function()
Clears the selection, then adds all elements in the current layer to the selection.
var smoothControlPoints = this.smoothControlPoints = function(ct1,
ct2,
pt)
Takes three points and creates a smoother line based on them
var getMouseTarget = this.getMouseTarget = function(evt)
Gets the desired element from a mouse event
var removeUnusedDefElems = this.removeUnusedDefElems = function()
Looks at DOM elements inside the defs to see if they are referred to, removes them from the DOM if they are not.
var svgCanvasToString = this.svgCanvasToString = function()
Main function to set up the SVG content for output
var svgToString = this.svgToString = function(elem,
indent)
Sub function ran on each SVG element to convert it to a string as desired
this.embedImage = function(val,
callback)
Converts a given image file to a data URL when possible, then runs a given callback
this.save = function(opts)
Serializes the current drawing into SVG XML text and returns it to the ‘saved’ handler.
this.rasterExport = 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.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.importSvgString = function(xmlString)
This function imports the input SVG XML into the current layer in the drawing
var identifyLayers = function()
Updates layer system
this.createLayer = function(name)
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.deleteCurrentLayer = function()
Deletes the current layer from the drawing and then clears the selection.
this.getNumLayers = function()
Returns the number of layers in the current drawing.
this.getLayer = function(i)
Returns the name of the ith layer.
this.getCurrentLayer = function()
Returns the name of the currently selected layer.
this.setCurrentLayer = function(name)
Sets the current layer.
this.renameCurrentLayer = function(newname)
Renames the current layer.
this.setCurrentLayerPosition = function(newpos)
Changes the position of the current layer to the new value.
this.getLayerVisibility = function(layername)
Returns whether the layer is visible.
this.setLayerVisibility = function(layername,
bVisible)
Sets the visibility of the layer.
this.moveSelectedToLayer = function(layername)
Moves the selected elements to layername.
this.getLayerOpacity = function(layername)
Returns the opacity of the given layer.
this.setLayerOpacity = function(layername,
opacity)
Sets the opacity of the given layer.
this.clear = function()
Clears the current document.
this.getContentElem = function()
Returns the content DOM element
this.getRootElem = function()
Returns the root DOM element
this.getSelectedElems = function()
Returns the array with selected DOM elements
this.getResolution = function()
Returns the current dimensions and zoom level in an object
this.getDocumentTitle = function()
Returns the current document title or an empty string if not found
this.setDocumentTitle = function(newtitle)
Adds/updates a title element for the document with the given name.
this.convertToPath = function(elem,
getBBox)
Convert selected element to a path, or get the BBox of an element-as-path
this.getVersion = function()
Returns a string which describes the revision number of SvgCanvas.
diff --git a/docs/index/Functions.html b/docs/index/Functions.html index f557f3e6..c1dbf2cb 100644 --- a/docs/index/Functions.html +++ b/docs/index/Functions.html @@ -11,7 +11,7 @@ if (browserType) {document.write("
");if (browserV -
Function Index
$#! · 0-9 · A · B · C · D · E · F · G · H · I · J · K · L · M · N · O · P · Q · R · S · T · U · V · W · X · Y · Z
A
 addCommandToHistory, SvgCanvas
 addSubCommand, SvgCanvas.BatchCommand
 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.undoMgr
 getNextUndoCommandText, SvgCanvas.undoMgr
 getNumLayers, pathActions
 getRedoStackSize, SvgCanvas.undoMgr
 getRubberBandBox, SelectorManager.SelectorManager
 getSvgString, pathActions
 getUndoStackSize, SvgCanvas.undoMgr
 getUrlFromAttr, SelectorManager
 getVersion, pathActions
H
 hasMatrixTransform, SelectorManager
I
 importSvgString, pathActions
 initGroup, SelectorManager.SelectorManager
 InsertElementCommand, SvgCanvas
 isEmpty, SvgCanvas.BatchCommand
 isIdentity, SelectorManager
 isValidUnit, SvgCanvas
M
 matrixMultiply, SelectorManager
 MoveElementCommand, SvgCanvas
 moveSelectedToLayer, pathActions
R
 rasterExport, pathActions
 recalculateAllSelectedDimensions, SelectorManager
 recalculateDimensions, SelectorManager
 redo, SvgCanvas.undoMgr
 releaseSelector, SelectorManager.SelectorManager
 remapElement, SelectorManager
 RemoveElementCommand, SvgCanvas
 removeFromSelection, SelectorManager
 removeUnusedDefElems, pathActions
 renameCurrentLayer, pathActions
 requestSelector, SelectorManager.SelectorManager
 reset, Selector.Selector
 resetUndoStack, SvgCanvas
 resize, Selector.Selector
+
Function Index
$#! · 0-9 · A · B · C · D · E · F · G · H · I · J · K · L · M · N · O · P · Q · R · S · T · U · V · W · X · Y · Z
A
 addCommandToHistory, SvgCanvas
 addSubCommand, SvgCanvas.BatchCommand
 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.undoMgr
 getNextUndoCommandText, SvgCanvas.undoMgr
 getNumLayers, pathActions
 getRedoStackSize, SvgCanvas.undoMgr
 getResolution, pathActions
 getRootElem, pathActions
 getRubberBandBox, SelectorManager.SelectorManager
 getSelectedElems, pathActions
 getSvgString, pathActions
 getUndoStackSize, SvgCanvas.undoMgr
 getUrlFromAttr, SelectorManager
 getVersion, pathActions
H
 hasMatrixTransform, SelectorManager
I
 identifyLayers, pathActions
 importSvgString, pathActions
 initGroup, SelectorManager.SelectorManager
 InsertElementCommand, SvgCanvas
 isEmpty, SvgCanvas.BatchCommand
 isIdentity, SelectorManager
 isValidUnit, SvgCanvas
L
 linkControlPoints, pathActions
M
 matrixMultiply, SelectorManager
 MoveElementCommand, SvgCanvas
 moveSelectedToLayer, pathActions
R
 rasterExport, pathActions
 recalculateAllSelectedDimensions, SelectorManager
 recalculateDimensions, SelectorManager
 redo, SvgCanvas.undoMgr
 releaseSelector, SelectorManager.SelectorManager
 remapElement, SelectorManager
 RemoveElementCommand, SvgCanvas
 removeFromSelection, SelectorManager
 removeUnusedDefElems, pathActions
 renameCurrentLayer, pathActions
 requestSelector, SelectorManager.SelectorManager
 reset, Selector.Selector
 resetUndoStack, SvgCanvas
 resize, Selector.Selector
addCommandToHistory = c.undoCmd.add = function(cmd)
Adds a command object to the undo history stack
Adds a given command to the history stack
var addSvgElementFromJson = this.addSvgElementFromJson = function(data)
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
this.addToSelection = function(elemsToAdd,
showGrips)
Adds a list of elements to the selection.
Runs “apply” on all subcommands
Performs the stored change action
Re-Inserts the new element
Re-removes the new element
var assignAttributes = this.assignAttributes = function(node,
attrs,
suspendLength,
unitCheck)
Assigns multiple attributes to an element.
@@ -37,23 +37,27 @@ if (browserType) {document.write("
");if (browserV -
this.getCurrentLayer = function()
Returns the name of the currently selected layer.
getId = c.getId = function()
Returns the last created DOM element ID string
this.getLayer = function(i)
Returns the name of the ith layer.
this.getLayerOpacity = function(layername)
Returns the opacity of the given layer.
this.getLayerVisibility = function(layername)
Returns whether the layer is visible.
var getMatrix = function(elem)
Get the matrix object for a given element
var getMouseTarget = this.getMouseTarget = function(evt)
Gets the desired element from a mouse event
getNextId = c.getNextId = function()
Creates and returns a unique ID string for a DOM element
String associated with the next redo command
String associated with the next undo command
this.getNumLayers = function()
Returns the number of layers in the current drawing.
Integer with the current size of the redo history stack
Returns the rubberBandBox DOM element.
this.getSvgString = function()
Returns the current drawing as raw SVG XML text.
Integer with the current size of the undo history stack
var getUrlFromAttr = this.getUrlFromAttr = function(attrVal)
Extracts the URL from the url(...)
this.getVersion = function()
Returns a string which describes the revision number of SvgCanvas.
+
this.getContentElem = function()
Returns the content DOM element
this.getCurrentLayer = function()
Returns the name of the currently selected layer.
this.getDocumentTitle = function()
Returns the current document title or an empty string if not found
getId = c.getId = function()
Returns the last created DOM element ID string
this.getLayer = function(i)
Returns the name of the ith layer.
this.getLayerOpacity = function(layername)
Returns the opacity of the given layer.
this.getLayerVisibility = function(layername)
Returns whether the layer is visible.
var getMatrix = function(elem)
Get the matrix object for a given element
var getMouseTarget = this.getMouseTarget = function(evt)
Gets the desired element from a mouse event
getNextId = c.getNextId = function()
Creates and returns a unique ID string for a DOM element
String associated with the next redo command
String associated with the next undo command
this.getNumLayers = function()
Returns the number of layers in the current drawing.
Integer with the current size of the redo history stack
this.getResolution = function()
Returns the current dimensions and zoom level in an object
this.getRootElem = function()
Returns the root DOM element
Returns the rubberBandBox DOM element.
this.getSelectedElems = function()
Returns the array with selected DOM elements
this.getSvgString = function()
Returns the current drawing as raw SVG XML text.
Integer with the current size of the undo history stack
var getUrlFromAttr = this.getUrlFromAttr = function(attrVal)
Extracts the URL from the url(...)
this.getVersion = function()
Returns a string which describes the revision number of SvgCanvas.
-
var hasMatrixTransform = this.hasMatrixTransform = function(tlist)
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
-
this.importSvgString = function(xmlString)
This function imports the input SVG XML into the current layer in the drawing
Resets the parent selector group element
var InsertElementCommand = this.undoCmd.insertElement = function(elem,
text)
History command for an element that was added to the DOM
Returns a boolean indicating whether or not the batch command is empty
var isIdentity = function(m)
Helper function to check if the matrix performs no actual transform (i.e.
canvas.isValidUnit = function(attr,
val)
Check if an attribute’s value is in a valid format
+
var identifyLayers = function()
Updates layer system
this.importSvgString = function(xmlString)
This function imports the input SVG XML into the current layer in the drawing
Resets the parent selector group element
var InsertElementCommand = this.undoCmd.insertElement = function(elem,
text)
History command for an element that was added to the DOM
Returns a boolean indicating whether or not the batch command is empty
var isIdentity = function(m)
Helper function to check if the matrix performs no actual transform (i.e.
canvas.isValidUnit = function(attr,
val)
Check if an attribute’s value is in a valid format
-
var matrixMultiply = this.matrixMultiply = function()
This function tries to return a SVGMatrix that is the multiplication m1*m2.
var MoveElementCommand = this.undoCmd.moveElement = function(elem,
oldNextSibling,
oldParent,
text)
History command for an element that had its DOM position changed
this.moveSelectedToLayer = function(layername)
Moves the selected elements to layername.
+
Alias function
-
this.rasterExport = function()
Generates a PNG Data URL based on the current image, then calls “exported” with an object including the string and any issues found
var recalculateAllSelectedDimensions = this.recalculateAllSelectedDimensions = function()
Runs recalculateDimensions on the selected elements, adding the changes to a single batch command
var recalculateDimensions = this.recalculateDimensions = function(selected)
Decides the course of action based on the element’s transform list
Performs a redo step
Removes the selector of the given element (hides selection box)
var remapElement = this.remapElement = function(selected,
changes,
m)
Applies coordinate changes to an element based on the given matrix
var RemoveElementCommand = this.undoCmd.removeElement = function(elem,
parent,
text)
History command for an element removed from the DOM
this.removeFromSelection = function(elemsToRemove)
Removes elements from the selection.
var removeUnusedDefElems = this.removeUnusedDefElems = function()
Looks at DOM elements inside the defs to see if they are referred to, removes them from the DOM if they are not.
this.renameCurrentLayer = function(newname)
Renames the current layer.
Returns the selector based on the given element
Used to reset the id and element that the selector is attached to
resetUndoStack = function()
Resets the undo stack, effectively clearing the undo/redo history
Updates the selector to match the element’s size
+
var matrixMultiply = this.matrixMultiply = function()
This function tries to return a SVGMatrix that is the multiplication m1*m2.
var MoveElementCommand = this.undoCmd.moveElement = function(elem,
oldNextSibling,
oldParent,
text)
History command for an element that had its DOM position changed
this.moveSelectedToLayer = function(layername)
Moves the selected elements to layername.
+ + + +
this.rasterExport = function()
Generates a PNG Data URL based on the current image, then calls “exported” with an object including the string and any issues found
var recalculateAllSelectedDimensions = this.recalculateAllSelectedDimensions = function()
Runs recalculateDimensions on the selected elements, adding the changes to a single batch command
var recalculateDimensions = this.recalculateDimensions = function(selected)
Decides the course of action based on the element’s transform list
Performs a redo step
Removes the selector of the given element (hides selection box)
var remapElement = this.remapElement = function(selected,
changes,
m)
Applies coordinate changes to an element based on the given matrix
var RemoveElementCommand = this.undoCmd.removeElement = function(elem,
parent,
text)
History command for an element removed from the DOM
this.removeFromSelection = function(elemsToRemove)
Removes elements from the selection.
var removeUnusedDefElems = this.removeUnusedDefElems = function()
Looks at DOM elements inside the defs to see if they are referred to, removes them from the DOM if they are not.
this.renameCurrentLayer = function(newname)
Renames the current layer.
Returns the selector based on the given element
Used to reset the id and element that the selector is attached to
resetUndoStack = function()
Resets the undo stack, effectively clearing the undo/redo history
Updates the selector to match the element’s size
diff --git a/docs/index/General.html b/docs/index/General.html index aeb54c44..49093a7a 100644 --- a/docs/index/General.html +++ b/docs/index/General.html @@ -11,7 +11,7 @@ if (browserType) {document.write("
");if (browserV -
Index
$#! · 0-9 · A · B · C · D · E · F · G · H · I · J · K · L · M · N · O · P · Q · R · S · T · U · V · W · X · Y · Z
A
 addCommandToHistory, SvgCanvas
 addSubCommand, SvgCanvas.BatchCommand
 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.undoMgr
 getNextUndoCommandText, SvgCanvas.undoMgr
 getNumLayers, pathActions
 getRedoStackSize, SvgCanvas.undoMgr
 getRubberBandBox, SelectorManager.SelectorManager
 getSvgString, pathActions
 getUndoStackSize, SvgCanvas.undoMgr
 getUrlFromAttr, SelectorManager
 getVersion, pathActions
H
 hasMatrixTransform, SelectorManager
 Helper functions, SelectorManager
I
 importSvgString, pathActions
 initGroup, SelectorManager.SelectorManager
 InsertElementCommand, SvgCanvas
 isEmpty, SvgCanvas.BatchCommand
 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.undoMgr
 releaseSelector, SelectorManager.SelectorManager
 remapElement, SelectorManager
 RemoveElementCommand, SvgCanvas
 removeFromSelection, SelectorManager
 removeUnusedDefElems, pathActions
 renameCurrentLayer, pathActions
 requestSelector, SelectorManager.SelectorManager
 reset, Selector.Selector
 resetUndoStack, SvgCanvas
 resize, Selector.Selector
+
Index
$#! · 0-9 · A · B · C · D · E · F · G · H · I · J · K · L · M · N · O · P · Q · R · S · T · U · V · W · X · Y · Z
A
 addCommandToHistory, SvgCanvas
 addSubCommand, SvgCanvas.BatchCommand
 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.undoMgr
 getNextUndoCommandText, SvgCanvas.undoMgr
 getNumLayers, pathActions
 getRedoStackSize, SvgCanvas.undoMgr
 getResolution, pathActions
 getRootElem, pathActions
 getRubberBandBox, SelectorManager.SelectorManager
 getSelectedElems, pathActions
 getSvgString, pathActions
 getUndoStackSize, SvgCanvas.undoMgr
 getUrlFromAttr, SelectorManager
 getVersion, pathActions
H
 hasMatrixTransform, SelectorManager
 Helper functions, SelectorManager
I
 identifyLayers, pathActions
 importSvgString, pathActions
 initGroup, SelectorManager.SelectorManager
 InsertElementCommand, SvgCanvas
 isEmpty, SvgCanvas.BatchCommand
 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.undoMgr
 releaseSelector, SelectorManager.SelectorManager
 remapElement, SelectorManager
 RemoveElementCommand, SvgCanvas
 removeFromSelection, SelectorManager
 removeUnusedDefElems, pathActions
 renameCurrentLayer, pathActions
 requestSelector, SelectorManager.SelectorManager
 reset, Selector.Selector
 resetUndoStack, SvgCanvas
 resize, Selector.Selector
addCommandToHistory = c.undoCmd.add = function(cmd)
Adds a command object to the undo history stack
Adds a given command to the history stack
var addSvgElementFromJson = this.addSvgElementFromJson = function(data)
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
this.addToSelection = function(elemsToAdd,
showGrips)
Adds a list of elements to the selection.
Runs “apply” on all subcommands
Performs the stored change action
Re-Inserts the new element
Re-removes the new element
var assignAttributes = this.assignAttributes = function(node,
attrs,
suspendLength,
unitCheck)
Assigns multiple attributes to an element.
@@ -37,31 +37,31 @@ if (browserType) {document.write("
");if (browserV -
this.getCurrentLayer = function()
Returns the name of the currently selected layer.
getId = c.getId = function()
Returns the last created DOM element ID string
this.getLayer = function(i)
Returns the name of the ith layer.
this.getLayerOpacity = function(layername)
Returns the opacity of the given layer.
this.getLayerVisibility = function(layername)
Returns whether the layer is visible.
var getMatrix = function(elem)
Get the matrix object for a given element
var getMouseTarget = this.getMouseTarget = function(evt)
Gets the desired element from a mouse event
getNextId = c.getNextId = function()
Creates and returns a unique ID string for a DOM element
String associated with the next redo command
String associated with the next undo command
this.getNumLayers = function()
Returns the number of layers in the current drawing.
Integer with the current size of the redo history stack
Returns the rubberBandBox DOM element.
this.getSvgString = function()
Returns the current drawing as raw SVG XML text.
Integer with the current size of the undo history stack
var getUrlFromAttr = this.getUrlFromAttr = function(attrVal)
Extracts the URL from the url(...)
this.getVersion = function()
Returns a string which describes the revision number of SvgCanvas.
+
this.getContentElem = function()
Returns the content DOM element
this.getCurrentLayer = function()
Returns the name of the currently selected layer.
this.getDocumentTitle = function()
Returns the current document title or an empty string if not found
getId = c.getId = function()
Returns the last created DOM element ID string
this.getLayer = function(i)
Returns the name of the ith layer.
this.getLayerOpacity = function(layername)
Returns the opacity of the given layer.
this.getLayerVisibility = function(layername)
Returns whether the layer is visible.
var getMatrix = function(elem)
Get the matrix object for a given element
var getMouseTarget = this.getMouseTarget = function(evt)
Gets the desired element from a mouse event
getNextId = c.getNextId = function()
Creates and returns a unique ID string for a DOM element
String associated with the next redo command
String associated with the next undo command
this.getNumLayers = function()
Returns the number of layers in the current drawing.
Integer with the current size of the redo history stack
this.getResolution = function()
Returns the current dimensions and zoom level in an object
this.getRootElem = function()
Returns the root DOM element
Returns the rubberBandBox DOM element.
this.getSelectedElems = function()
Returns the array with selected DOM elements
this.getSvgString = function()
Returns the current drawing as raw SVG XML text.
Integer with the current size of the undo history stack
var getUrlFromAttr = this.getUrlFromAttr = function(attrVal)
Extracts the URL from the url(...)
this.getVersion = function()
Returns a string which describes the revision number of SvgCanvas.
-
var hasMatrixTransform = this.hasMatrixTransform = function(tlist)
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
-
this.importSvgString = function(xmlString)
This function imports the input SVG XML into the current layer in the drawing
Resets the parent selector group element
var InsertElementCommand = this.undoCmd.insertElement = function(elem,
text)
History command for an element that was added to the DOM
Returns a boolean indicating whether or not the batch command is empty
var isIdentity = function(m)
Helper function to check if the matrix performs no actual transform (i.e.
canvas.isValidUnit = function(attr,
val)
Check if an attribute’s value is in a valid format
+
var identifyLayers = function()
Updates layer system
this.importSvgString = function(xmlString)
This function imports the input SVG XML into the current layer in the drawing
Resets the parent selector group element
var InsertElementCommand = this.undoCmd.insertElement = function(elem,
text)
History command for an element that was added to the DOM
Returns a boolean indicating whether or not the batch command is empty
var isIdentity = function(m)
Helper function to check if the matrix performs no actual transform (i.e.
canvas.isValidUnit = function(attr,
val)
Check if an attribute’s value is in a valid format
- +
Alias function
-
var matrixMultiply = this.matrixMultiply = function()
This function tries to return a SVGMatrix that is the multiplication m1*m2.
var MoveElementCommand = this.undoCmd.moveElement = function(elem,
oldNextSibling,
oldParent,
text)
History command for an element that had its DOM position changed
this.moveSelectedToLayer = function(layername)
Moves the selected elements to layername.
+
var matrixMultiply = this.matrixMultiply = function()
This function tries to return a SVGMatrix that is the multiplication m1*m2.
var MoveElementCommand = this.undoCmd.moveElement = function(elem,
oldNextSibling,
oldParent,
text)
History command for an element that had its DOM position changed
this.moveSelectedToLayer = function(layername)
Moves the selected elements to layername.
-
Functions relating to editing path elements
+
Functions relating to editing path elements
-
this.rasterExport = function()
Generates a PNG Data URL based on the current image, then calls “exported” with an object including the string and any issues found
var recalculateAllSelectedDimensions = this.recalculateAllSelectedDimensions = function()
Runs recalculateDimensions on the selected elements, adding the changes to a single batch command
var recalculateDimensions = this.recalculateDimensions = function(selected)
Decides the course of action based on the element’s transform list
Performs a redo step
Removes the selector of the given element (hides selection box)
var remapElement = this.remapElement = function(selected,
changes,
m)
Applies coordinate changes to an element based on the given matrix
var RemoveElementCommand = this.undoCmd.removeElement = function(elem,
parent,
text)
History command for an element removed from the DOM
this.removeFromSelection = function(elemsToRemove)
Removes elements from the selection.
var removeUnusedDefElems = this.removeUnusedDefElems = function()
Looks at DOM elements inside the defs to see if they are referred to, removes them from the DOM if they are not.
this.renameCurrentLayer = function(newname)
Renames the current layer.
Returns the selector based on the given element
Used to reset the id and element that the selector is attached to
resetUndoStack = function()
Resets the undo stack, effectively clearing the undo/redo history
Updates the selector to match the element’s size
+
this.rasterExport = function()
Generates a PNG Data URL based on the current image, then calls “exported” with an object including the string and any issues found
var recalculateAllSelectedDimensions = this.recalculateAllSelectedDimensions = function()
Runs recalculateDimensions on the selected elements, adding the changes to a single batch command
var recalculateDimensions = this.recalculateDimensions = function(selected)
Decides the course of action based on the element’s transform list
Performs a redo step
Removes the selector of the given element (hides selection box)
var remapElement = this.remapElement = function(selected,
changes,
m)
Applies coordinate changes to an element based on the given matrix
var RemoveElementCommand = this.undoCmd.removeElement = function(elem,
parent,
text)
History command for an element removed from the DOM
this.removeFromSelection = function(elemsToRemove)
Removes elements from the selection.
var removeUnusedDefElems = this.removeUnusedDefElems = function()
Looks at DOM elements inside the defs to see if they are referred to, removes them from the DOM if they are not.
this.renameCurrentLayer = function(newname)
Renames the current layer.
Returns the selector based on the given element
Used to reset the id and element that the selector is attached to
resetUndoStack = function()
Resets the undo stack, effectively clearing the undo/redo history
Updates the selector to match the element’s size
diff --git a/docs/javascript/searchdata.js b/docs/javascript/searchdata.js index b40e37cf..0b51b29b 100644 --- a/docs/javascript/searchdata.js +++ b/docs/javascript/searchdata.js @@ -43,7 +43,7 @@ var indexSectionsWithContent = { "I": true, "J": false, "K": false, - "L": false, + "L": true, "M": true, "N": false, "O": false, diff --git a/docs/search/FunctionsG.html b/docs/search/FunctionsG.html index 06251883..74619cc3 100644 --- a/docs/search/FunctionsG.html +++ b/docs/search/FunctionsG.html @@ -11,7 +11,7 @@ if (browserType) {document.write("
");if (browserV -
Loading...
getCurrentLayer, pathActions
getId, SelectorManager
getLayer, pathActions
getLayerOpacity, pathActions
getLayerVisibility, pathActions
getMatrix, SelectorManager
getMouseTarget, SelectorManager
getNextId, SelectorManager
getNextRedoCommandText, SvgCanvas.undoMgr
getNextUndoCommandText, SvgCanvas.undoMgr
getNumLayers, pathActions
getRedoStackSize, SvgCanvas.undoMgr
getRubberBandBox, SelectorManager.SelectorManager
getSvgString, pathActions
getUndoStackSize, SvgCanvas.undoMgr
getUrlFromAttr, SelectorManager
getVersion, pathActions
Searching...
No Matches