From a9b2010b28ca085bc9f17caee952775cfc8b0edb Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Mon, 28 Jun 2010 20:09:34 +0000 Subject: [PATCH] Optimized some stroke/fill functions, more documentation git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1618 eee81c28-f429-11dd-99c0-75d572ba1ddd --- docs/files/svgcanvas-js.html | 54 +++++- docs/index/Functions.html | 16 +- docs/index/General.html | 18 +- docs/search/FunctionsG.html | 2 +- docs/search/FunctionsS.html | 2 +- docs/search/GeneralD.html | 2 +- docs/search/GeneralF.html | 2 +- docs/search/GeneralG.html | 2 +- docs/search/GeneralS.html | 2 +- editor/svg-editor.js | 30 +-- editor/svgcanvas.js | 343 ++++++++++++++++++++++------------- 11 files changed, 298 insertions(+), 175 deletions(-) diff --git a/docs/files/svgcanvas-js.html b/docs/files/svgcanvas-js.html index 0f107813..aa3fbcd8 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.
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.
+

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.
Document functions
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.
getEditorNSReturns the editor’s namespace URL, optionally adds it to root element
setResolutionChanges the document’s dimensions to the given size
getOffsetReturns an object with x, y values indicating the svgcontent element’s position in the editor’s canvas.
setBBoxZoomSets the zoom level on the canvas-side based on the given value
setZoomSets the zoom to the given level
getModeReturns the current editor mode string
setModeSets the editor’s mode to the given string
Element Styling
getColorReturns the current fill/stroke option
setColorChange the current stroke/fill color/gradient value
findDefsReturn the document’s <defs> element, create it first if necessary
setGradientApply the current gradient to selected element’s fill or stroke
findDuplicateGradientCheck if exact gradient already exists
setPaintSet a color/gradient to a fill/stroke
getStrokeWidthReturns the current stroke-width value
setStrokeWidthSets the stroke width for the current selected elements When attempting to set a line’s width to 0, this changes it to 1 instead
setStrokeAttrSet the given stroke-related attribute the given value for selected elements
getOpacityReturns the current opacity
setOpacitySets the given opacity to the current selected elements
getOpacityReturns the current fill opacity
getStrokeOpacityReturns the current stroke opacity
setPaintOpacitySets the current fill/stroke opacity
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.
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

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

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

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
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.
+

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.
Document functions
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.
getEditorNSReturns the editor’s namespace URL, optionally adds it to root element
setResolutionChanges the document’s dimensions to the given size
getOffsetReturns an object with x, y values indicating the svgcontent element’s position in the editor’s canvas.
setBBoxZoomSets the zoom level on the canvas-side based on the given value
setZoomSets the zoom to the given level
getModeReturns the current editor mode string
setModeSets the editor’s mode to the given string
Element Styling
getColorReturns the current fill/stroke option
setColorChange the current stroke/fill color/gradient value
findDefsReturn the document’s <defs> element, create it first if necessary
setGradientApply the current gradient to selected element’s fill or stroke
findDuplicateGradientCheck if exact gradient already exists
setPaintSet a color/gradient to a fill/stroke
getStrokeWidthReturns the current stroke-width value
setStrokeWidthSets the stroke width for the current selected elements When attempting to set a line’s width to 0, this changes it to 1 instead
setStrokeAttrSet the given stroke-related attribute the given value for selected elements
getOpacityReturns the current opacity
setOpacitySets the given opacity to the current selected elements
getOpacityReturns the current fill opacity
getStrokeOpacityReturns the current stroke opacity
setPaintOpacitySets the current fill/stroke opacity
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

@@ -229,7 +229,7 @@ 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
-

User actions

+

Document functions

clear

this.clear = function()

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

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

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

+

getEditorNS

this.getEditorNS = function(add)

Returns the editor’s namespace URL, optionally adds it to root element

Parameters

addBoolean to indicate whether or not to add the namespace value
+ +

setResolution

this.setResolution = function(x,
y)

Changes the document’s dimensions to the given size

Parameters

xNumber with the width of the new dimensions in user units.  Can also be the string “fit” to indicate “fit to content”
yNumber with the height of the new dimensions in user units.

Returns

Boolean to indicate if resolution change was succesful.  It will fail on “fit to content” option with no content to fit to.

+ +

getOffset

this.getOffset = function()

Returns an object with x, y values indicating the svgcontent element’s position in the editor’s canvas.

+ +

setBBoxZoom

this.setBBoxZoom = function(val,
editor_w,
editor_h)

Sets the zoom level on the canvas-side based on the given value

Parameters

valBounding box object to zoom to or string indicating zoom option
editor_wInteger with the editor’s workarea box’s width
editor_hInteger with the editor’s workarea box’s height
+ +

