dist/knob.js
function processPointerPosition(e) {
    var xOffset = e.clientX,
        yOffset = e.clientY;

    var radius = this.rect.width / 2;
    this.lastValue = this.value;

    if (!this.usesRotation) {
      if (this.lastPosition !== -1) {
        //this.__value -= ( yOffset - this.lastPosition ) / (radius * 2);
        this.__value = 1 - yOffset / this.rect.height;
      }
    } else {
      var xdiff = radius - xOffset;
      var ydiff = radius - yOffset;
      var angle = Math.PI + Math.atan2(ydiff, xdiff);
      this.__value = (angle + Math.PI * 1.5) % (Math.PI * 2) / (Math.PI * 2);

      if (this.lastRotationValue > .8 && this.__value < .2) {
        this.__value = 1;
      } else if (this.lastRotationValue < .2 && this.__value > .8) {
        this.__value = 0;
      }
    }

    if (this.__value > 1) this.__value = 1;
    if (this.__value < 0) this.__value = 0;

    this.lastRotationValue = this.__value;
    this.lastPosition = yOffset;

    var shouldDraw = this.output();

    if (shouldDraw) this.draw();
  }
function processPointerPosition(e) {
    var xOffset = e.clientX,
        yOffset = e.clientY;

    var radius = this.rect.width / 2;
    this.lastValue = this.value;

    if (!this.usesRotation) {
      if (this.lastPosition !== -1) {
        //this.__value -= ( yOffset - this.lastPosition ) / (radius * 2);
        this.__value = 1 - yOffset / this.rect.height;
      }
    } else {
      var xdiff = radius - xOffset;
      var ydiff = radius - yOffset;
      var angle = Math.PI + Math.atan2(ydiff, xdiff);
      this.__value = (angle + Math.PI * 1.5) % (Math.PI * 2) / (Math.PI * 2);

      if (this.lastRotationValue > .8 && this.__value < .2) {
        this.__value = 1;
      } else if (this.lastRotationValue < .2 && this.__value > .8) {
        this.__value = 0;
      }
    }

    if (this.__value > 1) this.__value = 1;
    if (this.__value < 0) this.__value = 0;

    this.lastRotationValue = this.__value;
    this.lastPosition = yOffset;

    var shouldDraw = this.output();

    if (shouldDraw) this.draw();
  }
function processPointerPosition ( e ) { var xOffset = e . clientX , yOffset = e . clientY ; var radius = this . rect . width / 2 ; this . lastValue = this . value ; if ( ! this . usesRotation ) { if ( this . lastPosition !== - 1 ) { //this.__value -= ( yOffset - this.lastPosition ) / (radius * 2); this . __value = 1 - yOffset / this . rect . height ; } } else { var xdiff = radius - xOffset ; var ydiff = radius - yOffset ; var angle = Math . PI + Math . atan2 ( ydiff , xdiff ) ; this . __value = ( angle + Math . PI * 1.5 ) % ( Math . PI * 2 ) / ( Math . PI * 2 ) ; if ( this . lastRotationValue > .8 && this . __value < .2 ) { this . __value = 1 ; } else if ( this . lastRotationValue < .2 && this . __value > .8 ) { this . __value = 0 ; } } if ( this . __value > 1 ) this . __value = 1 ; if ( this . __value < 0 ) this . __value = 0 ; this . lastRotationValue = this . __value ; this . lastPosition = yOffset ; var shouldDraw = this . output ( ) ; if ( shouldDraw ) this . draw ( ) ; }
Generates a value between 0-1 given the current pointer position in relation
to the Knob's position, and triggers output.
@instance
@memberof Knob
@param {PointerEvent} e - The pointer event to be processed.
Generates a value between 0 - 1 given the current pointer position in relation to the Knob s position and triggers output .