SVG implementation of the Graphic
class.
SVGGraphic
is not intended to be used directly. Instead, use the Graphic
class.
If the browser has SVG capabilities, the Graphic
class will point to the SVGGraphic
class.
_appendShape
shape
Adds a shape instance to the graphic instance.
shape
Shape
The shape instance to be added to the graphic.
_createGraphicNode
type
pe
Creates a graphic node
HTMLElement
_createGraphics
Creates a contentNode element
_getDocFrag
Returns a document fragment to for attaching shapes.
DocumentFragment
_getShapeClass
val
Returns a shape class. Used by addShape
.
Function
_getUpdatedContentBounds
Recalculates and returns the contentBounds
for the Graphic
instance.
_redraw
Redraws all shapes.
_toBack
Shape
Inserts shape as the first child of the content node.
Shape
SVGShape
to add.
addShape
cfg
Generates a shape instance by type.
cfg
Object
attributes for the shape
Shape
addToRedrawQueue
shape
Adds a shape to the redraw queue and calculates the contentBounds. Used internally
by Shape
instances.
shape
SVGShape
batch
method
Allows for creating multiple shapes in order to batch appending and redraw operations.
method
Function
Method to execute.
clear
Clears the graphics object.
destroy
Removes all nodes.
getGradientNode
key
type
Returns a reference to a gradient definition based on an id and type.
HTMLElement
getShapeById
id
Returns a shape based on the id of its dom node.
id
String
Dom id of the shape's node attribute.
Shape
getXY
Gets the current position of the graphic instance in page coordinates.
Array The XY position of the shape.
initializer
Initializes the class.
removeAllShapes
Removes all shape instances from the dom.
removeShape
shape
Removes a shape instance from from the graphic instance.
render
parentNode
Adds the graphics node to the dom.
parentNode
HTMLElement
node in which to render the graphics node into.
set
name
value
Sets the value of an attribute.
_shapeClass
Look up for shape classes. Used by addShape
to retrieve a class for instantiation.
autoDraw
Indicates whether or not the instance will automatically redraw after a change is made to a shape. This property will get set to false when batching operations.
Default: true
autoSize
Determines the sizing of the Graphic.
width
and height
attributes or are determined by the dimensions of the parent element. The
content contained in the Graphic will be sized to fit with in the Graphic instance's dimensions. When using this
setting, the preserveAspectRatio
attribute will determine how the contents are sized.width
and height
attributes or are determined by the dimensions of the parent element. The contents of the
Graphic instance are not affected by this setting.Default: false
contentBounds
Object containing size and coordinate data for the content of a Graphic in relation to the coordSpace node.
node
The html element that represents to coordinate system of the Graphic instance.
preserveAspectRatio
Determines how content is sized when autoSize
is set to sizeContentToGraphic
.
Default: xMidYMid
render
Whether or not to render the Graphic
automatically after to a specified parent node after init. This can be a Node
instance or a CSS selector string.
resizeDown
The contentBounds will resize to greater values but not to smaller values. (for performance) When resizing the contentBounds down is desirable, set the resizeDown value to true.