Dial.js revision 3e16868ea3bfcadfeeb8e23aca5bb2317a6a8ba9
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff/**
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * Create a circular dial value range input visualized as a draggable handle on a
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * background element.
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff *
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @module dial
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff var supportsVML = false,
189003a5b9ed3b1168f3331a2d4213bb08bf0d86Jeff Conniff testVMLNode;
2aa0883432cf56a974eb9261afcf6ede4313384cJeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff if (Y.UA.ie && Y.UA.ie < 9){
2aa0883432cf56a974eb9261afcf6ede4313384cJeff Conniff supportsVML = true;
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff }
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff var Lang = Y.Lang,
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff Widget = Y.Widget,
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff Node = Y.Node;
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * Create a dial to represent an input control capable of representing a
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * series of intermediate states based on the position of the Dial's handle.
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * These states are typically aligned to a value algorithm whereby the angle of the handle's
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * position corresponds to a given value.
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @class Dial
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @extends Widget
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @param config {Object} Configuration object
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @constructor
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff function Dial(config) {
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff Dial.superclass.constructor.apply(this, arguments);
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff }
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff
f47f024e093853ad3957be898687fc8317a835daJeff Conniff // Y.Dial static properties
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff /**
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * The identity of the widget.
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff *
10d8bafc5c24f3a4285cf6060a1935ba5cfc4b85Luke Smith * @property Dial.NAME
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @type String
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @default 'dial'
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @readOnly
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @protected
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @static
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff */
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff Dial.NAME = "dial";
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff /**
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * Static property used to define the default attribute configuration of
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * the Widget.
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff *
10d8bafc5c24f3a4285cf6060a1935ba5cfc4b85Luke Smith * @property Dial.ATTRS
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @type {Object}
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @protected
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @static
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff */
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff Dial.ATTRS = {
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * minimum value allowed
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff *
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @attribute min
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @type {Number}
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @default -220
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff */
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff min : {
24ef71067b8f34f90df1fc636a73424647c97f4bJeff Conniff value:-220
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff },
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * maximum value allowed
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff *
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @attribute max
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @type {Number}
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @default 220
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff */
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff max : {
24ef71067b8f34f90df1fc636a73424647c97f4bJeff Conniff value:220
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff },
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
04f7ef259d54aeab53258697e1e7f8856adcc8a6Jeff Conniff * diameter of the circular background object
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * other objects scale accordingly
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @attribute diameter
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @type {Number} the number of px in diameter
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @default 100
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff diameter : {
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff value:100
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff * initial value of the Dial
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
691af6c84a00ad5f629ffcfa3b1e42c38da5da4fJeff Conniff * @attribute value
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @type {Number}
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @default 0
691af6c84a00ad5f629ffcfa3b1e42c38da5da4fJeff Conniff */
7928e2ef0532df9064d9374ceda31d6ab080eb2dJeff Conniff value : {
691af6c84a00ad5f629ffcfa3b1e42c38da5da4fJeff Conniff value:0,
691af6c84a00ad5f629ffcfa3b1e42c38da5da4fJeff Conniff validator: function(val) {
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff return this._validateValue(val);
691af6c84a00ad5f629ffcfa3b1e42c38da5da4fJeff Conniff }
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
691af6c84a00ad5f629ffcfa3b1e42c38da5da4fJeff Conniff * amount to increment/decrement the dial value
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * when the arrow up/down/left/right keys are pressed
691af6c84a00ad5f629ffcfa3b1e42c38da5da4fJeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @attribute minorStep
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @type {Number}
691af6c84a00ad5f629ffcfa3b1e42c38da5da4fJeff Conniff * @default 1
7928e2ef0532df9064d9374ceda31d6ab080eb2dJeff Conniff */
691af6c84a00ad5f629ffcfa3b1e42c38da5da4fJeff Conniff minorStep : {
691af6c84a00ad5f629ffcfa3b1e42c38da5da4fJeff Conniff value:1
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
691af6c84a00ad5f629ffcfa3b1e42c38da5da4fJeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * amount to increment/decrement the dial value
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * when the page up/down keys are pressed
691af6c84a00ad5f629ffcfa3b1e42c38da5da4fJeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @attribute majorStep
691af6c84a00ad5f629ffcfa3b1e42c38da5da4fJeff Conniff * @type {Number}
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @default 10
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
691af6c84a00ad5f629ffcfa3b1e42c38da5da4fJeff Conniff majorStep : {
7928e2ef0532df9064d9374ceda31d6ab080eb2dJeff Conniff value:10
691af6c84a00ad5f629ffcfa3b1e42c38da5da4fJeff Conniff },
691af6c84a00ad5f629ffcfa3b1e42c38da5da4fJeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
691af6c84a00ad5f629ffcfa3b1e42c38da5da4fJeff Conniff * number of value increments in one 360 degree revolution
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * of the handle around the dial
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @attribute stepsPerRev
691af6c84a00ad5f629ffcfa3b1e42c38da5da4fJeff Conniff * @type {Number}
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @default 100
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff stepsPerRev : {
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff value:100
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff },
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff /**
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff * number of decimal places of accuracy in the value
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff *
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff * @attribute decimalPlaces
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff * @type {Number}
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff * @default 0
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff decimalPlaces : {
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff value:0
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff /**
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * visible strings for the dial UI. This attribute is
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * defined by the base Widget class but has an empty value. The
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * Dial is simply providing a default value for the attribute.
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * Gets localized strings in the current language
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff *
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff * @attribute strings
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff * @type {Object}
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff * @default {label: 'My label', resetStr: 'Reset', tooltipHandle: 'Drag to set value'}
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff strings: {
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff valueFn: function () {
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff return Y.Intl.get('dial');
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff }
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff },
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff /**
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff * distance from the center of the dial to the
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff * resting place of the center of the handle and marker.
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff * The value is a percent of the radius of the dial.
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @attribute handleDist
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @type {number}
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @default 0.75
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff */
7928e2ef0532df9064d9374ceda31d6ab080eb2dJeff Conniff handleDist:{
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff value:0.75
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff }
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff };
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff * returns a properly formed yui class name
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @function
44c68f247b9311ea767cb4656220793317e3383bJeff Conniff * @param {String} string to be appended at the end of class name
44c68f247b9311ea767cb4656220793317e3383bJeff Conniff * @return
44c68f247b9311ea767cb4656220793317e3383bJeff Conniff * @private
44c68f247b9311ea767cb4656220793317e3383bJeff Conniff */
44c68f247b9311ea767cb4656220793317e3383bJeff Conniff function makeClassName(str) {
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff return Y.ClassNameManager.getClassName(Dial.NAME, str);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff }
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * array of static constants used to identify the classname applied to the Dial DOM objects
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @property Dial.CSS_CLASSES
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @type {Array}
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @private
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @static
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff */
aa1805d3af3a9ac854fadba9707e18ee5f006804Jeff Conniff Dial.CSS_CLASSES = {
44c68f247b9311ea767cb4656220793317e3383bJeff Conniff label : makeClassName("label"),
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff labelString : makeClassName("label-string"),
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff valueString : makeClassName("value-string"),
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff northMark : makeClassName("north-mark"),
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff ring : makeClassName('ring'),
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff ringVml : makeClassName('ring-vml'),
44c68f247b9311ea767cb4656220793317e3383bJeff Conniff marker : makeClassName("marker"),
44c68f247b9311ea767cb4656220793317e3383bJeff Conniff markerUser : makeClassName("marker-user"),
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff centerButton : makeClassName("center-button"),
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff centerButtonVml : makeClassName('center-button-vml'),
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff resetString : makeClassName("reset-str"),
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff handle : makeClassName("handle"),
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff handleUser : makeClassName("handle-user"),
7928e2ef0532df9064d9374ceda31d6ab080eb2dJeff Conniff markerHidden : makeClassName("marker-hidden"),
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff dragging : Y.ClassNameManager.getClassName("dd-dragging")
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff };
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /* Static constants used to define the markup templates used to create Dial DOM elements */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff var labelId = Dial.CSS_CLASSES.label + Y.guid(); //get this unique id once then use
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff /**
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff * template that will contain the Dial's label.
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @property Dial.LABEL_TEMPLATE
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @type {String}
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @default &lt;div>...&lt;/div>
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff Dial.LABEL_TEMPLATE = '<div id="' + labelId + '" class="' + Dial.CSS_CLASSES.label + '"><span class="' + Dial.CSS_CLASSES.labelString + '">{label}</span><span class="' + Dial.CSS_CLASSES.valueString + '"></span></div>';
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff if(supportsVML === false){
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * template that will contain the Dial's background ring.
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
8318d5e58f691e33af95ced531746726ad592bb7Jeff Conniff * @property Dial.RING_TEMPLATE
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @type {String}
10d8bafc5c24f3a4285cf6060a1935ba5cfc4b85Luke Smith * @default &lt;div class="[...-ring]">&lt;div class="[...-northMark]">&lt;/div>&lt;/div>
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff Dial.RING_TEMPLATE = '<div class="' + Dial.CSS_CLASSES.ring + '"><div class="' + Dial.CSS_CLASSES.northMark + '"></div></div>';
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * template that will contain the Dial's current angle marker.
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @property Dial.MARKER_TEMPLATE
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @type {String}
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @default &lt;div class="[...-marker] [...-marker-hidden]">&lt;div class="[...-markerUser]">&lt;/div>&lt;/div>
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff Dial.MARKER_TEMPLATE = '<div class="' + Dial.CSS_CLASSES.marker + ' ' + Dial.CSS_CLASSES.markerHidden + '"><div class="' + Dial.CSS_CLASSES.markerUser + '"></div></div>';
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * template that will contain the Dial's center button.
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @property Dial.CENTER_BUTTON_TEMPLATE
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @type {String}
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @default &lt;div class="[...-centerButton]">&lt;div class="[...-resetString]">' + Y.substitute('{resetStr}', Dial.ATTRS.strings.value) + '&lt;/div>&lt;/div>
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff Dial.CENTER_BUTTON_TEMPLATE = '<div class="' + Dial.CSS_CLASSES.centerButton + '"><div class="' + Dial.CSS_CLASSES.resetString + '">{resetStr}</div></div>';
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff
f51c5d369e8c6bc97e7b9486fc706325ffe1f0adJeff Conniff /**
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff * template that will contain the Dial's handle.
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff *
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @property Dial.HANDLE_TEMPLATE
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @type {String}
10d8bafc5c24f3a4285cf6060a1935ba5cfc4b85Luke Smith * @default &lt;div class="[...-handle]">&lt;div class="[...-handleUser]" aria-labelledby="' + labelId + '" aria-valuetext="" aria-valuemax="" aria-valuemin="" aria-valuenow="" role="slider" tabindex="0">&lt;/div>&lt;/div>';// title="{tooltipHandle}"
aa1805d3af3a9ac854fadba9707e18ee5f006804Jeff Conniff * @protected
f51c5d369e8c6bc97e7b9486fc706325ffe1f0adJeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff Dial.HANDLE_TEMPLATE = '<div class="' + Dial.CSS_CLASSES.handle + '"><div class="' + Dial.CSS_CLASSES.handleUser + '" aria-labelledby="' + labelId + '" aria-valuetext="" aria-valuemax="" aria-valuemin="" aria-valuenow="" role="slider" tabindex="0" title="{tooltipHandle}"></div></div>';// title="{tooltipHandle}"
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff }else{ // VML case
f51c5d369e8c6bc97e7b9486fc706325ffe1f0adJeff Conniff Dial.RING_TEMPLATE = '<div class="' + Dial.CSS_CLASSES.ring + ' ' + Dial.CSS_CLASSES.ringVml + '">'+
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff '<div class="' + Dial.CSS_CLASSES.northMark + '"></div>'+
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff '<v:oval strokecolor="#ceccc0" strokeweight="1px"><v:fill type=gradient color="#8B8A7F" color2="#EDEDEB" angle="45"/></v:oval>'+
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff //'<v:oval></v:oval>'+
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff '</div>'+
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff '';
10d8bafc5c24f3a4285cf6060a1935ba5cfc4b85Luke Smith Dial.MARKER_TEMPLATE = '<div class="' + Dial.CSS_CLASSES.marker + ' ' + Dial.CSS_CLASSES.markerHidden + '">'+
aa1805d3af3a9ac854fadba9707e18ee5f006804Jeff Conniff '<xml:namespace ns="urn:schemas-microsoft-com:vml" prefix="v"/><v:oval stroked="false" class="' + Dial.CSS_CLASSES.markerUser + '">'+
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff '<v:fill opacity="20%" color="#000"/>'+
f47f024e093853ad3957be898687fc8317a835daJeff Conniff '</v:oval>'+
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff //'<v:oval></v:oval>'+
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff '</div>'+
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff '';
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff Dial.CENTER_BUTTON_TEMPLATE = '<div class="' + Dial.CSS_CLASSES.centerButton + ' ' + Dial.CSS_CLASSES.centerButtonVml + '">'+
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff '<v:oval strokecolor="#ceccc0" strokeweight="1px">'+
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff '<v:fill type=gradient color="#C7C5B9" color2="#fefcf6" colors="35% #d9d7cb, 65% #fefcf6" angle="45"/>'+
10d8bafc5c24f3a4285cf6060a1935ba5cfc4b85Luke Smith '<v:shadow on="True" color="#000" opacity="10%" offset="2px, 2px"/>'+
aa1805d3af3a9ac854fadba9707e18ee5f006804Jeff Conniff '</v:oval>'+
3e16868ea3bfcadfeeb8e23aca5bb2317a6a8ba9Jeff Conniff //'<v:oval></v:oval>'+
f47f024e093853ad3957be898687fc8317a835daJeff Conniff '<div class="' + Dial.CSS_CLASSES.resetString + '">{resetStr}</div>'+
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff '</div>'+
691af6c84a00ad5f629ffcfa3b1e42c38da5da4fJeff Conniff '';
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff Dial.HANDLE_TEMPLATE = '<div class="' + Dial.CSS_CLASSES.handle + '">'+
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff '<v:oval stroked="false" class="' + Dial.CSS_CLASSES.handleUser + '"'+
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff ' aria-labelledby="' + labelId + '" aria-valuetext="" aria-valuemax="" aria-valuemin="" aria-valuenow="" role="slider" tabindex="0" title="{tooltipHandle}">'+ //title="{tooltipHandle}"
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff '<v:fill opacity="20%" color="#6C3A3A"/>'+
10d8bafc5c24f3a4285cf6060a1935ba5cfc4b85Luke Smith '</v:oval>'+
aa1805d3af3a9ac854fadba9707e18ee5f006804Jeff Conniff //'<v:oval></v:oval>'+
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff '</div>'+
f47f024e093853ad3957be898687fc8317a835daJeff Conniff '';
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff }
691af6c84a00ad5f629ffcfa3b1e42c38da5da4fJeff Conniff
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff /* Dial extends the base Widget class */
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff Y.extend(Dial, Widget, {
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff /**
10d8bafc5c24f3a4285cf6060a1935ba5cfc4b85Luke Smith * creates the DOM structure for the Dial.
aa1805d3af3a9ac854fadba9707e18ee5f006804Jeff Conniff *
f51c5d369e8c6bc97e7b9486fc706325ffe1f0adJeff Conniff * @method renderUI
f47f024e093853ad3957be898687fc8317a835daJeff Conniff * @protected
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff */
f51c5d369e8c6bc97e7b9486fc706325ffe1f0adJeff Conniff renderUI : function() {
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff this._renderLabel();
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff this._renderRing();
2aa0883432cf56a974eb9261afcf6ede4313384cJeff Conniff this._renderMarker();
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff this._renderCenterButton();
2aa0883432cf56a974eb9261afcf6ede4313384cJeff Conniff this._renderHandle();
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff /*
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff if(supportsVML){
691af6c84a00ad5f629ffcfa3b1e42c38da5da4fJeff Conniff this._setVMLSizes();
04f7ef259d54aeab53258697e1e7f8856adcc8a6Jeff Conniff }
624b3d25f12c6e63f607b2690315293ad7ef6481Jeff Conniff */
624b3d25f12c6e63f607b2690315293ad7ef6481Jeff Conniff // object handles
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff this.contentBox = this.get("contentBox");
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff
2aa0883432cf56a974eb9261afcf6ede4313384cJeff Conniff // constants
2aa0883432cf56a974eb9261afcf6ede4313384cJeff Conniff this._centerX = this.get('diameter') / 2;
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff this._centerY = this.get('diameter') / 2;
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff this._handleDist = this._centerX * this.get('handleDist');
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff this._originalValue = this.get('value');
691af6c84a00ad5f629ffcfa3b1e42c38da5da4fJeff Conniff
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff // variables
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff this._timesWrapped = 0;
f51c5d369e8c6bc97e7b9486fc706325ffe1f0adJeff Conniff this._angle = this._getAngleFromValue(this.get('value'));
624b3d25f12c6e63f607b2690315293ad7ef6481Jeff Conniff this._setTimesWrapedFromValue(this.get('value'));
624b3d25f12c6e63f607b2690315293ad7ef6481Jeff Conniff
624b3d25f12c6e63f607b2690315293ad7ef6481Jeff Conniff // init
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff this._handleUserNode.set('aria-valuemin', this.get('min'));
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff this._handleUserNode.set('aria-valuemax', this.get('max'));
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff },
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff /**
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff * Creates the Y.DD.Drag instance used for the handle movement and
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff * binds Dial interaction to the configured value model.
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method bindUI
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff bindUI : function() {
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this.after("valueChange", this._afterValueChange);
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff var boundingBox = this.get("boundingBox"),
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff // Looking for a key event which will fire continously across browsers while the key is held down.
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff keyEventSpec = (!Y.UA.opera) ? "down:" : "press:",
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff keyLeftRightSpec = (!Y.UA.opera) ? "down:" : "press:";
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff // 38, 40 = arrow up/down, 33, 34 = page up/down, 35 , 36 = end/home
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff keyEventSpec += "38, 40, 33, 34, 35, 36";
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff // 37 , 39 = arrow left/right
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff keyLeftRightSpec += "37, 39";
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff Y.on("key", Y.bind(this._onDirectionKey, this), boundingBox, keyEventSpec);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff Y.on("key", Y.bind(this._onLeftRightKey, this), boundingBox, keyLeftRightSpec);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff Y.on('mouseenter', Y.bind(this._dialCenterOver, this), this._centerButtonNode);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff Y.on('mouseleave', Y.bind(this._dialCenterOut, this), this._centerButtonNode);
62280f8683de7078a1eb123153c33822cd3bca37Jeff Conniff Y.on('click', Y.bind(this._resetDial, this), this._centerButtonNode);
62280f8683de7078a1eb123153c33822cd3bca37Jeff Conniff Y.on('mousedown', Y.bind(function(){this._handleUserNode.focus();}, this), this._handleNode);
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff var dd1 = new Y.DD.Drag({
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff node: this._handleNode,
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff on : {
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff 'drag:drag' : Y.bind(this._handleDrag, this),
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff 'drag:start' : Y.bind(this._handleDragStart, this),
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff 'drag:end' : Y.bind(this._handleDragEnd, this)
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff }
85df7d850ed1089f89d862be872ed9947367aea2Jeff Conniff });
85df7d850ed1089f89d862be872ed9947367aea2Jeff Conniff },
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff
e81cc12bafc201061ba76fdfd173f1412371e0ecJeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * Sets _timesWrapped based on Dial value
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * to net integer revolutions the user dragged the handle around the Dial
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method _setTimesWrapedFromValue
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @param val {Number} current value of the Dial
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @private
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff _setTimesWrapedFromValue : function(val){
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff if(val % this.get('stepsPerRev') === 0){
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._timesWrapped = (val / this.get('stepsPerRev')) -1;
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff }else{
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._timesWrapped = Math.floor(val / this.get('stepsPerRev'));
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff }
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * Sets the string in the object the user clicks to reset the Dial value
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method _dialCenterOver
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @param e {DOMEvent} the mouseover event object
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff _dialCenterOver : function(e){
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._resetString.setContent(Y.substitute('{resetStr}', this.get('strings')));
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff * Sets the string in the object the user clicks to reset the Dial value
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff * to ""
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff *
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff * @method _dialCenterOut
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff * @param e {DOMEvent} the mouseover event object
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff */
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff _dialCenterOut : function(e){
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff this._resetString.setContent('');
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff },
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff /**
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff * handles the user dragging the handle around the Dial, calculates the angle,
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff * checks for wrapping around top center, handles exceeding min or max values
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff *
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff * @method _handleDrag
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff * @param e {DOMEvent} the drag event object
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff * @protected
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff */
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff _handleDrag : function(e){
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff var ang = Math.atan( (this._centerYOnPage - e.pageY) / (this._centerXOnPage - e.pageX) ) * (180 / Math.PI),
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff deltaX = (this._centerXOnPage - e.pageX);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff if(deltaX < 0){
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff ang = (ang + 90);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff }else{
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff ang = (ang - 90);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff }
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff // check for need to set timesWrapped
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff if(e.pageY < this._centerYOnPage){ //if handle is above the middle of the dial...
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff if((this._prevX <= this._centerXOnPage) && (e.pageX > this._centerXOnPage)){ // If wrapping, clockwise
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff this._timesWrapped = (this._timesWrapped + 1);
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff }else if((this._prevX > this._centerXOnPage) && (e.pageX <= this._centerXOnPage)){ // if un-wrapping, counter-clockwise
2a43a857fc701d8ce0505c3f133e051f2d3c60d8Jeff Conniff this._timesWrapped = (this._timesWrapped - 1);
2a43a857fc701d8ce0505c3f133e051f2d3c60d8Jeff Conniff }
2a43a857fc701d8ce0505c3f133e051f2d3c60d8Jeff Conniff }
2a43a857fc701d8ce0505c3f133e051f2d3c60d8Jeff Conniff this._prevX = e.pageX;
2a43a857fc701d8ce0505c3f133e051f2d3c60d8Jeff Conniff var newValue = this._getValueFromAngle(ang); // This function needs the current _timesWrapped value
2a43a857fc701d8ce0505c3f133e051f2d3c60d8Jeff Conniff // handle hitting max and min and going beyond, stops at max or min
2a43a857fc701d8ce0505c3f133e051f2d3c60d8Jeff Conniff //if((newValue > this.get('min')) && (newValue < this.get('max'))) {
2a43a857fc701d8ce0505c3f133e051f2d3c60d8Jeff Conniff if((newValue > this.get('min')) && (newValue < this.get('max'))) {
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff this.set('value', newValue);
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff }else if(newValue > this.get('max')){
2353184083624510261e335c156a05e8cae2fc41Jeff Conniff this.set('value', this.get('max'));
2a43a857fc701d8ce0505c3f133e051f2d3c60d8Jeff Conniff }else if(newValue < this.get('min')){
2a43a857fc701d8ce0505c3f133e051f2d3c60d8Jeff Conniff this.set('value', this.get('min'));
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff }
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff * handles the user starting to drag the handle around the Dial
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff *
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff * @method _handleDragStart
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @param e {DOMEvent} the drag event object
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff _handleDragStart : function(e){
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._markerNode.removeClass(Dial.CSS_CLASSES.markerHidden);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff if(!this._prevX){
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._prevX = this._handleNode.getX();
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff }
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._centerYOnPage = (this._ringNode.getY() + this._centerY);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._centerXOnPage = (this._ringNode.getX() + this._centerX);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /*
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * When handle is handleDragEnd, this animates the return to the fixed dial
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * handles the end of a user dragging the handle, animates the handle returning to
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * resting position.
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method _handleDragEnd
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff _handleDragEnd : function(){
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff var node = this._handleNode;
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff node.transition({
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff duration: 0.08, // seconds
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff easing: 'ease-in',
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff left: this._setNodeToFixedRadius()[0] + 'px',
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff top: this._setNodeToFixedRadius()[1] + 'px'
3909982acea3ffce1cb7435b87bee218e423c1ddJeff Conniff }, Y.bind(function(){
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._markerNode.addClass(Dial.CSS_CLASSES.markerHidden);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._prevX = this._handleNode.getX(); //makes us ready for next drag.
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff }, this)
3909982acea3ffce1cb7435b87bee218e423c1ddJeff Conniff );
3909982acea3ffce1cb7435b87bee218e423c1ddJeff Conniff this._setTimesWrapedFromValue(this.get('value'));
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * returns the XY of the fixed position, handleDist, from the center of the Dial (resting position)
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff * The XY also represents the angle related to the current value
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff * If no param is passed, [X,Y] is returned.
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * If param is passed, the XY of the node passed is set.
3909982acea3ffce1cb7435b87bee218e423c1ddJeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method _setNodeToFixedRadius
b5f4e5800a70a87e769d27222144299256fdb5c5Jeff Conniff * @param obj {Node}
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff * @protected
b5f4e5800a70a87e769d27222144299256fdb5c5Jeff Conniff * @return {Array} an array of [XY] is optionally returned
b5f4e5800a70a87e769d27222144299256fdb5c5Jeff Conniff */
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff _setNodeToFixedRadius : function(obj){
b5f4e5800a70a87e769d27222144299256fdb5c5Jeff Conniff var thisAngle = (this._angle - 90),
b5f4e5800a70a87e769d27222144299256fdb5c5Jeff Conniff rad = (Math.PI / 180);
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff var newY = Math.round(Math.sin(thisAngle * rad) * this._handleDist);
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff var newX = Math.round(Math.cos(thisAngle * rad) * this._handleDist);
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff if(obj){
b5f4e5800a70a87e769d27222144299256fdb5c5Jeff Conniff obj.setXY([(this._ringNode.getX() + this._centerX + newX), (this._ringNode.getY() + this._centerY + newY)]);
b5f4e5800a70a87e769d27222144299256fdb5c5Jeff Conniff }else{ // just need the style for css transform left and top to animate the handle drag:end
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff return [this._centerX + newX, this._centerX + newY];
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff }
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff },
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff /**
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff * Synchronizes the DOM state with the attribute settings.
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff *
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff * @method syncUI
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff */
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff syncUI : function() {
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff this._uiSetValue(this.get("value"));
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff },
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff /**
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff *
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff *
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff *
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff */
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff /*
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff // Trying to fix the bug: "- ie8 ignores percent style sizes/offsets"
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff // After applying other fixes, it seems to not be a problem
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff // Needs more testing
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff // See where it's called above in renderUI
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff _setVMLSizes : function(){
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff var dia = this.get('diameter');
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff var setSize = function(node, dia, percent){
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff var suffix = 'px';
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff //alert(node.getElementsByTagName('fill').getStyle('width') + 'hello');
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff node.getElementsByTagName('fill').setStyle('width', (dia * percent) + suffix);
43505e8a0a678fc9e08ebf98acad98ca67eff976Jeff Conniff node.getElementsByTagName('fill').setStyle('height', (dia * percent) + suffix);
3909982acea3ffce1cb7435b87bee218e423c1ddJeff Conniff //alert(node.getElementsByTagName('fill').getStyle('width') + ' after');
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff };
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff setSize(this._ringNode, dia, 1.0);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff setSize(this._handleUserNode, dia, 0.2);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff setSize(this._markerUserNode, dia, 0.1);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff setSize(this._centerButtonNode, dia, 0.5);
f47f024e093853ad3957be898687fc8317a835daJeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff * renders the DOM object for the Dial's label
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method _renderLabel
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff _renderLabel : function() {
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff var contentBox = this.get("contentBox"),
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff label = contentBox.one("." + Dial.CSS_CLASSES.label);
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff if (!label) {
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff label = Node.create(Y.substitute(Dial.LABEL_TEMPLATE, this.get('strings')));
3909982acea3ffce1cb7435b87bee218e423c1ddJeff Conniff contentBox.append(label);
7e21402185b2bb1c42859a8dca7863be3759647dJeff Conniff }
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._labelNode = label;
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._valueStringNode = this._labelNode.one("." + Dial.CSS_CLASSES.valueString);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * renders the DOM object for the Dial's background ring
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method _renderRing
62280f8683de7078a1eb123153c33822cd3bca37Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff _renderRing : function() {
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff var contentBox = this.get("contentBox"),
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff ring = contentBox.one("." + Dial.CSS_CLASSES.ring);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff if (!ring) {
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff ring = contentBox.appendChild(Dial.RING_TEMPLATE);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff ring.setStyles({width:this.get('diameter') + 'px', height:this.get('diameter') + 'px'});
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff }
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._ringNode = ring;
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
62280f8683de7078a1eb123153c33822cd3bca37Jeff Conniff
62280f8683de7078a1eb123153c33822cd3bca37Jeff Conniff /**
62280f8683de7078a1eb123153c33822cd3bca37Jeff Conniff * renders the DOM object for the Dial's background marker which
62280f8683de7078a1eb123153c33822cd3bca37Jeff Conniff * tracks the angle of the user dragging the handle
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method _renderMarker
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff _renderMarker : function() {
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff var contentBox = this.get("contentBox"),
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff marker = contentBox.one("." + Dial.CSS_CLASSES.marker);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff if (!marker) {
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff marker = contentBox.one('.' + Dial.CSS_CLASSES.ring).appendChild(Dial.MARKER_TEMPLATE);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff }
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._markerNode = marker;
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._markerUserNode = this._markerNode.one('.' + Dial.CSS_CLASSES.markerUser);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff * places the centerbutton's reset string in the center of the button
3909982acea3ffce1cb7435b87bee218e423c1ddJeff Conniff * based on the size of the string object
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff *
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff * @method _setXYResetString
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff * @protected
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff */
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff _setXYResetString : function(){
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff this._resetString.setStyle('top', (this._centerButtonNode.get('region').height / 2) - (this._resetString.get('region').height / 2) + 'px');
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff this._resetString.setStyle('left', (this._centerButtonNode.get('region').width / 2) - (this._resetString.get('region').width / 2) + 'px');
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff },
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff /**
3909982acea3ffce1cb7435b87bee218e423c1ddJeff Conniff * renders the DOM object for the Dial's center
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method _renderCenterButton
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff _renderCenterButton : function() {
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff var contentBox = this.get("contentBox"),
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff centerButton = contentBox.one("." + Dial.CSS_CLASSES.centerButton);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff if (!centerButton) {
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff centerButton = Node.create(Y.substitute(Dial.CENTER_BUTTON_TEMPLATE, this.get('strings')));
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff contentBox.one('.' + Dial.CSS_CLASSES.ring).append(centerButton);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff }
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._centerButtonNode = centerButton;
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._resetString = this._centerButtonNode.one('.' + Dial.CSS_CLASSES.resetString);
dfce478dfa2a75c4dfcacb60b7321f9ef37c8477Jeff Conniff this._setXYResetString(); // centering the reset string in the button
dfce478dfa2a75c4dfcacb60b7321f9ef37c8477Jeff Conniff this._resetString.setContent('');
dfce478dfa2a75c4dfcacb60b7321f9ef37c8477Jeff Conniff //var offset = (this._ringNode.get('region').width - this._centerButtonNode.get('region').width) / 2;
dfce478dfa2a75c4dfcacb60b7321f9ef37c8477Jeff Conniff var offset = this._ringNode.get('region').width * 0.25; //better in IE
dfce478dfa2a75c4dfcacb60b7321f9ef37c8477Jeff Conniff this._centerButtonNode.setXY([(this._ringNode.getX() + offset), (this._ringNode.getY() + offset)]);
dfce478dfa2a75c4dfcacb60b7321f9ef37c8477Jeff Conniff },
dfce478dfa2a75c4dfcacb60b7321f9ef37c8477Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * renders the DOM object for the Dial's user draggable handle
dfce478dfa2a75c4dfcacb60b7321f9ef37c8477Jeff Conniff *
dfce478dfa2a75c4dfcacb60b7321f9ef37c8477Jeff Conniff * @method _renderHandle
dfce478dfa2a75c4dfcacb60b7321f9ef37c8477Jeff Conniff * @protected
dfce478dfa2a75c4dfcacb60b7321f9ef37c8477Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff _renderHandle : function() {
dfce478dfa2a75c4dfcacb60b7321f9ef37c8477Jeff Conniff var contentBox = this.get("contentBox"),
dfce478dfa2a75c4dfcacb60b7321f9ef37c8477Jeff Conniff handle = contentBox.one("." + Dial.CSS_CLASSES.handle);
dfce478dfa2a75c4dfcacb60b7321f9ef37c8477Jeff Conniff if (!handle) {
dfce478dfa2a75c4dfcacb60b7321f9ef37c8477Jeff Conniff handle = Node.create(Y.substitute(Dial.HANDLE_TEMPLATE, this.get('strings')));
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff contentBox.one('.' + Dial.CSS_CLASSES.ring).append(handle);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff }
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._handleNode = handle;
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._handleUserNode = this._handleNode.one('.' + Dial.CSS_CLASSES.handleUser);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * sets the visible UI label string
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method setLabelString
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @param str {String}
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff setLabelString : function(str) {
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this.get("contentBox").one("." + Dial.CSS_CLASSES.labelString).setContent(str);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * sets the visible UI label string
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method setResetString
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @param str {String}
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
dfce478dfa2a75c4dfcacb60b7321f9ef37c8477Jeff Conniff setResetString : function(str) {
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this.set('strings.resetStr', str);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this.get("contentBox").one("." + Dial.CSS_CLASSES.resetString).setContent(str);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._setXYResetString(); // recenters the string in the button
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._resetString.setContent('');
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * sets the tooltip string in the Dial's handle
dfce478dfa2a75c4dfcacb60b7321f9ef37c8477Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method setTooltipString
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @param str {String}
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff setTooltipString : function(str) {
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this.get("contentBox").one("." + Dial.CSS_CLASSES.handleUser).set('title', str);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * sets the Dial's value in response to key events.
dfce478dfa2a75c4dfcacb60b7321f9ef37c8477Jeff Conniff * Left and right keys are in a separate method
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * in case an implementation wants to increment values
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * but needs left and right arrow keys for other purposes.
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method _onDirectionKey
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @param e {Event} the key event
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff _onDirectionKey : function(e) {
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff e.preventDefault();
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff switch (e.charCode) {
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff case 38: // up
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._incrMinor();
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff break;
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff case 40: // down
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._decrMinor();
dfce478dfa2a75c4dfcacb60b7321f9ef37c8477Jeff Conniff break;
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff case 36: // home
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._resetDial();
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff break;
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff case 35: // end
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._setToMax();
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff break;
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff case 33: // page up
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._incrMajor();
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff break;
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff case 34: // page down
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._decrMajor();
189003a5b9ed3b1168f3331a2d4213bb08bf0d86Jeff Conniff break;
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff }
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
3909982acea3ffce1cb7435b87bee218e423c1ddJeff Conniff * sets the Dial's value in response to left or right key events
3909982acea3ffce1cb7435b87bee218e423c1ddJeff Conniff *
3909982acea3ffce1cb7435b87bee218e423c1ddJeff Conniff * @method _onLeftRightKey
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @param e {Event} the key event
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff _onLeftRightKey : function(e) {
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff e.preventDefault();
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff switch (e.charCode) {
3909982acea3ffce1cb7435b87bee218e423c1ddJeff Conniff case 37: // left
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._decrMinor();
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff break;
62280f8683de7078a1eb123153c33822cd3bca37Jeff Conniff case 39: // right
3909982acea3ffce1cb7435b87bee218e423c1ddJeff Conniff this._incrMinor();
3909982acea3ffce1cb7435b87bee218e423c1ddJeff Conniff break;
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff }
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
3909982acea3ffce1cb7435b87bee218e423c1ddJeff Conniff /**
3909982acea3ffce1cb7435b87bee218e423c1ddJeff Conniff * increments Dial value by a minor increment
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff * @method _incrMinor
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff _incrMinor : function(){
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff var newVal = (this.get('value') + this.get("minorStep"));
f47f024e093853ad3957be898687fc8317a835daJeff Conniff newVal = Math.min(newVal, this.get("max"));
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this.set('value', newVal.toFixed(this.get('decimalPlaces')) - 0);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * decrements Dial value by a minor increment
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method _decrMinor
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff _decrMinor : function(){
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff var newVal = (this.get('value') - this.get("minorStep"));
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff newVal = Math.max(newVal, this.get("min"));
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this.set('value', newVal.toFixed(this.get('decimalPlaces')) - 0);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * increments Dial value by a major increment
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method _incrMajor
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff _incrMajor : function(){
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff var newVal = (this.get('value') + this.get("majorStep"));
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff newVal = Math.min(newVal, this.get("max"));
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this.set('value', newVal.toFixed(this.get('decimalPlaces')) - 0);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * decrements Dial value by a major increment
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method _decrMajor
62280f8683de7078a1eb123153c33822cd3bca37Jeff Conniff * @protected
62280f8683de7078a1eb123153c33822cd3bca37Jeff Conniff */
62280f8683de7078a1eb123153c33822cd3bca37Jeff Conniff _decrMajor : function(){
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff var newVal = (this.get('value') - this.get("majorStep"));
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff newVal = Math.max(newVal, this.get("min"));
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this.set('value', newVal.toFixed(this.get('decimalPlaces')) - 0);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * sets Dial value to dial's max attr
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method _decrMajor
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff _setToMax : function(){
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this.set('value', this.get("max"));
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * sets Dial value to dial's min attr
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method _decrMajor
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff _setToMin : function(){
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this.set('value', this.get("min"));
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * resets Dial value to the orignal initial value.
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method _resetDial
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff _resetDial : function(){
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this.set('value', this._originalValue);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._handleUserNode.focus();
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * returns the handle angle associated with the current value of the Dial
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method _getAngleFromValue
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @param newVal {Number} the current value of the Dial
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @return {Number} the angle associated with the current Dial value
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
7ef04b5748675b524f9891e401b90ba8a0162b07Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff _getAngleFromValue : function(newVal){
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff var nonWrapedPartOfValue = newVal % this.get('stepsPerRev');
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff var angleFromValue = nonWrapedPartOfValue / this.get('stepsPerRev') * 360;
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff return angleFromValue;
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * returns the value of the Dial calculated from the current handle angle
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method _getValueFromAngle
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @param angle {Number} the current angle of the Dial's handle
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @return {Number} the current Dial value corresponding to the handle position
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff _getValueFromAngle : function(angle){
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff if(angle < 0){
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff angle = (360 + angle);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff }else if(angle === 0){
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff angle = 360;
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff }
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff var value = (angle / 360) * this.get('stepsPerRev');
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff value = (value + (this._timesWrapped * this.get('stepsPerRev')));
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff //return Math.round(value * 100) / 100;
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff return value.toFixed(this.get('decimalPlaces')) - 0;
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * calls the method to update the UI whenever the Dial value changes
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method _afterValueChange
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @param e {Event}
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff _afterValueChange : function(e) {
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._uiSetValue(e.newVal);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * Updates the UI display value of the Dial to reflect
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * the value passed in.
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * Makes all other needed UI display changes
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff *
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @method _uiSetValue
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @param val {Number} value of the Dial
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * @protected
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff _uiSetValue : function(val) {
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._angle = this._getAngleFromValue(val);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff if(this._handleNode.hasClass(Dial.CSS_CLASSES.dragging) === false){
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._setTimesWrapedFromValue(val);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._setNodeToFixedRadius(this._handleNode);
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff this._prevX = this._handleNode.getX();
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff }
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._valueStringNode.setContent(val);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._handleUserNode.set('aria-valuenow', val);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._handleUserNode.set('aria-valuetext', val);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._setNodeToFixedRadius(this._markerNode);
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff if((val === this.get('max')) || (val === this.get('min'))){
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff if(this._markerUserNode.hasClass('marker-max-min') === false){
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff this._markerUserNode.addClass('marker-max-min');
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff if(supportsVML === true){
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff this._markerUserNode.getElementsByTagName('fill').set('color', '#AB3232');
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff }
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff }
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff }else{
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff if(supportsVML === true){
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff this._markerUserNode.getElementsByTagName('fill').set('color', '#000');
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff }
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff if(this._markerUserNode.hasClass('marker-max-min') === true){
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff this._markerUserNode.removeClass('marker-max-min');
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff }
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff }
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff },
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff /**
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * value attribute default validator. Verifies that
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff * the value being set lies between the min/max value
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff *
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff * @method _validateValue
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff * @param val {Number} value of the Dial
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff * @protected
2aa0883432cf56a974eb9261afcf6ede4313384cJeff Conniff */
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff _validateValue: function(val) {
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff var min = this.get("min"),
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff max = this.get("max");
df71f95acec70ebddf0ab97cc1e0ff2b70048017Jeff Conniff return (Lang.isNumber(val) && val >= min && val <= max);
736745cee753d967cf5fb1063c21578ecca61b4aJeff Conniff }
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff });
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff Y.Dial = Dial;
91f1deca7427bc48d15c263856f567a6bab97394Jeff Conniff