utils/svg

This module contains functions useful for manipulating SVGs.

Source:

Methods

(static) makeSVG(tag, arguments) → {SVGElement}

Source:

Creates and returns an SVG child element.

Parameters:
Name Type Description
tag string

The element to create as string, e.g. "line" or "g"

arguments object

The attributes to set onto the element

Returns:
Type
SVGElement

(inner) retrieve(object, key) → {*}

Source:

Retrieve a piece of data from an object.

Parameters:
Name Type Description
object object

The object to retrieve the data from

key string

The key to identify the memory

Returns:
Type
*

(inner) seatAllSVG(parent)

Source:

Searches for all SVG that don't have the class "svg-fixed" and re-positions them in order to avoid blurry lines.

Parameters:
Name Type Description
parent HTMLElement

If set only children of parent are searched

(inner) seatSVG(svg)

Source:

Move SVG for some sub-pixel if their position in viewport is not int.

Parameters:
Name Type Description
svg SVGElement

The SVG to manipulate

(inner) store(object, key, data)

Source:

Store a piece of data in an object.

Parameters:
Name Type Description
object object

The object to store the data

key string

The key to identify the memory

data *

The data to store