Class: Dial

Dial(container, oopt)

Class representing an SVG Dial widget.

Constructor

new Dial(container, oopt)

Parameters:
Name Type Attributes Description
container object DOM container for the widget.
o object <optional>
options.
Source:

Methods

(private) _calcArcStrokeWidth() → {number}

Calcultes the stroke width for the background and active arcs.
Source:
Returns:
- Arc stroke width;
Type
number

(private) _calcDialRadius() → {number}

Calculates the dial radius.
Source:
Returns:
- Radius of the dial.
Type
number

_calcMovePrecision()

Calculates the precision with which the state value changes when moved.
Source:

(private) _calcNeedleAngle() → {number}

Calculates the needle angle for a given state val.
Source:
Returns:
- Angle of the needle.
Type
number

(private) _calcNeedleCenter() → {object}

Calculates the center of the needle.
Source:
Returns:
- {x, y} object representing the needle center coordinates.
Type
object

(private) _calcNeedleEnd() → {object}

Calculates the position of end of the needle
Source:
Returns:
- {x, y} object representing the end of the needle.
Type
object

(private) _calcNeedleWidth() → {number}

Calculates the needle width.
Source:
Returns:
- The width of the needle in px.
Type
number

(private) _calcSvgArcPath(cx, cy, r, startAngle, endAngle) → {string}

Calculates the path for an svg arc based on cx, cy, r, startAngle, endAngle. The input parameters are the way arcs are represented in HTML canvas.
Parameters:
Name Type Description
cx number Center X.
cy number Center Y.
r number Radius.
startAngle number Start angle in radians.
endAngle number End angle in radians.
Source:
Returns:
- A string to be used for the arc path by an SVG arc object.
Type
string

(private) _initHandlers()

Initializes mouse and touch event handlers.
Source:

(private) _initOptions()

Initializes the options.
Source:

(private) _initState()

Initializes state.
Source:

(private) _initStateConstraints()

Initializes state constraints.
Source:

(private) _initSvgEls()

Initializes the svg elements.
Source:

(private) _update()

Updates (redraws) components based on state.
Source:

getVal() → {number}

Returns the dial value.
Source:
Returns:
- Value of the dial.
Type
number

setInternalVal(newVal)

Sets the dial value. Same as setVal(), but will not trigger observer callbacks.
Parameters:
Name Type Description
newVal number The new value.
Source:

setOptions(o)

Sets the options.
Parameters:
Name Type Description
o object Options.
Source:

setVal(newVal)

Sets the dial value. Same as setInternalVal(), but will trigger observer callbacks.
Parameters:
Name Type Description
newVal number The new value.
Source: