In flot i want to pan the graph just while the shift key is pressed.
I tried to change the flot.navigate plugin the following way (just changed the bindEvents
function):
if (o.pan.interactive) {
$(document).keydown(function(e){
if(e.shiftKey == 1){
eventHolder.bind("dragstart", { distance: 10 }, onDragStart);
eventHolder.bind("drag", onDrag);
eventHolder.bind("dragend", onDragEnd);
}
})
}
This works for the first time i press shift but then the browser is not responding for some reason.
With your code the binding is only done when shift is pressed, not the drag-and-drop itself. Instead change the onDragStart(e)
function like this:
Original:
function onDragStart(e) {
if (e.which != 1) // only accept left-click
return false;
var c = plot.getPlaceholder().css('cursor');
...
New:
function onDragStart(e) {
if (e.which != 1 || e.shiftKey != 1) // only accept left-click + pressed shiftkey
return false;
var c = plot.getPlaceholder().css('cursor');
...