Module: path

Path functionality.

License:
  • MIT
Source:
License:
  • MIT
Source:
License:
  • MIT
Source:

Classes

Path
Segment

Interfaces

EditorContext

Namespaces

pathActions

Members

(static) path :null|module:path.Path

Type:
Source:

(static, constant) pathActions

Group: Path edit functions. Functions relating to editing path elements.

Source:

(static) pathMap :GenericArray

This is how we map paths to our preferred relative segment types.

Type:
Source:

Methods

(static) addCtrlGrip(id) → {SVGCircleElement}

Requires prior call to setUiStrings if xlink:title to be set on the grip.

Parameters:
Name Type Description
id string
Source:
Returns:
Type
SVGCircleElement

(static) addCtrlGrip(id) → {SVGCircleElement}

Requires prior call to setUiStrings if xlink:title to be set on the grip.

Parameters:
Name Type Description
id string
Source:
Returns:
Type
SVGCircleElement

(static) addPointGrip(index, x, y) → {SVGCircleElement}

Requires prior call to setUiStrings if xlink:title to be set on the grip.

Parameters:
Name Type Description
index Integer
x Integer
y Integer
Source:
Returns:
Type
SVGCircleElement

(static) addPointGrip(index, x, y) → {SVGCircleElement}

Requires prior call to setUiStrings if xlink:title to be set on the grip.

Parameters:
Name Type Description
index Integer
x Integer
y Integer
Source:
Returns:
Type
SVGCircleElement

(static) clearData() → {void}

Source:
Returns:
Type
void

(static) convertPath(pth, toRel) → {string}

Convert a path to one with only absolute or relative values.

Parameters:
Name Type Description
pth SVGPathElement

the path to convert

toRel boolean

true of convert to relative

Source:
To Do:
  • move to pathActions.js
Returns:
Type
string

(static) convertPath(pth, toRel) → {string}

Convert a path to one with only absolute or relative values.

Parameters:
Name Type Description
pth SVGPathElement

the path to convert

toRel boolean

true of convert to relative

Source:
To Do:
  • move to pathActions.js
Returns:
Type
string

(static) getControlPoints(seg) → {PlainObject.<string, (SVGLineElement|SVGCircleElement)>}

Parameters:
Name Type Description
seg Segment
Source:
Returns:
Type
PlainObject.<string, (SVGLineElement|SVGCircleElement)>

(static) getControlPoints(seg) → {PlainObject.<string, (SVGLineElement|SVGCircleElement)>}

Parameters:
Name Type Description
seg Segment
Source:
Returns:
Type
PlainObject.<string, (SVGLineElement|SVGCircleElement)>

(static) getCtrlLine(id) → {SVGLineElement}

Parameters:
Name Type Description
id string
Source:
Returns:
Type
SVGLineElement

(static) getCtrlLine(id) → {SVGLineElement}

Parameters:
Name Type Description
id string
Source:
Returns:
Type
SVGLineElement

(static) getGripContainer() → {Element}

Source:
Returns:
Type
Element

(static) getGripContainer() → {Element}

Source:
Returns:
Type
Element

(static) getGripPt(seg, altPt) → {module:math.XYObject}

Parameters:
Name Type Description
seg Segment
altPt module:math.XYObject
Source:
Returns:
Type
module:math.XYObject

(static) getGripPt(seg, altPt) → {module:math.XYObject}

Parameters:
Name Type Description
seg Segment
altPt module:math.XYObject
Source:
Returns:
Type
module:math.XYObject

(static) getPath_(elem) → {module:path.Path}

Parameters:
Name Type Description
elem SVGPathElement
Source:
Returns:
Type
module:path.Path

(static) getPointFromGrip(pt, pth) → {module:math.XYObject}

Parameters:
Name Type Description
pt module:math.XYObject
pth module:path.Path
Source:
Returns:
Type
module:math.XYObject

(static) getPointFromGrip(pt, pth) → {module:math.XYObject}

Parameters:
Name Type Description
pt module:math.XYObject
pth module:path.Path
Source:
Returns:
Type
module:math.XYObject

