Skip to content Skip to sidebar Skip to footer

Determine If Shift Key Is Pressed During Mousedown Event

Is it possible to determine whether the Shift key is pressed during a mousedown d3.event? if possible could show me a way to do this, try looking in the API, but could not find som

Solution 1:

You should be able to use something like this:

d3.select(window).on("click", function() {
    if (d3.event.shiftKey) {
        alert("Mouse+Shift pressed");
    }
});

Demo: http://jsfiddle.net/SO_AMK/NTGKG/1/

Solution 2:

Maybe it is necessary to use:

if (d3.event.sourceEvent.shiftKey) {
  console.log("shift pressed");
}

Post a Comment for "Determine If Shift Key Is Pressed During Mousedown Event"