Fixed bug where shortcut key for group would throw error, minor code optimization

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1116 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2009-12-28 14:33:26 +00:00
parent 517e7e9983
commit 13b87e1839
1 changed files with 7 additions and 14 deletions

View File

@ -92,7 +92,7 @@ function svg_edit_setup() {
// needs to be included that returns the result as its first parameter. // needs to be included that returns the result as its first parameter.
// In the future we may want to add additional types of dialog boxes, since // In the future we may want to add additional types of dialog boxes, since
// they should be easy to handle this way. // they should be easy to handle this way.
var setDialogs = function() { (function() {
$('#dialog_container').draggable({cancel:'#dialog_content, #dialog_buttons *'}); $('#dialog_container').draggable({cancel:'#dialog_content, #dialog_buttons *'});
var box = $('#dialog_box'), btn_holder = $('#dialog_buttons'); var box = $('#dialog_box'), btn_holder = $('#dialog_buttons');
@ -129,9 +129,7 @@ function svg_edit_setup() {
$.alert = function(msg, cb) { dbox('alert', msg, cb);}; $.alert = function(msg, cb) { dbox('alert', msg, cb);};
$.confirm = function(msg, cb) { dbox('confirm', msg, cb);}; $.confirm = function(msg, cb) { dbox('confirm', msg, cb);};
$.prompt = function(msg, txt, cb) { dbox('prompt', msg, cb, txt);}; $.prompt = function(msg, txt, cb) { dbox('prompt', msg, cb, txt);};
} }());
setDialogs();
var setSelectMode = function() { var setSelectMode = function() {
$('.tool_button_current').removeClass('tool_button_current').addClass('tool_button'); $('.tool_button_current').removeClass('tool_button_current').addClass('tool_button');
@ -1008,7 +1006,7 @@ function svg_edit_setup() {
svgCanvas.groupSelectedElements(); svgCanvas.groupSelectedElements();
} }
// ungroup // ungroup
else { else if(selectedElement && selectedElement.tagName == 'g'){
svgCanvas.ungroupSelectedElement(); svgCanvas.ungroupSelectedElement();
} }
}; };
@ -1422,7 +1420,7 @@ function svg_edit_setup() {
// added these event handlers for all the push buttons so they // added these event handlers for all the push buttons so they
// behave more like buttons being pressed-in and not images // behave more like buttons being pressed-in and not images
function setPushButtons() { (function() {
var toolnames = ['clear','open','save','source','delete','delete_multi','paste','clone','clone_multi','move_top','move_bottom']; var toolnames = ['clear','open','save','source','delete','delete_multi','paste','clone','clone_multi','move_top','move_bottom'];
var all_tools = ''; var all_tools = '';
var cur_class = 'tool_button_current'; var cur_class = 'tool_button_current';
@ -1442,9 +1440,7 @@ function svg_edit_setup() {
}).bind('mousedown mouseout',function(){ }).bind('mousedown mouseout',function(){
$(this).removeClass(cur_class);} $(this).removeClass(cur_class);}
); );
} }());
setPushButtons();
$('#workarea').bind("mousewheel DOMMouseScroll", function(e){ $('#workarea').bind("mousewheel DOMMouseScroll", function(e){
if(!e.shiftKey) return; if(!e.shiftKey) return;
@ -2198,10 +2194,7 @@ function svg_edit_setup() {
}; };
// This process starts before document.ready so the icons appear ASAP // This process starts before document.ready so the icons appear ASAP
setSVGIcons(); (function() {
function setSVGIcons() {
$.svgIcons('images/svg_edit_icons.svg', { $.svgIcons('images/svg_edit_icons.svg', {
w:24, h:24, w:24, h:24,
id_match: false, id_match: false,
@ -2345,7 +2338,7 @@ function setSVGIcons() {
} }
} }
}); });
} }());
// This happens when the page is loaded // This happens when the page is loaded
$(function() { $(function() {