(static) getPointGrip(seg, update) → {SVGCircleElement}

Parameters:
Name Type Description
seg Segment
update boolean
Source:
Returns:
Type
SVGCircleElement

(static) getPointGrip(seg, update) → {SVGCircleElement}

Parameters:
Name Type Description
seg Segment
update boolean
Source:
Returns:
Type
SVGCircleElement

(static) getSegSelector(seg, update) → {SVGPathElement}

Parameters:
Name Type Description
seg Segment
update boolean
Source:
Returns:
Type
SVGPathElement

(static) getSegSelector(seg, update) → {SVGPathElement}

Parameters:
Name Type Description
seg Segment
update boolean
Source:
Returns:
Type
SVGPathElement

(static) init(editorContext) → {void}

Parameters:
Name Type Description
editorContext module:path.EditorContext
Source:
Returns:
Type
void

(static) ptObjToArr(type, segItem) → {ArgumentsArray}

Parameters:
Name Type Description
type string
segItem SVGPathSegMovetoAbs | SVGPathSegLinetoAbs | SVGPathSegCurvetoCubicAbs | SVGPathSegCurvetoQuadraticAbs | SVGPathSegArcAbs | SVGPathSegLinetoHorizontalAbs | SVGPathSegLinetoVerticalAbs | SVGPathSegCurvetoCubicSmoothAbs | SVGPathSegCurvetoQuadraticSmoothAbs
Source:
To Do:
  • See if this should just live in `replacePathSeg`
Returns:
Type
ArgumentsArray

(static) ptObjToArr(type, segItem) → {ArgumentsArray}

Parameters:
Name Type Description
type string
segItem SVGPathSegMovetoAbs | SVGPathSegLinetoAbs | SVGPathSegCurvetoCubicAbs | SVGPathSegCurvetoQuadraticAbs | SVGPathSegArcAbs | SVGPathSegLinetoHorizontalAbs | SVGPathSegLinetoVerticalAbs | SVGPathSegCurvetoCubicSmoothAbs | SVGPathSegCurvetoQuadraticSmoothAbs
Source:
To Do:
  • See if this should just live in `replacePathSeg`
Returns:
Type
ArgumentsArray

(static) recalcRotatedPath() → {void}

Source:
To Do:
  • This is still using ye olde transform methods, can probably be optimized or even taken care of by `recalculateDimensions`
Returns:
Type
void

(static) removePath_(id) → {void}

Parameters:
Name Type Description
id string
Source:
Returns:
Type
void

(static) reorientGrads(elem, m) → {void}

Parameters:
Name Type Description
elem Element
m SVGMatrix
Source:
Returns:
Type
void

(static) replacePathSeg(type, index, pts, elem) → {void}

This replaces the segment at the given index. Type is given as number.

Parameters:
Name Type Description
type Integer

Possible values set during module:path.init

index Integer
pts ArgumentsArray
elem SVGPathElement
Source:
Returns:
Type
void

(static) replacePathSeg(type, index, pts, elem) → {void}

This replaces the segment at the given index. Type is given as number.

Parameters:
Name Type Description
type Integer

Possible values set during module:path.init

index Integer
pts ArgumentsArray
elem SVGPathElement
Source:
Returns:
Type
void

(static) setLinkControlPoints(lcp) → {void}

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

(static) setUiStrings(strs) → {void}

Parameters:
Name Type Description
strs module:path.uiStrings
Source:
Returns:
Type
void

(static) smoothControlPoints(ct1, ct2, pt) → {Array.<Point>}

Takes three points and creates a smoother line based on them.

Parameters:
Name Type Description
ct1 Point

Object with x and y values (first control point)

ct2 Point

Object with x and y values (second control point)

pt Point

Object with x and y values (third point)

Source:
Returns:

Array of two "smoothed" point objects

Type
Array.<Point>

(inner) pathDSegment(letter, points, morePointsopt, lastPointopt) → {string}

