diff --git a/editor/svg-editor.html b/editor/svg-editor.html index 42ff86ea..47f8886c 100644 --- a/editor/svg-editor.html +++ b/editor/svg-editor.html @@ -524,7 +524,7 @@ script type="text/javascript" src="locale/locale.min.js">
-
+
diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 44f9e149..db822b1e 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -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() { diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index c0c8b1a7..4194999c 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -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];