Fixed several remaining cross-browser icon bugs
git-svn-id: http://svg-edit.googlecode.com/svn/branches/transformlist@933 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
3924530ea3
commit
344e7a802d
|
@ -19,20 +19,25 @@ var put_locale = function(svgCanvas, given_param){
|
||||||
var url = "locale/lang." + lang_param + ".js";
|
var url = "locale/lang." + lang_param + ".js";
|
||||||
$.get(url, function(data){
|
$.get(url, function(data){
|
||||||
var LangData = eval(data), js_strings;
|
var LangData = eval(data), js_strings;
|
||||||
for (var i=0;i<LangData.length;i++)
|
$.each(LangData, function(i, data) {
|
||||||
{
|
if(data.id) {
|
||||||
if(LangData[i].id) {
|
var elem = $('#'+data.id)[0];
|
||||||
var elem = document.getElementById(LangData[i].id);
|
if(elem) {
|
||||||
if(elem){
|
if(data.title)
|
||||||
if(LangData[i].title)
|
elem.title = data.title;
|
||||||
elem.title = LangData[i].title;
|
if(data.textContent) {
|
||||||
if(LangData[i].textContent)
|
// Only replace text nodes, not elements
|
||||||
elem.textContent = LangData[i].textContent;
|
$.each(elem.childNodes, function(j, node) {
|
||||||
|
if(node.nodeType == 3) {
|
||||||
|
node.textContent = data.textContent;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if(LangData[i].js_strings) {
|
} else if(data.js_strings) {
|
||||||
js_strings = LangData[i].js_strings;
|
js_strings = data.js_strings;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
svgCanvas.setLang(lang_param, js_strings);
|
svgCanvas.setLang(lang_param, js_strings);
|
||||||
},"json");
|
},"json");
|
||||||
};
|
};
|
||||||
|
|
|
@ -361,7 +361,6 @@ script type="text/javascript" src="locale/locale.min.js"></script-->
|
||||||
<div id="tool_docprops_back" class="toolbar_button">
|
<div id="tool_docprops_back" class="toolbar_button">
|
||||||
<button id="tool_docprops_save">OK</button>
|
<button id="tool_docprops_save">OK</button>
|
||||||
<button id="tool_docprops_cancel">Cancel</button>
|
<button id="tool_docprops_cancel">Cancel</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,7 @@ function svg_edit_setup() {
|
||||||
// Deal with pathedit mode
|
// Deal with pathedit mode
|
||||||
$('#path_node_panel').toggle(is_node);
|
$('#path_node_panel').toggle(is_node);
|
||||||
$('#tools_bottom_2,#tools_bottom_3').toggle(!is_node);
|
$('#tools_bottom_2,#tools_bottom_3').toggle(!is_node);
|
||||||
|
var size = $('#tool_select > svg')[0].getAttribute('width');
|
||||||
if(is_node) {
|
if(is_node) {
|
||||||
// Change select icon
|
// Change select icon
|
||||||
$('.tool_button').removeClass('tool_button_current');
|
$('.tool_button').removeClass('tool_button_current');
|
||||||
|
@ -133,8 +134,8 @@ function svg_edit_setup() {
|
||||||
.empty().append($.getSvgIcon('select_node'));
|
.empty().append($.getSvgIcon('select_node'));
|
||||||
} else {
|
} else {
|
||||||
$('#tool_select').empty().append($.getSvgIcon('select'));
|
$('#tool_select').empty().append($.getSvgIcon('select'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
$.resizeSvgIcons({'#tool_select .svg_icon':size});
|
||||||
|
|
||||||
updateContextPanel();
|
updateContextPanel();
|
||||||
};
|
};
|
||||||
|
@ -1035,14 +1036,14 @@ function svg_edit_setup() {
|
||||||
|
|
||||||
// Change icon size
|
// Change icon size
|
||||||
$('.tool_button, .push_button, .tool_button_current, .tool_button_disabled, .tool_flyout_button')
|
$('.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('width',size_num);
|
||||||
this.setAttribute('height',size_num);
|
this.setAttribute('height',size_num);
|
||||||
});
|
});
|
||||||
|
|
||||||
$.resizeSvgIcons({
|
$.resizeSvgIcons({
|
||||||
'.flyout_arrow_horiz svg': size_num / 3,
|
'.flyout_arrow_horiz svg': size_num / 3,
|
||||||
'#logo svg': size_num * 1.3
|
'#logo a > svg': size_num * 1.3
|
||||||
});
|
});
|
||||||
if(size != 's') {
|
if(size != 's') {
|
||||||
$.resizeSvgIcons({'#layerbuttons svg': size_num * .6});
|
$.resizeSvgIcons({'#layerbuttons svg': size_num * .6});
|
||||||
|
@ -2028,10 +2029,11 @@ function setSVGIcons() {
|
||||||
'.flyout_arrow_horiz .svg_icon': 5,
|
'.flyout_arrow_horiz .svg_icon': 5,
|
||||||
'.layer_button .svg_icon, #layerlist td.layervis .svg_icon': 14,
|
'.layer_button .svg_icon, #layerlist td.layervis .svg_icon': 14,
|
||||||
'.dropdown button .svg_icon': 7,
|
'.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) {
|
callback: function(icons) {
|
||||||
$('.toolbar_button button .svg_icon').each(function() {
|
$('.toolbar_button button > svg').each(function() {
|
||||||
$(this).parent().prepend(this);
|
$(this).parent().prepend(this);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -403,13 +403,14 @@ $(function() {
|
||||||
$.getSvgIcon = function(id) { return svg_icons[id]; }
|
$.getSvgIcon = function(id) { return svg_icons[id]; }
|
||||||
|
|
||||||
$.resizeSvgIcons = function(obj) {
|
$.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;
|
var change_sel = !$('.svg_icon:first').length;
|
||||||
$.each(obj, function(sel, size) {
|
$.each(obj, function(sel, size) {
|
||||||
var arr = $.isArray(size);
|
var arr = $.isArray(size);
|
||||||
var w = arr?size[0]:size,
|
var w = arr?size[0]:size,
|
||||||
h = arr?size[1]:size;
|
h = arr?size[1]:size;
|
||||||
if(change_sel) {
|
if(change_sel) {
|
||||||
sel = sel.replace(/\.svg_icon/,'> svg');
|
sel = sel.replace(/\.svg_icon/g,'svg');
|
||||||
}
|
}
|
||||||
$(sel).each(function() {
|
$(sel).each(function() {
|
||||||
this.setAttribute('width', w);
|
this.setAttribute('width', w);
|
||||||
|
|
Loading…
Reference in New Issue