Index

Svg

MMO.svg · 1 symbol · generated 5 Oct 2026

class

Svg

Svg.js:5
class MMO.svg.Svg
Namespace
MMO.svg

Index

From(svg, options) staticThe helper of an svg element, created the first time.
constructor(svg, options)
createElement(tag, attrs, children)Build an element in the svg namespace.
select(node)Mark one node as selected, carrying the selected class over to it.
allowSelection(cssSelector)Declare which nodes a double click can select, replacing any previous rule.
zoomBy(x, y, factor)Zoom around a point of the svg's own coordinate system.
focus(node, zoom)Bring a node into view, centring the viewbox on it.
updateViewbox(box)Animate the viewbox towards a new one, rather than jumping to it.

Methods8

From(svg, options)

staticSvg.js:15

The helper of an svg element, created the first time.

static From(svg, options = {})
svgSVGSVGElement
options = {}
returnsMMO.svg.Svg

constructor(svg, options)

Svg.js:20
constructor(svg, options = {})
svg
options = {}

createElement(tag, attrs, children)

Svg.js:105

Build an element in the svg namespace.

createElement(tag, attrs = null, ...children)
tagstring
attrs = null?(Object | Function | Array)
...children...*
returnsElement

select(node)

Svg.js:114

Mark one node as selected, carrying the selected class over to it.

select(node)
node?Elementnull clears the selection
returnsthis

allowSelection(cssSelector)

Svg.js:128

Declare which nodes a double click can select, replacing any previous rule.

allowSelection(cssSelector)
cssSelector?stringnull disables selection entirely
returnsthis

zoomBy(x, y, factor)

Svg.js:143

Zoom around a point of the svg's own coordinate system.

zoomBy(x, y, factor)
xnumberthe focal point's abscissa
ynumberthe focal point's ordinate
factornumberabove 1 zooms in, below 1 zooms out
returnsthis

focus(node, zoom)

Svg.js:163

Bring a node into view, centring the viewbox on it.

focus(node, zoom = false)
nodeElement | stringan element, or the id of one
zoom = falsebooleanalso scale the viewbox down to the node's own box
returnsthis

updateViewbox(box)

Svg.js:194

Animate the viewbox towards a new one, rather than jumping to it.

updateViewbox(box)
box