Made tab/shift+tab cycle through elements as long as no input field is focused

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1749 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Alexis Deveria
2010-09-24 16:05:46 +00:00
parent 8f56429b1a
commit c363097f50
3 changed files with 22 additions and 7 deletions

View File

@@ -463,7 +463,8 @@
layer_menu = $("#cmenu_layers"),
show_save_warning = false,
exportWindow = null,
tool_scale = 1;
tool_scale = 1,
ui_context = 'toolbars';
// This sets up alternative dialog boxes. They mostly work the same way as
// their UI counterparts, expect instead of returning the result, a callback
@@ -633,6 +634,7 @@
// called when we've selected a different element
var selectedChanged = function(window,elems) {
var mode = svgCanvas.getMode();
if(mode === "select") setSelectMode();
var is_node = (mode == "pathedit");
// if elems[1] is present, then we have more than one element
selectedElement = (elems.length == 1 || elems[1] == null ? elems[0] : null);
@@ -2180,19 +2182,19 @@
$(inp).blur();
}
// Do not include the #text input, as it needs to remain focused
// when clicking on an SVG text element.
$('#svg_editor input:text:not(#text)').focus(function() {
$('#svg_editor').find('button, select, input:not(#text)').focus(function() {
inp = this;
ui_context = 'toolbars';
workarea.mousedown(unfocus);
}).blur(function() {
ui_context = 'canvas';
workarea.unbind('mousedown', unfocus);
// Go back to selecting text if in textedit mode
if(svgCanvas.getMode() == 'textedit') {
$('#text').focus();
}
});
}());
var clickSelect = function() {
@@ -3771,6 +3773,18 @@
function(evt) {$(this).change();evt.preventDefault();}
);
$(window).bind('keydown', 'tab', function(e) {
if(ui_context === 'canvas') {
e.preventDefault();
selectNext();
}
}).bind('keydown', 'shift+tab', function(e) {
if(ui_context === 'canvas') {
e.preventDefault();
selectPrev();
}
});
$('#tool_zoom').dblclick(dblclickZoom);
},
setTitles: function() {