flight-viz/d3.slider.js
// Move slider handle on click/drag
Move slider handle on click/drag
Move slider handle on click / drag
function moveHandle(pos) {
        var newValue = stepValue(scale.invert(pos / sliderLength));
        weekSelected = Math.round(newValue / 1.923);
        if (value !== newValue) {
          var oldPos = formatPercent(scale(stepValue(value))),
              newPos = formatPercent(scale(stepValue(newValue))),
              position = (orientation === "horizontal") ? "left" : "bottom";
          dispatch.slide(d3.event.sourceEvent || d3.event, value = newValue, weekSelected);
          if (animate) {
            handle.transition()
                .styleTween(position, function() { return d3.interpolate(oldPos, newPos); })
                .duration((typeof animate === "number") ? animate : 250);
          } else {
            handle.style(position, newPos);          
          }
        }
      }
function moveHandle ( pos ) { var newValue = stepValue ( scale . invert ( pos / sliderLength ) ) ; weekSelected = Math . round ( newValue / 1.923 ) ; if ( value !== newValue ) { var oldPos = formatPercent ( scale ( stepValue ( value ) ) ) , newPos = formatPercent ( scale ( stepValue ( newValue ) ) ) , position = ( orientation === "horizontal" ) ? "left" : "bottom" ; dispatch . slide ( d3 . event . sourceEvent || d3 . event , value = newValue , weekSelected ) ; if ( animate ) { handle . transition ( ) . styleTween ( position , function ( ) { return d3 . interpolate ( oldPos , newPos ) ; } ) . duration ( ( typeof animate === "number" ) ? animate : 250 ) ; } else { handle . style ( position , newPos ) ; } } }
Move slider handle on click/drag
Move slider handle on click / drag