setZoom

this.setZoom = function(zoomlevel)

Sets the zoom to the given level

Parameters

zoomlevelFloat indicating the zoom level to change to
+ +

getMode

this.getMode = function()

Returns the current editor mode string

+ +

setMode

this.setMode = function(name)

Sets the editor’s mode to the given string

Parameters

nameString with the new mode to change to
+ +

Element Styling

+ +

getColor

this.getColor = function(type)

Returns the current fill/stroke option

+ +

setColor

this.setColor = function(type,
val,
preventUndo)

Change the current stroke/fill color/gradient value

Parameters

typeString indicating fill or stroke
valThe value to set the stroke attribute to
preventUndoBoolean indicating whether or not this should be and undoable option
+ +

findDefs

var findDefs = function()

Return the document’s <defs> element, create it first if necessary

+ +

setGradient

var setGradient = this.setGradient = function(type)

Apply the current gradient to selected element’s fill or stroke

Parameters type - String indicating “fill” or “stroke” to apply to an element

+ +

findDuplicateGradient

var findDuplicateGradient = function(grad)

Check if exact gradient already exists

Parameters

gradThe gradient DOM element to compare to others

Returns

The existing gradient if found, null if not

+ +

setPaint

this.setPaint = function(type,
paint)

Set a color/gradient to a fill/stroke

Parameters

typeString with “fill” or “stroke”
paintThe jGraduate paint object to apply
+ +

getStrokeWidth

this.getStrokeWidth = function()

Returns the current stroke-width value

+ +

setStrokeWidth

this.setStrokeWidth = function(val)

Sets the stroke width for the current selected elements When attempting to set a line’s width to 0, this changes it to 1 instead

Parameters

valA Float indicating the new stroke width value
+ +

setStrokeAttr

this.setStrokeAttr = function(attr,
val)

Set the given stroke-related attribute the given value for selected elements

Parameters

attrString with the attribute name
valString or number with the attribute value
+ +

getOpacity

this.getOpacity = function()

Returns the current opacity

+ +

setOpacity

this.setOpacity = function(val)

Sets the given opacity to the current selected elements

+ +

getOpacity

Returns the current fill opacity

+ +

getStrokeOpacity

this.getStrokeOpacity = function()

Returns the current stroke opacity

+ +

setPaintOpacity

this.setPaintOpacity = function(type,
val,
preventUndo)

Sets the current fill/stroke opacity

Parameters

typeString with “fill” or “stroke”
valFloat with the new opacity value
preventUndoBoolean indicating whether or not this should be an undoable action

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.

@@ -266,7 +308,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.
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.
+
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.getEditorNS = function(add)
Returns the editor’s namespace URL, optionally adds it to root element
this.setResolution = function(x,
y)
Changes the document’s dimensions to the given size
this.getOffset = function()
Returns an object with x, y values indicating the svgcontent element’s position in the editor’s canvas.
this.setBBoxZoom = function(val,
editor_w,
editor_h)
Sets the zoom level on the canvas-side based on the given value
this.setZoom = function(zoomlevel)
Sets the zoom to the given level
this.getMode = function()
Returns the current editor mode string
this.setMode = function(name)
Sets the editor’s mode to the given string
this.getColor = function(type)
Returns the current fill/stroke option
this.setColor = function(type,
val,
preventUndo)
Change the current stroke/fill color/gradient value
var findDefs = function()
Return the document’s defs element, create it first if necessary
var setGradient = this.setGradient = function(type)
Apply the current gradient to selected element’s fill or stroke
var findDuplicateGradient = function(grad)
Check if exact gradient already exists
this.setPaint = function(type,
paint)
Set a color/gradient to a fill/stroke
this.getStrokeWidth = function()
Returns the current stroke-width value
this.setStrokeWidth = function(val)
Sets the stroke width for the current selected elements When attempting to set a line’s width to 0, this changes it to 1 instead
this.setStrokeAttr = function(attr,
val)
Set the given stroke-related attribute the given value for selected elements
this.getOpacity = function()
Returns the current opacity
this.setOpacity = function(val)
Sets the given opacity to the current selected elements
this.getStrokeOpacity = function()
Returns the current stroke opacity
this.setPaintOpacity = function(type,
val,
preventUndo)
Sets the current fill/stroke opacity
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 c1dbf2cb..a708d702 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
 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
+
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
 findDefs, pathActions
 findDuplicateGradient, pathActions
 finishUndoableChange, SvgCanvas
 fromXml, SvgCanvas
