-Fix for Issue 618 - insert a check to prevent extension callback from running until $.svgIcons is finished

-Temporary Fix for Issue 620
-Fix for Issue 626



git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1644 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Jacob Brookover 2010-07-26 17:48:02 +00:00
parent b2f2df4eac
commit 32aec94b36
1 changed files with 15 additions and 9 deletions

View File

@ -801,9 +801,10 @@
var extAdded = function(window, ext) { var extAdded = function(window, ext) {
var cb_called = false; var cb_called = false;
var cb_ready = true; // Set to false to delay callback (e.g. wait for $.svgIcons)
var runCallback = function() { var runCallback = function() {
if(ext.callback && !cb_called) { if(ext.callback && !cb_called && cb_ready) {
cb_called = true; cb_called = true;
ext.callback(); ext.callback();
} }
@ -1114,6 +1115,9 @@
$.each(btn_selects, function() { $.each(btn_selects, function() {
addAltDropDown(this.elem, this.list, this.callback, {seticon: true}); addAltDropDown(this.elem, this.list, this.callback, {seticon: true});
}); });
if (svgicons)
cb_ready = false; // Delay callback
$.svgIcons(svgicons, { $.svgIcons(svgicons, {
w:24, h:24, w:24, h:24,
@ -1126,6 +1130,7 @@
if(curPrefs.iconsize && curPrefs.iconsize != 'm') { if(curPrefs.iconsize && curPrefs.iconsize != 'm') {
setIconSize(curPrefs.iconsize, true); setIconSize(curPrefs.iconsize, true);
} }
cb_ready = true; // Ready for callback
runCallback(); runCallback();
} }
@ -1216,8 +1221,8 @@
strokeOpacity = "N/A"; strokeOpacity = "N/A";
} }
$('#stroke_width').val(selectedElement.getAttribute("stroke-width")||1); $('#stroke_width').val(selectedElement.getAttribute("stroke-width")||1).change();
$('#stroke_style').val(selectedElement.getAttribute("stroke-dasharray")||"none"); $('#stroke_style').val(selectedElement.getAttribute("stroke-dasharray")||"none").change();
var attr = selectedElement.getAttribute("stroke-linejoin") || 'miter'; var attr = selectedElement.getAttribute("stroke-linejoin") || 'miter';
@ -1848,8 +1853,9 @@
} }
}); });
}()); }());
// Made public for UI customization.
var addDropDown = function(elem, callback, dropUp) { // TODO: Group UI functions into a public svgEditor.ui interface.
Editor.addDropDown = function(elem, callback, dropUp) {
var button = $(elem).find('button'); var button = $(elem).find('button');
var list = $(elem).find('ul'); var list = $(elem).find('ul');
var on_button = false; var on_button = false;
@ -1945,12 +1951,12 @@
} }
} }
addDropDown('#font_family_dropdown', function() { Editor.addDropDown('#font_family_dropdown', function() {
var fam = $(this).text(); var fam = $(this).text();
$('#font_family').val($(this).text()).change(); $('#font_family').val($(this).text()).change();
}); });
addDropDown('#opacity_dropdown', function() { Editor.addDropDown('#opacity_dropdown', function() {
if($(this).find('div').length) return; if($(this).find('div').length) return;
var perc = parseInt($(this).text().split('%')[0]); var perc = parseInt($(this).text().split('%')[0]);
changeOpacity(false, perc); changeOpacity(false, perc);
@ -1970,7 +1976,7 @@
} }
}); });
addDropDown('#blur_dropdown', function() { Editor.addDropDown('#blur_dropdown', function() {
}); });
var slideStart = false; var slideStart = false;
@ -1993,7 +1999,7 @@
}); });
addDropDown('#zoom_dropdown', function() { Editor.addDropDown('#zoom_dropdown', function() {
var item = $(this); var item = $(this);
var val = item.attr('data-val'); var val = item.attr('data-val');
if(val) { if(val) {