From 400809fff389a56aede0701d0f5e3a7dba644470 Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Wed, 3 Feb 2010 14:14:57 +0000 Subject: [PATCH] Fixed tooltip translations for main flyout buttons git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1332 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svg-editor.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 271f8e5b..eb29e1d4 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -273,12 +273,12 @@ function svg_edit_setup() { var buttons = $(hold_sel).children(); var show_sel = hold_sel + '_show'; var def = false; - buttons.addClass('tool_button') .unbind('click mousedown mouseup') // may not be necessary .each(function(i) { // Get this buttons options var opts = btn_opts[i]; + // Remember the function that goes with this ID flyout_funcs[opts.sel] = opts.fn; @@ -302,7 +302,6 @@ function svg_edit_setup() { icon[0].setAttribute('height',shower.height()); shower.children(':not(.flyout_arrow_horiz)').remove(); shower.append(icon).attr('data-curopt', opts.sel); // This sets the current mode - shower.attr('title', $(opts.sel).attr('title')); } $(this).mouseup(func); @@ -311,7 +310,6 @@ function svg_edit_setup() { } }); - if(def) { $(show_sel).attr('data-curopt', btn_opts[def].sel); } else if(!$(show_sel).attr('data-curopt')) { @@ -349,6 +347,7 @@ function svg_edit_setup() { $(hold_sel).css({'left': pos.left+34, 'top': pos.top+77}); }); + setFlyoutTitles(); } var makeFlyoutHolder = function(id, child) { @@ -369,6 +368,17 @@ function svg_edit_setup() { }); } + var setFlyoutTitles = function() { + $('.tools_flyout').each(function() { + var shower = $('#' + this.id + '_show'); + var tooltips = []; + $(this).children().each(function() { + tooltips.push(this.title); + }); + shower[0].title = tooltips.join(' / '); + }); + } + var extAdded = function(window, ext) { if("buttons" in ext) { var fallback_obj = {}, @@ -2498,6 +2508,9 @@ function svg_edit_setup() { } svgCanvas.runExtensions("langChanged", lang); + + // Update flyout tooltips + setFlyoutTitles(); } };