catenary-2
As the tin suggests, the 'svg' component makes an SVG. The SVG is editable and made new.
var svg = new PrimaryContext(undefined, '#container')
window.pipes = svg
svg.start()
Target a container or an svg name:
var svg = new PrimaryContext('svd_id')
SVG First, then fallback to the container:
var svg = new PrimaryContext('svd_id', "#svg_pawn_div")
For free we have a rendering layer, iterating objects and discovering a render() function:
svg.addItem({
render() {
...
}
})
Meta Data
| filepath_exists | True |
| path | catenary-2 |
| filepath | catenary-2.js |
| clean_files | () |
-
VariableDeclaration
-
VariableDeclaration
-
VariableDeclaration
-
ClassDeclarationclass
SVGContext
extends Noneclass comments:Generate a new SVG using the internal names and append the new svg to the given container. If the svg exists, it's reused else a new one is created.ClassDeclarationclassPrimaryContext
extends SVGContextclass comments:The context acts as a simple manager for many units on an SVG. Provde a svg name - used as an ID and a container selector. If the svgname does not exist as an svg# a new one is created. If the containerSelector is undefined, the newly generated svg is appended to the body. If the svg of name ID exists, it's used rather than creating, but it's still moved into the container (if given) containerSelector = '#my_container' svgName = 'svg1' // note - Not a jquery selector; context = new PrimaryContext(svgName, containerSelector) context.start() context.addItem({ name: 'bob' }) context.render()