function(event, g, context) {
    // Right-click should not initiate a zoom.
    if (event.button && event.button == 2) return;

    context.initializeMouseDown(event, g, context);

    if (event.altKey || event.shiftKey) {
      DygraphInteraction.startPan(event, g, context);
    } else {
      DygraphInteraction.startZoom(event, g, context);
    }

    // Note: we register mousemove/mouseup on document to allow some leeway for
    // events to move outside of the chart. Interaction model events get
    // registered on the canvas, which is too small to allow this.
    var mousemove = function(event) {
      if (context.isZooming) {
        // When the mouse moves >200px from the chart edge, cancel the zoom.
        var d = distanceFromChart(event, g);
        if (d < DRAG_EDGE_MARGIN) {
          DygraphInteraction.moveZoom(event, g, context);
        } else {
          if (context.dragEndX !== null) {
            context.dragEndX = null;
            context.dragEndY = null;
            g.clearZoomRect_();
          }
        }
      } else if (context.isPanning) {
        DygraphInteraction.movePan(event, g, context);
      }
    };
    var mouseup = function(event) {
      if (context.isZooming) {
        if (context.dragEndX !== null) {
          DygraphInteraction.endZoom(event, g, context);
        } else {
          DygraphInteraction.maybeTreatMouseOpAsClick(event, g, context);
        }
      } else if (context.isPanning) {
        DygraphInteraction.endPan(event, g, context);
      }

      utils.removeEvent(document, 'mousemove', mousemove);
      utils.removeEvent(document, 'mouseup', mouseup);
      context.destroy();
    };

    g.addAndTrackEvent(document, 'mousemove', mousemove);
    g.addAndTrackEvent(document, 'mouseup', mouseup);
  }
function(event, g, context) {
    
    if (event.button && event.button == 2) return;

    context.initializeMouseDown(event, g, context);

    if (event.altKey || event.shiftKey) {
      DygraphInteraction.startPan(event, g, context);
    } else {
      DygraphInteraction.startZoom(event, g, context);
    }

    
    
    
    var mousemove = function(event) {
      if (context.isZooming) {
        
        var d = distanceFromChart(event, g);
        if (d < DRAG_EDGE_MARGIN) {
          DygraphInteraction.moveZoom(event, g, context);
        } else {
          if (context.dragEndX !== null) {
            context.dragEndX = null;
            context.dragEndY = null;
            g.clearZoomRect_();
          }
        }
      } else if (context.isPanning) {
        DygraphInteraction.movePan(event, g, context);
      }
    };
    var mouseup = function(event) {
      if (context.isZooming) {
        if (context.dragEndX !== null) {
          DygraphInteraction.endZoom(event, g, context);
        } else {
          DygraphInteraction.maybeTreatMouseOpAsClick(event, g, context);
        }
      } else if (context.isPanning) {
        DygraphInteraction.endPan(event, g, context);
      }

      utils.removeEvent(document, 'mousemove', mousemove);
      utils.removeEvent(document, 'mouseup', mouseup);
      context.destroy();
    };

    g.addAndTrackEvent(document, 'mousemove', mousemove);
    g.addAndTrackEvent(document, 'mouseup', mouseup);
  }
function ( event , g , context ) { // Right-click should not initiate a zoom. if ( event . button && event . button == 2 ) return ; context . initializeMouseDown ( event , g , context ) ; if ( event . altKey || event . shiftKey ) { DygraphInteraction . startPan ( event , g , context ) ; } else { DygraphInteraction . startZoom ( event , g , context ) ; } // Note: we register mousemove/mouseup on document to allow some leeway for // events to move outside of the chart. Interaction model events get // registered on the canvas, which is too small to allow this. var mousemove = function ( event ) { if ( context . isZooming ) { // When the mouse moves >200px from the chart edge, cancel the zoom. var d = distanceFromChart ( event , g ) ; if ( d < DRAG_EDGE_MARGIN ) { DygraphInteraction . moveZoom ( event , g , context ) ; } else { if ( context . dragEndX !== null ) { context . dragEndX = null ; context . dragEndY = null ; g . clearZoomRect_ ( ) ; } } } else if ( context . isPanning ) { DygraphInteraction . movePan ( event , g , context ) ; } } ; var mouseup = function ( event ) { if ( context . isZooming ) { if ( context . dragEndX !== null ) { DygraphInteraction . endZoom ( event , g , context ) ; } else { DygraphInteraction . maybeTreatMouseOpAsClick ( event , g , context ) ; } } else if ( context . isPanning ) { DygraphInteraction . endPan ( event , g , context ) ; } utils . removeEvent ( document , 'mousemove' , mousemove ) ; utils . removeEvent ( document , 'mouseup' , mouseup ) ; context . destroy ( ) ; } ; g . addAndTrackEvent ( document , 'mousemove' , mousemove ) ; g . addAndTrackEvent ( document , 'mouseup' , mouseup ) ; }
Track the beginning of drag events
Track the beginning of drag events