G
 getColor, pathActions
 getContentElem, pathActions
 getCurrentLayer, pathActions
 getDocumentTitle, pathActions
 getEditorNS, pathActions
 getId, SelectorManager
 getLayer, pathActions
 getLayerOpacity, pathActions
 getLayerVisibility, pathActions
 getMatrix, SelectorManager
 getMode, pathActions
 getMouseTarget, SelectorManager
 getNextId, SelectorManager
 getNextRedoCommandText, SvgCanvas.undoMgr
 getNextUndoCommandText, SvgCanvas.undoMgr
 getNumLayers, pathActions
 getOffset, pathActions
 getOpacity, pathActions
 getRedoStackSize, SvgCanvas.undoMgr
 getResolution, pathActions
 getRootElem, pathActions
 getRubberBandBox, SelectorManager.SelectorManager
 getSelectedElems, pathActions
 getStrokeOpacity, pathActions
 getStrokeWidth, 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.
@@ -33,31 +33,31 @@ if (browserType) {document.write("
");if (browserV -
c.finishUndoableChange = function()
This function returns a BatchCommand object which summarizes the change since beginUndoableChange was called.
fromXml = function(str)
Converts XML entities in a string to single characters.
+
var findDefs = function()
Return the document’s defs element, create it first if necessary
var findDuplicateGradient = function(grad)
Check if exact gradient already exists
c.finishUndoableChange = function()
This function returns a BatchCommand object which summarizes the change since beginUndoableChange was called.
fromXml = function(str)
Converts XML entities in a string to single characters.
-
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.
+
this.getColor = function(type)
Returns the current fill/stroke option
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
this.getEditorNS = function(add)
Returns the editor’s namespace URL, optionally adds it to root element
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
this.getMode = function()
Returns the current editor mode string
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.
this.getOffset = function()
Returns an object with x, y values indicating the svgcontent element’s position in the editor’s canvas.
this.getOpacity = function()
Returns the current opacity
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.getStrokeOpacity = function()
Returns the current stroke opacity
this.getStrokeWidth = function()
Returns the current stroke-width value
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
-
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 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
+
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.
-
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/index/General.html b/docs/index/General.html index 49093a7a..c07becf0 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
 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
+
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
 Document functions, pathActions
E
 Element Styling, pathActions
 Element Transforms, SelectorManager
 elements
 embedImage, pathActions
F
 findDefs, pathActions
 findDuplicateGradient, pathActions
 finishUndoableChange, SvgCanvas
 fromXml, SvgCanvas
 Functions, Selector
G
 getColor, pathActions
 getContentElem, pathActions
 getCurrentLayer, pathActions
 getDocumentTitle, pathActions
 getEditorNS, pathActions
 getId, SelectorManager
 getLayer, pathActions
 getLayerOpacity, pathActions
 getLayerVisibility, pathActions
 getMatrix, SelectorManager
 getMode, pathActions
 getMouseTarget, SelectorManager
 getNextId, SelectorManager
 getNextRedoCommandText, SvgCanvas.undoMgr
 getNextUndoCommandText, SvgCanvas.undoMgr
 getNumLayers, pathActions
 getOffset, pathActions
 getOpacity, pathActions
 getRedoStackSize, SvgCanvas.undoMgr
 getResolution, pathActions
 getRootElem, pathActions
 getRubberBandBox, SelectorManager.SelectorManager
 getSelectedElems, pathActions
 getStrokeOpacity, pathActions
 getStrokeWidth, 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.
@@ -33,35 +33,35 @@ if (browserType) {document.write("
");if (browserV -
c.finishUndoableChange = function()
This function returns a BatchCommand object which summarizes the change since beginUndoableChange was called.
fromXml = function(str)
Converts XML entities in a string to single characters.
+
var findDefs = function()
Return the document’s defs element, create it first if necessary
var findDuplicateGradient = function(grad)
Check if exact gradient already exists
c.finishUndoableChange = function()
This function returns a BatchCommand object which summarizes the change since beginUndoableChange was called.
fromXml = function(str)
Converts XML entities in a string to single characters.
-
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.
+
this.getColor = function(type)
Returns the current fill/stroke option
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
this.getEditorNS = function(add)
Returns the editor’s namespace URL, optionally adds it to root element
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
this.getMode = function()
Returns the current editor mode string
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.
this.getOffset = function()
Returns an object with x, y values indicating the svgcontent element’s position in the editor’s canvas.
this.getOpacity = function()
Returns the current opacity
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.getStrokeOpacity = function()
Returns the current stroke opacity
this.getStrokeWidth = function()
Returns the current stroke-width value
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
-
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 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
+
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/search/FunctionsG.html b/docs/search/FunctionsG.html index 74619cc3..5f18c8ae 100644 --- a/docs/search/FunctionsG.html +++ b/docs/search/FunctionsG.html @@ -11,7 +11,7 @@ if (browserType) {document.write("
");if (browserV -
Loading...
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
Searching...
No Matches