Fixed several remaining cross-browser icon bugs

git-svn-id: http://svg-edit.googlecode.com/svn/branches/transformlist@933 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2009-11-12 16:00:50 +00:00
parent 3924530ea3
commit 344e7a802d
4 changed files with 26 additions and 19 deletions

View File

@ -19,20 +19,25 @@ var put_locale = function(svgCanvas, given_param){
var url = "locale/lang." + lang_param + ".js";
$.get(url, function(data){
var LangData = eval(data), js_strings;
for (var i=0;i<LangData.length;i++)
{
if(LangData[i].id) {
var elem = document.getElementById(LangData[i].id);
if(elem){
if(LangData[i].title)
elem.title = LangData[i].title;
if(LangData[i].textContent)
elem.textContent = LangData[i].textContent;
$.each(LangData, function(i, data) {
if(data.id) {
var elem = $('#'+data.id)[0];
if(elem) {
if(data.title)
elem.title = data.title;
if(data.textContent) {
// Only replace text nodes, not elements
$.each(elem.childNodes, function(j, node) {
if(node.nodeType == 3) {
node.textContent = data.textContent;
}
} else if(LangData[i].js_strings) {
js_strings = LangData[i].js_strings;
});
}
}
} else if(data.js_strings) {
js_strings = data.js_strings;
}
});
svgCanvas.setLang(lang_param, js_strings);
},"json");
};

View File

@ -361,7 +361,6 @@ script type="text/javascript" src="locale/locale.min.js"></script-->
<div id="tool_docprops_back" class="toolbar_button">
<button id="tool_docprops_save">OK</button>
<button id="tool_docprops_cancel">Cancel</button>
</div>

View File

@ -126,6 +126,7 @@ function svg_edit_setup() {
// Deal with pathedit mode
$('#path_node_panel').toggle(is_node);
$('#tools_bottom_2,#tools_bottom_3').toggle(!is_node);
var size = $('#tool_select > svg')[0].getAttribute('width');
if(is_node) {
// Change select icon
$('.tool_button').removeClass('tool_button_current');
@ -133,8 +134,8 @@ function svg_edit_setup() {
.empty().append($.getSvgIcon('select_node'));
} else {
$('#tool_select').empty().append($.getSvgIcon('select'));
}
$.resizeSvgIcons({'#tool_select .svg_icon':size});
updateContextPanel();
};
@ -1035,14 +1036,14 @@ function svg_edit_setup() {
// Change icon size
$('.tool_button, .push_button, .tool_button_current, .tool_button_disabled, .tool_flyout_button')
.find('svg').each(function() {
.find('> svg').each(function() {
this.setAttribute('width',size_num);
this.setAttribute('height',size_num);
});
$.resizeSvgIcons({
'.flyout_arrow_horiz svg': size_num / 3,
'#logo svg': size_num * 1.3
'#logo a > svg': size_num * 1.3
});
if(size != 's') {
$.resizeSvgIcons({'#layerbuttons svg': size_num * .6});
@ -2028,10 +2029,11 @@ function setSVGIcons() {
'.flyout_arrow_horiz .svg_icon': 5,
'.layer_button .svg_icon, #layerlist td.layervis .svg_icon': 14,
'.dropdown button .svg_icon': 7,
'#palette .svg_icon, #fill_bg .svg_icon, #stroke_bg .svg_icon': 16
'.palette_item:first .svg_icon, #fill_bg .svg_icon, #stroke_bg .svg_icon': 16,
'.toolbar_button button .svg_icon':16
},
callback: function(icons) {
$('.toolbar_button button .svg_icon').each(function() {
$('.toolbar_button button > svg').each(function() {
$(this).parent().prepend(this);
});

View File

@ -403,13 +403,14 @@ $(function() {
$.getSvgIcon = function(id) { return svg_icons[id]; }
$.resizeSvgIcons = function(obj) {
// FF2 and older don't detect .svg_icon, so we change it detect svg elems instead
var change_sel = !$('.svg_icon:first').length;
$.each(obj, function(sel, size) {
var arr = $.isArray(size);
var w = arr?size[0]:size,
h = arr?size[1]:size;
if(change_sel) {
sel = sel.replace(/\.svg_icon/,'> svg');
sel = sel.replace(/\.svg_icon/g,'svg');
}
$(sel).each(function() {
this.setAttribute('width', w);