TODO: refactor callers in convertPath to use getPathDFromSegments instead of this function. Legacy code refactored from svgcanvas.pathActions.convertPath.

Parameters:
Name Type Attributes Description
letter string

path segment command (letter in potentially either case from module:path.pathMap; see SVGPathSeg#pathSegTypeAsLetter)

points GenericArray.<GenericArray.<Integer>>

x,y points

morePoints GenericArray.<GenericArray.<Integer>> <optional>

x,y points

lastPoint Array.<Integer> <optional>

x,y point

Source:
Returns:
Type
string

(inner) pathDSegment(letter, points, morePointsopt, lastPointopt) → {string}

TODO: refactor callers in convertPath to use getPathDFromSegments instead of this function. Legacy code refactored from svgcanvas.pathActions.convertPath.

Parameters:
Name Type Attributes Description
letter string

path segment command (letter in potentially either case from module:path.pathMap; see SVGPathSeg#pathSegTypeAsLetter)

points GenericArray.<GenericArray.<Integer>>

x,y points

morePoints GenericArray.<GenericArray.<Integer>> <optional>

x,y points

lastPoint Array.<Integer> <optional>

x,y point

Source:
Returns:
Type
string

(inner) smoothPolylineIntoPath(element) → {Element}

This function converts a polyline (created by the fh_path tool) into a path element and coverts every three line segments into a single bezier curve in an attempt to smooth out the free-hand.

Parameters:
Name Type Description
element Element
Source:
Returns:
Type
Element

Type Definitions

keepElement

Type:
Properties:
Name Type Description
keep boolean
element Element
Source:

NodePoint

Type:
Properties:
Name Type Description
x Float
y Float
type Integer
Source:

PathEachSegCallback(i) → {boolean|void}

This:
Parameters:
Name Type Description
i Integer

The index of the seg being iterated

Source:
Returns:

Will stop execution of eachSeg if returns false

Type
boolean | void

SVGElementJSON

Object with the following keys/values.

Type:
Properties:
Name Type Attributes Default Description
element string

Tag name of the SVG element to create

attr PlainObject.<string, string>

Has key-value attributes to assign to the new element. An id should be set so that module:utilities.EditorContext#addSVGElementsFromJson can later re-identify the element for modification or replacement.

curStyles boolean <optional>
false

Indicates whether current style attributes should be applied first

children Array.<module:path.SVGElementJSON> <optional>

Data objects to be added recursively as children

namespace string <optional>
"http://www.w3.org/2000/svg"

Indicate a (non-SVG) namespace

Source:

uiStrings

Type:
Properties:
Name Type Description
ui PlainObject.<string, string>
Source:
Tutorials:

Point

Type:
Properties:
Name Type Description
x Integer

The x value

y Integer

The y value

Source:

Path functionality.

License:
  • MIT
Source:
License:
  • MIT
Source:
License:
  • MIT
Source:

Classes

Path
Segment

Interfaces

EditorContext

Namespaces

pathActions

Members

(static) path :null|module:path.Path

Type:
Source:

(static, constant) pathActions

Group: Path edit functions. Functions relating to editing path elements.

Source:

(static) pathMap :GenericArray

This is how we map paths to our preferred relative segment types.

Type:
Source:

Methods

(static) addCtrlGrip(id) → {SVGCircleElement}

Requires prior call to setUiStrings if xlink:title to be set on the grip.

Parameters:
Name Type Description
id string
Source:
Returns:
Type
SVGCircleElement

(static) addCtrlGrip(id) → {SVGCircleElement}

Requires prior call to setUiStrings if xlink:title to be set on the grip.

Parameters:
Name Type Description
id string
Source:
Returns:
Type
SVGCircleElement

(static) addPointGrip(index, x, y) → {SVGCircleElement}

Requires prior call to setUiStrings if xlink:title to be set on the grip.

Parameters:
Name Type Description
index Integer
x Integer
y Integer
Source:
Returns:
Type
SVGCircleElement

(static) addPointGrip(index, x, y) → {SVGCircleElement}

Requires prior call to setUiStrings if xlink:title to be set on the grip.

Parameters:
Name Type Description
index Integer
x Integer
y Integer
Source:
Returns:
Type
SVGCircleElement

(static) clearData() → {void}

Source:
Returns:
Type
void

(static) convertPath(pth, toRel) → {string}

Convert a path to one with only absolute or relative values.

Parameters:
Name Type Description
pth SVGPathElement

the path to convert

toRel boolean

true of convert to relative

Source:
To Do:
  • move to pathActions.js
Returns:
Type
string

(static) convertPath(pth, toRel) → {string}

Convert a path to one with only absolute or relative values.

Parameters:
Name Type Description
pth SVGPathElement

the path to convert

toRel boolean

true of convert to relative

Source:
To Do:
  • move to pathActions.js
Returns:
Type
string

(static) getControlPoints(seg) → {PlainObject.<string, (SVGLineElement|SVGCircleElement)>}

Parameters:
Name Type Description
seg Segment
Source:
Returns:
Type
PlainObject.<string, (SVGLineElement|SVGCircleElement)>

(static) getControlPoints(seg) → {PlainObject.<string, (SVGLineElement|SVGCircleElement)>}

Parameters:
Name Type Description
seg Segment
Source:
Returns:
Type
PlainObject.<string, (SVGLineElement|SVGCircleElement)>

(static) getCtrlLine(id) → {SVGLineElement}

Parameters:
Name Type Description
id string
Source:
Returns:
Type
SVGLineElement

(static) getCtrlLine(id) → {SVGLineElement}

Parameters:
Name Type Description
id string
Source:
Returns:
Type
SVGLineElement

(static) getGripContainer() → {Element}

Source:
Returns:
Type
Element

(static) getGripContainer() → {Element}

Source:
Returns:
Type
Element

(static) getGripPt(seg, altPt) → {module:math.XYObject}

Parameters:
Name Type Description
seg Segment
altPt module:math.XYObject
Source:
Returns:
Type
module:math.XYObject

(static) getGripPt(seg, altPt) → {module:math.XYObject}

Parameters:
Name Type Description
seg Segment
altPt module:math.XYObject
Source:
Returns:
Type
module:math.XYObject

(static) getPath_(elem) → {module:path.Path}

Parameters:
Name Type Description
elem SVGPathElement
Source:
Returns:
Type
module:path.Path

(static) getPointFromGrip(pt, pth) → {module:math.XYObject}

Parameters:
Name Type Description
pt module:math.XYObject
pth module:path.Path
Source:
Returns:
Type
module:math.XYObject

(static) getPointFromGrip(pt, pth) → {module:math.XYObject}

Parameters:
Name Type Description
pt module:math.XYObject
pth module:path.Path
Source:
Returns:
Type
module:math.XYObject

(static) getPointGrip(seg, update) → {SVGCircleElement}

Parameters:
Name Type Description
seg Segment
update boolean
Source:
Returns:
Type
SVGCircleElement

(static) getPointGrip(seg, update) → {SVGCircleElement}

Parameters:
Name Type Description
seg Segment
update boolean
Source:
Returns:
Type
SVGCircleElement

(static) getSegSelector(seg, update) → {SVGPathElement}

Parameters:
Name Type Description
seg Segment
update boolean
Source:
Returns:
Type
SVGPathElement

(static) getSegSelector(seg, update) → {SVGPathElement}

Parameters:
Name Type Description
seg Segment
update boolean
Source:
Returns:
Type
SVGPathElement

(static) init(editorContext) → {void}

Parameters:
Name Type Description
editorContext module:path.EditorContext
Source:
Returns:
Type
void

(static) ptObjToArr(type, segItem) → {ArgumentsArray}

Parameters:
Name Type Description
type string
segItem SVGPathSegMovetoAbs | SVGPathSegLinetoAbs | SVGPathSegCurvetoCubicAbs | SVGPathSegCurvetoQuadraticAbs | SVGPathSegArcAbs | SVGPathSegLinetoHorizontalAbs | SVGPathSegLinetoVerticalAbs | SVGPathSegCurvetoCubicSmoothAbs | SVGPathSegCurvetoQuadraticSmoothAbs
Source:
To Do:
  • See if this should just live in `replacePathSeg`
Returns:
Type
ArgumentsArray

(static) ptObjToArr(type, segItem) → {ArgumentsArray}

Parameters:
Name Type Description
type string
segItem SVGPathSegMovetoAbs | SVGPathSegLinetoAbs | SVGPathSegCurvetoCubicAbs | SVGPathSegCurvetoQuadraticAbs | SVGPathSegArcAbs | SVGPathSegLinetoHorizontalAbs | SVGPathSegLinetoVerticalAbs | SVGPathSegCurvetoCubicSmoothAbs | SVGPathSegCurvetoQuadraticSmoothAbs
Source:
To Do:
  • See if this should just live in `replacePathSeg`
Returns:
Type
ArgumentsArray

(static) recalcRotatedPath() → {void}

Source:
To Do:
  • This is still using ye olde transform methods, can probably be optimized or even taken care of by `recalculateDimensions`
Returns:
Type
void

(static) removePath_(id) → {void}

Parameters:
Name Type Description
id string
Source:
Returns:
Type
void

(static) reorientGrads(elem, m) → {void}

Parameters:
Name Type Description
elem Element
m SVGMatrix
Source:
Returns:
Type
void

(static) replacePathSeg(type, index, pts, elem) → {void}

This replaces the segment at the given index. Type is given as number.

Parameters:
Name Type Description
type Integer

Possible values set during module:path.init

index Integer
pts ArgumentsArray
elem SVGPathElement
Source:
Returns:
Type
void

(static) replacePathSeg(type, index, pts, elem) → {void}

This replaces the segment at the given index. Type is given as number.

Parameters:
Name Type Description
type Integer

Possible values set during module:path.init

index Integer
pts ArgumentsArray
elem SVGPathElement
Source:
Returns:
Type
void

(static) setLinkControlPoints(lcp) → {void}

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

(static) setUiStrings(strs) → {void}

Parameters:
Name Type Description
strs module:path.uiStrings
Source:
Returns:
Type
void

(static) smoothControlPoints(ct1, ct2, pt) → {Array.<Point>}

Takes three points and creates a smoother line based on them.

Parameters:
Name Type Description
ct1 Point

Object with x and y values (first control point)

ct2 Point

Object with x and y values (second control point)

pt Point

Object with x and y values (third point)

Source:
Returns:

Array of two "smoothed" point objects

Type
Array.<Point>

(inner) pathDSegment(letter, points, morePointsopt, lastPointopt) → {string}

TODO: refactor callers in convertPath to use getPathDFromSegments instead of this function. Legacy code refactored from svgcanvas.pathActions.convertPath.

Parameters:
Name Type Attributes Description
letter string

path segment command (letter in potentially either case from module:path.pathMap; see SVGPathSeg#pathSegTypeAsLetter)

points GenericArray.<GenericArray.<Integer>>

x,y points

morePoints GenericArray.<GenericArray.<Integer>> <optional>

x,y points

lastPoint Array.<Integer> <optional>

x,y point

Source:
Returns:
Type
string

(inner) pathDSegment(letter, points, morePointsopt, lastPointopt) → {string}

TODO: refactor callers in convertPath to use getPathDFromSegments instead of this function. Legacy code refactored from svgcanvas.pathActions.convertPath.

Parameters:
Name Type Attributes Description
letter string

path segment command (letter in potentially either case from module:path.pathMap; see SVGPathSeg#pathSegTypeAsLetter)

points GenericArray.<GenericArray.<Integer>>

x,y points

morePoints GenericArray.<GenericArray.<Integer>> <optional>

x,y points

lastPoint Array.<Integer> <optional>

x,y point

Source:
Returns:
Type
string

(inner) smoothPolylineIntoPath(element) → {Element}

This function converts a polyline (created by the fh_path tool) into a path element and coverts every three line segments into a single bezier curve in an attempt to smooth out the free-hand.

Parameters:
Name Type Description
element Element
Source:
Returns:
Type
Element

Type Definitions

keepElement

Type:
Properties:
Name Type Description
keep boolean
element Element
Source:

NodePoint

Type:
Properties:
Name Type Description
x Float
y Float
type Integer
Source:

PathEachSegCallback(i) → {boolean|void}

This:
Parameters:
Name Type Description
i Integer

The index of the seg being iterated

Source:
Returns:

Will stop execution of eachSeg if returns false

Type
boolean | void

SVGElementJSON

Object with the following keys/values.

Type:
Properties:
Name Type Attributes Default Description
element string

Tag name of the SVG element to create

attr PlainObject.<string, string>

Has key-value attributes to assign to the new element. An id should be set so that module:utilities.EditorContext#addSVGElementsFromJson can later re-identify the element for modification or replacement.

curStyles boolean <optional>
false

Indicates whether current style attributes should be applied first

children Array.<module:path.SVGElementJSON> <optional>

Data objects to be added recursively as children

namespace string <optional>
"http://www.w3.org/2000/svg"

Indicate a (non-SVG) namespace

Source:

uiStrings

Type:
Properties:
Name Type Description
ui PlainObject.<string, string>
Source:
Tutorials:

Point

Type:
Properties:
Name Type Description
x Integer

The x value

y Integer

The y value

Source:

Path functionality.

License:
  • MIT
Source:
License:
  • MIT
Source:
License:
  • MIT
Source:

Classes

Path
Segment

Interfaces

EditorContext

Namespaces

pathActions

Members

(static) path :null|module:path.Path

Type:
Source:

(static, constant) pathActions

Group: Path edit functions. Functions relating to editing path elements.

Source:

(static) pathMap :GenericArray

This is how we map paths to our preferred relative segment types.

Type:
Source:

Methods

(static) addCtrlGrip(id) → {SVGCircleElement}

Requires prior call to setUiStrings if xlink:title to be set on the grip.

Parameters:
Name Type Description
id string
Source:
Returns:
Type
SVGCircleElement

(static) addCtrlGrip(id) → {SVGCircleElement}

Requires prior call to setUiStrings if xlink:title to be set on the grip.

Parameters:
Name Type Description
id string
Source:
Returns:
Type
SVGCircleElement

(static) addPointGrip(index, x, y) → {SVGCircleElement}

Requires prior call to setUiStrings if xlink:title to be set on the grip.

Parameters:
Name Type Description
index Integer
x Integer
y Integer
Source:
Returns:
Type
SVGCircleElement

(static) addPointGrip(index, x, y) → {SVGCircleElement}

Requires prior call to setUiStrings if xlink:title to be set on the grip.

Parameters:
Name Type Description
index Integer
x Integer
y Integer
Source:
Returns:
Type
SVGCircleElement

(static) clearData() → {void}

Source:
Returns:
Type
void

(static) convertPath(pth, toRel) → {string}

Convert a path to one with only absolute or relative values.

Parameters:
Name Type Description
pth SVGPathElement

the path to convert

toRel boolean

true of convert to relative

Source:
To Do:
  • move to pathActions.js
Returns:
Type
string

(static) convertPath(pth, toRel) → {string}

Convert a path to one with only absolute or relative values.

Parameters:
Name Type Description
pth SVGPathElement

the path to convert

toRel boolean

true of convert to relative

Source:
To Do:
  • move to pathActions.js
Returns:
Type
string

(static) getControlPoints(seg) → {PlainObject.<string, (SVGLineElement|SVGCircleElement)>}

Parameters:
Name Type Description
seg Segment
Source:
Returns:
Type
PlainObject.<string, (SVGLineElement|SVGCircleElement)>

(static) getControlPoints(seg) → {PlainObject.<string, (SVGLineElement|SVGCircleElement)>}

Parameters:
Name Type Description
seg Segment
Source:
Returns:
Type
PlainObject.<string, (SVGLineElement|SVGCircleElement)>

(static) getCtrlLine(id) → {SVGLineElement}

Parameters:
Name Type Description
id string
Source:
Returns:
Type
SVGLineElement

(static) getCtrlLine(id) → {SVGLineElement}

Parameters:
Name Type Description
id string
Source:
Returns:
Type
SVGLineElement

(static) getGripContainer() → {Element}

Source:
Returns:
Type
Element

(static) getGripContainer() → {Element}

Source:
Returns:
Type
Element

(static) getGripPt(seg, altPt) → {module:math.XYObject}

Parameters:
Name Type Description
seg Segment
altPt module:math.XYObject
Source:
Returns:
Type
module:math.XYObject

(static) getGripPt(seg, altPt) → {module:math.XYObject}

Parameters:
Name Type Description
seg Segment
altPt module:math.XYObject
Source:
Returns:
Type
module:math.XYObject

(static) getPath_(elem) → {module:path.Path}

Parameters:
Name Type Description
elem SVGPathElement
Source:
Returns:
Type
module:path.Path

(static) getPointFromGrip(pt, pth) → {module:math.XYObject}

Parameters:
Name Type Description
pt module:math.XYObject
pth module:path.Path
Source:
Returns:
Type
module:math.XYObject

(static) getPointFromGrip(pt, pth) → {module:math.XYObject}

Parameters:
Name Type Description
pt module:math.XYObject
pth module:path.Path
Source:
Returns:
Type
module:math.XYObject

(static) getPointGrip(seg, update) → {SVGCircleElement}

Parameters:
Name Type Description
seg Segment
update boolean
Source:
Returns:
Type
SVGCircleElement

(static) getPointGrip(seg, update) → {SVGCircleElement}

Parameters:
Name Type Description
seg Segment
update boolean
Source:
Returns:
Type
SVGCircleElement

(static) getSegSelector(seg, update) → {SVGPathElement}

Parameters:
Name Type Description
seg Segment
update boolean
Source:
Returns:
Type
SVGPathElement

(static) getSegSelector(seg, update) → {SVGPathElement}

Parameters:
Name Type Description
seg Segment
update boolean
Source:
Returns:
Type
SVGPathElement

(static) init(editorContext) → {void}

Parameters:
Name Type Description
editorContext module:path.EditorContext
Source:
Returns:
Type
void

(static) ptObjToArr(type, segItem) → {ArgumentsArray}

Parameters:
Name Type Description
type string
segItem SVGPathSegMovetoAbs | SVGPathSegLinetoAbs | SVGPathSegCurvetoCubicAbs | SVGPathSegCurvetoQuadraticAbs | SVGPathSegArcAbs | SVGPathSegLinetoHorizontalAbs | SVGPathSegLinetoVerticalAbs | SVGPathSegCurvetoCubicSmoothAbs | SVGPathSegCurvetoQuadraticSmoothAbs
Source:
To Do:
  • See if this should just live in `replacePathSeg`
Returns:
Type
ArgumentsArray

(static) ptObjToArr(type, segItem) → {ArgumentsArray}

Parameters:
Name Type Description
type string
segItem SVGPathSegMovetoAbs | SVGPathSegLinetoAbs | SVGPathSegCurvetoCubicAbs | SVGPathSegCurvetoQuadraticAbs | SVGPathSegArcAbs | SVGPathSegLinetoHorizontalAbs | SVGPathSegLinetoVerticalAbs | SVGPathSegCurvetoCubicSmoothAbs | SVGPathSegCurvetoQuadraticSmoothAbs
Source:
To Do:
  • See if this should just live in `replacePathSeg`
Returns:
Type
ArgumentsArray

(static) recalcRotatedPath() → {void}

Source:
To Do:
  • This is still using ye olde transform methods, can probably be optimized or even taken care of by `recalculateDimensions`
Returns:
Type
void

(static) removePath_(id) → {void}

Parameters:
Name Type Description
id string
Source:
Returns:
Type
void

(static) reorientGrads(elem, m) → {void}

Parameters:
Name Type Description
elem Element
m SVGMatrix
Source:
Returns:
Type
void

(static) replacePathSeg(type, index, pts, elem) → {void}

This replaces the segment at the given index. Type is given as number.

Parameters:
Name Type Description
type Integer

Possible values set during module:path.init

index Integer
pts ArgumentsArray
elem SVGPathElement
Source:
Returns:
Type
void

(static) replacePathSeg(type, index, pts, elem) → {void}

This replaces the segment at the given index. Type is given as number.

Parameters:
Name Type Description
type Integer

Possible values set during module:path.init

index Integer
pts ArgumentsArray
elem SVGPathElement
Source:
Returns:
Type
void

(static) setLinkControlPoints(lcp) → {void}

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

(static) setUiStrings(strs) → {void}

Parameters:
Name Type Description
strs module:path.uiStrings
Source:
Returns:
Type
void

(static) smoothControlPoints(ct1, ct2, pt) → {Array.<Point>}

Takes three points and creates a smoother line based on them.

Parameters:
Name Type Description
ct1 Point

Object with x and y values (first control point)

ct2 Point

Object with x and y values (second control point)

pt Point

Object with x and y values (third point)

Source:
Returns:

Array of two "smoothed" point objects

Type
Array.<Point>

(inner) pathDSegment(letter, points, morePointsopt, lastPointopt) → {string}

TODO: refactor callers in convertPath to use getPathDFromSegments instead of this function. Legacy code refactored from svgcanvas.pathActions.convertPath.

Parameters:
Name Type Attributes Description
letter string

path segment command (letter in potentially either case from module:path.pathMap; see SVGPathSeg#pathSegTypeAsLetter)

points GenericArray.<GenericArray.<Integer>>

x,y points

morePoints GenericArray.<GenericArray.<Integer>> <optional>

x,y points

lastPoint Array.<Integer> <optional>

x,y point

Source:
Returns:
Type
string

(inner) pathDSegment(letter, points, morePointsopt, lastPointopt) → {string}

TODO: refactor callers in convertPath to use getPathDFromSegments instead of this function. Legacy code refactored from svgcanvas.pathActions.convertPath.

Parameters:
Name Type Attributes Description
letter string

path segment command (letter in potentially either case from module:path.pathMap; see SVGPathSeg#pathSegTypeAsLetter)

points GenericArray.<GenericArray.<Integer>>

x,y points

morePoints GenericArray.<GenericArray.<Integer>> <optional>

x,y points

lastPoint Array.<Integer> <optional>

x,y point

Source:
Returns:
Type
string

(inner) smoothPolylineIntoPath(element) → {Element}

This function converts a polyline (created by the fh_path tool) into a path element and coverts every three line segments into a single bezier curve in an attempt to smooth out the free-hand.

Parameters:
Name Type Description
element Element
Source:
Returns:
Type
Element

Type Definitions

keepElement

Type:
Properties:
Name Type Description
keep boolean
element Element
Source:

NodePoint

Type:
Properties:
Name Type Description
x Float
y Float
type Integer
Source:

PathEachSegCallback(i) → {boolean|void}

This:
Parameters:
Name Type Description
i Integer

The index of the seg being iterated

Source:
Returns:

Will stop execution of eachSeg if returns false

Type
boolean | void

SVGElementJSON

Object with the following keys/values.

Type:
Properties:
Name Type Attributes Default Description
element string

Tag name of the SVG element to create

attr PlainObject.<string, string>

Has key-value attributes to assign to the new element. An id should be set so that module:utilities.EditorContext#addSVGElementsFromJson can later re-identify the element for modification or replacement.

curStyles boolean <optional>
false

Indicates whether current style attributes should be applied first

children Array.<module:path.SVGElementJSON> <optional>

Data objects to be added recursively as children

namespace string <optional>
"http://www.w3.org/2000/svg"

Indicate a (non-SVG) namespace

Source:

uiStrings

Type:
Properties:
Name Type Description
ui PlainObject.<string, string>
Source:
Tutorials:

Point

Type:
Properties:
Name Type Description
x Integer

The x value

y Integer

The y value

Source: