Skip to content

Instantly share code, notes, and snippets.

@connor
Created April 29, 2012 23:06
Show Gist options
  • Save connor/2553777 to your computer and use it in GitHub Desktop.
Save connor/2553777 to your computer and use it in GitHub Desktop.
use shiftDiff var instead of numeric value
case 37: // left
if (d3.event.shiftKey && focus > shiftDiff) context.focus(focus -= shiftDiff);
else {
if (focus == null) focus = size - 1;
if (focus > 0) context.focus(--focus);
}
break;
case 39: // right
if (d3.event.shiftKey && size - focus > shiftDiff) context.focus(focus += shiftDiff);
else {
if (focus == null) focus = size - 2;
if (focus < size - 1) context.focus(focus++);
}
break;
default: return;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment