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
master
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

@ -524,7 +524,7 @@ script type="text/javascript" src="locale/locale.min.js"></script-->
</div>
<div id="tools_bottom_3">
<div id="palette_holder"><div id="palette" title="Click to change fill color, shift-click to change stroke color"></div></div>
<div id="palette_holder" tabindex="-1"><div id="palette" title="Click to change fill color, shift-click to change stroke color"></div></div>
</div>
<div id="copyright"><span id="copyrightLabel">Powered by</span> <a href="http://svg-edit.googlecode.com/" target="_blank">SVG-edit v2.6-preAlpha</a></div>
</div>

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() {

View File

@ -4196,8 +4196,8 @@ var removeFromSelection = this.removeFromSelection = function(elemsToRemove) {
// Clears the selection, then adds all elements in the current layer to the selection.
this.selectAllInCurrentLayer = function() {
if (current_layer) {
selectOnly($(current_group || current_layer).children());
current_mode = "select";
selectOnly($(current_group || current_layer).children());
}
};
@ -11107,6 +11107,7 @@ this.cycleElement = function(next) {
var cur_elem = selectedElements[0];
var elem = false;
var all_elems = getVisibleElements(current_group || current_layer);
if(!all_elems.length) return;
if (cur_elem == null) {
var num = next?all_elems.length-1:0;
elem = all_elems[num];