fix tab/shift-tab for metacode selection (#879)

This commit is contained in:
Devin Howard 2016-10-30 00:08:51 +08:00 committed by GitHub
parent b9190233b1
commit bc1f212c93

View file

@ -156,23 +156,26 @@ jQuery.browser = browser;
event.data.rotate(-1); event.data.rotate(-1);
return false; return false;
}); });
$(options.buttonRight).bind('mouseup',this,function(event){ $(options.buttonRight).bind('mouseup',this,function(event){
event.data.rotate(1); event.data.rotate(1);
return false; return false;
}); });
// START METAMAPS CODE
// Add code that makes tab and shift+tab scroll through metacodes // Add code that makes tab and shift+tab scroll through metacodes
$('.new_topic').bind('keydown',this,function(event){ $('.new_topic').bind('keydown',this,function(event){
if (event.keyCode == 9 && event.shiftKey) { if (event.keyCode == 9) {
event.data.rotate(-1); if (event.shiftKey) {
event.preventDefault(); event.data.rotate(-1)
event.stopPropagation(); } else {
} else if (event.keyCode == 9) { event.data.rotate(1)
event.data.rotate(1); }
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
} Metamaps.Create.newTopic.metacode = $(items[event.data.frontIndex].image).attr('data-id');
}
}); });
// END METAMAPS CODE
// You will need this plugin for the mousewheel to work: http://plugins.jquery.com/project/mousewheel // You will need this plugin for the mousewheel to work: http://plugins.jquery.com/project/mousewheel
if (options.mouseWheel) if (options.mouseWheel)
@ -187,12 +190,12 @@ jQuery.browser = browser;
} }
}); });
// END METAMAPS CODE // END METAMAPS CODE
/* ORIGINAL CODE // ORIGINAL CODE
$(container).bind('mousewheel',this,function(event, delta) { // $(container).bind('mousewheel',this,function(event, delta) {
event.data.rotate(delta); // event.data.rotate(delta);
return false; // return false;
}); // });
*/ //
} }
$(container).unbind('mouseover click').bind('mouseover click',this,function(event){ $(container).unbind('mouseover click').bind('mouseover click',this,function(event){