better logic for handling lr arrows
parent
c6cac53dda
commit
0c902ced73
|
@ -304,34 +304,27 @@ var padeditbar = (function()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var editbarPosition = 0;
|
||||||
|
|
||||||
function editbarKeyEvent(evt){
|
function editbarKeyEvent(evt){
|
||||||
// On arrow keys go to next/previous button item in editbar
|
// On arrow keys go to next/previous button item in editbar
|
||||||
if(evt.keyCode !== 39 && evt.keyCode !== 37) return;
|
if(evt.keyCode !== 39 && evt.keyCode !== 37) return;
|
||||||
|
|
||||||
// Get our current Focus (Which editbar icon we're currently on)
|
// Get all the focusable items in the editbar
|
||||||
var currentFocus = $(':focus');
|
var focusItems = $('#editbar').find('button, select');
|
||||||
|
|
||||||
// On left arrow move to next button in editbar
|
// On left arrow move to next button in editbar
|
||||||
if(evt.keyCode === 37){
|
if(evt.keyCode === 37){
|
||||||
var nextFocus = $(currentFocus).parent().parent().prev();
|
editbarPosition--;
|
||||||
// No button in this focus so move on
|
$(focusItems[editbarPosition]).focus();
|
||||||
if(nextFocus.find("button").length === 0){
|
|
||||||
$(nextFocus).prev().find("button").focus();
|
|
||||||
}else{
|
|
||||||
$(currentFocus).parent().parent().prev().find("button").focus();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// On right arrow move to next button in editbar
|
// On right arrow move to next button in editbar
|
||||||
if(evt.keyCode === 39){
|
if(evt.keyCode === 39){
|
||||||
var nextFocus = $(currentFocus).parent().parent().next();
|
editbarPosition++;
|
||||||
// No button in this focus so move on
|
$(focusItems[editbarPosition]).focus();
|
||||||
if(nextFocus.find("button").length === 0){
|
|
||||||
$(nextFocus).next().find("button").focus();
|
|
||||||
}else{
|
|
||||||
$(currentFocus).parent().parent().next().find("button").focus();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function aceAttributeCommand(cmd, ace) {
|
function aceAttributeCommand(cmd, ace) {
|
||||||
|
|
Loading…
Reference in New Issue