Interface: EditorContext

path.EditorContext

Properties:
Name Type Description
selectorManager module:select.SelectorManager
canvas module:svgcanvas.SvgCanvas
Source:

Methods

addCommandToHistory(cmd) → {void}

Parameters:
Name Type Description
cmd Command
Source:
Returns:
Type
void

addPtsToSelection(cfg) → {void}

Parameters:
Name Type Description
cfg PlainObject
Properties
Name Type Description
closedSubpath boolean
grips Array.<SVGCircleElement>
Source:
Returns:
Type
void

addSVGElementsFromJson(data) → {Element}

Parameters:
Name Type Description
data module:path.SVGElementJSON
Source:
Returns:

The new element

Type
Element

addToSelection(elemsToAdd, showGrips) → {void}

Parameters:
Name Type Description
elemsToAdd Array.<Element>

An array of DOM elements to add to the selection

showGrips boolean

Indicates whether the resize grips should be shown

Source:
Returns:
Type
void

call(ev, arg) → {void}

Parameters:
Name Type Description
ev "selected" | "changed"

String with the event name

arg module:svgcanvas.SvgCanvas#event:selected | module:svgcanvas.SvgCanvas#event:changed

Argument to pass through to the callback function. If the event is "changed", an array of Elements is passed; if "selected", a single-item array of Element is passed.

Source:
Returns:
Type
void

clearSelection(noCallopt) → {void}

Parameters:
Name Type Attributes Description
noCall boolean <optional>

When true, does not call the "selected" handler

Source:
Returns:
Type
void

endChanges(cfg) → {void}

Parameters:
Name Type Description
cfg PlainObject
Properties
Name Type Description
cmd string
elem Element
Source:
Returns:
Type
void

getContainer() → {Element}

Source:
Returns:
Type
Element

getCurrentMode() → {string}

Source:
Returns:
Type
string

getGridSnapping() → {boolean}

Source:
Returns:
Type
boolean

getId() → {string}

Returns the last created DOM element ID string.

Source:
Returns:
Type
string

getMouseTarget(evt) → {Element}

Gets the desired element from a mouse event.

Parameters:
Name Type Description
evt external:MouseEvent

Event object from the mouse event

Source:
Returns:

DOM element we want

Type
Element

getNextId() → {string}

Creates and returns a unique ID string for a DOM element.

Source:
Returns:
Type
string

getOpacity() → {Float}

Source:
Returns:
Type
Float

getRubberBox() → {SVGRectElement}

Source:
Returns:
Type
SVGRectElement

getSelectedElements() → {Array.<Element>}

Source:
Returns:

the array with selected DOM elements

Type
Array.<Element>

getSvgRoot() → {SVGSVGElement}

Source:
Returns:
Type
SVGSVGElement

getZoom() → {Float}

Source:
Returns:

The current zoom level

Type
Float

remapElement(selected, changes, m) → {void}

Parameters:
Name Type Description
selected Element

DOM element to be changed

changes PlainObject.<string, string>

Object with changes to be remapped

m SVGMatrix

Matrix object to use for remapping coordinates

Source:
Returns:
Type
void

round(val) → {Float}

Note: This doesn't round to an integer necessarily.

Parameters:
Name Type Description
val Float
Source:
Returns:

Rounded value to nearest value based on zoom

Type
Float

setCurrentMode(cm) → {string}

Parameters:
Name Type Description
cm string

The mode

Source:
Returns:

The same mode as passed in

Type
string

setDrawnPath(dp) → {SVGPathElement|null}

Parameters:
Name Type Description
dp SVGPathElement | null
Source:
Returns:

The same value as passed in

Type
SVGPathElement | null

setRubberBox(rb) → {SVGRectElement}

Parameters:
Name Type Description
rb SVGRectElement
Source:
Returns:

Same as parameter passed in

Type
SVGRectElement

setStarted(s) → {void}

Parameters:
Name Type Description
s boolean
Source:
Returns:
Type
void