addon/utils/graph-view.js
function onWheel(event) {
    var prevScale = scale,

        offset = container.offset(),
        mouseX = event.pageX - offset.left,
        mouseY = event.pageY - offset.top,
        factor = 0;

    scale += event.deltaY * SCALE_TUNER;
    if(scale < MIN_SCALE) {
      scale = MIN_SCALE;
    }
    else if(scale > MAX_SCALE) {
      scale = MAX_SCALE;
    }

    factor = 1 - scale / prevScale;
    panX += (mouseX - panX) * factor;
    panY += (mouseY - panY) * factor;

    transform();
    scheduleVisibilityCheck();

    _tip.reposition();
    event.preventDefault();
  }
function onWheel(event) {
    var prevScale = scale,

        offset = container.offset(),
        mouseX = event.pageX - offset.left,
        mouseY = event.pageY - offset.top,
        factor = 0;

    scale += event.deltaY * SCALE_TUNER;
    if(scale < MIN_SCALE) {
      scale = MIN_SCALE;
    }
    else if(scale > MAX_SCALE) {
      scale = MAX_SCALE;
    }

    factor = 1 - scale / prevScale;
    panX += (mouseX - panX) * factor;
    panY += (mouseY - panY) * factor;

    transform();
    scheduleVisibilityCheck();

    _tip.reposition();
    event.preventDefault();
  }
function onWheel ( event ) { var prevScale = scale , offset = container . offset ( ) , mouseX = event . pageX - offset . left , mouseY = event . pageY - offset . top , factor = 0 ; scale += event . deltaY * SCALE_TUNER ; if ( scale < MIN_SCALE ) { scale = MIN_SCALE ; } else if ( scale > MAX_SCALE ) { scale = MAX_SCALE ; } factor = 1 - scale / prevScale ; panX += ( mouseX - panX ) * factor ; panY += ( mouseY - panY ) * factor ; transform ( ) ; scheduleVisibilityCheck ( ) ; _tip . reposition ( ) ; event . preventDefault ( ) ; }
Set zoom values, pan also would change as we are zooming with mouse position as pivote.
Set zoom values pan also would change as we are zooming with mouse position as pivote .