ludo.svg.Canvas

ludo.svg.


new ludo.svg.Canvas(config)

Class used to create canvas(<SVG>) object

Parameters:
Name Type Description
config Object
Source:
Example
var canvas = new ludo.svg.Canvas({
 		renderTo:'idOfDiv'
 	});

Methods


addStyleSheet(className, styles)

Create a SVG Stylesheet

Parameters:
Name Type Description
className String
styles Object
Source:
Example
svg.addStyleSheet('box', { fill : '#669900', stroke: '#000' });
// Use the class
var rect = new ludo.svg.Rect({
  	x:0,y:0,width:500,height:500
});
svg.append(rect);
rect.addClass('box');

appendDef(node) → {canvas.Node}

Adopt node into <defs> tag of canvas

Parameters:
Name Type Description
node canvas.Node | canvas.View
Source:
Returns:

defs Node

Type
canvas.Node

getCenter() → {Object}

Returns center point of canvas as an object with x and y coordinates

Source:
Returns:
Type
Object

getDefs() → {canvas.Node}

Returns reference to <defs> node

Source:
Returns:

defs node

Type
canvas.Node

getHeight() → {Number}

Returns height of canvas

Source:
Returns:

height

Type
Number

getWidth() → {Number}

Returns width of canvas

Source:
Returns:

width

Type
Number

setViewBox(width, height, x, y)

Update view box size

Parameters:
Name Type Description
width Number

Viewbox width

height Number

Viewbox height

x Number

Optional left/x position

y Number

Optional top/y position

Source: