From afb7ef00bb8e55820fef5619318c639e631189af Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Tue, 20 Apr 2010 15:53:19 +0000 Subject: [PATCH] Made some minor code optimization, added more icon labels (blur by Christian Tzurcanu) git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1530 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/images/svg_edit_icons.svg | 24 +++++----- editor/svg-editor.html | 4 +- editor/svg-editor.js | 73 ++++++++++++++++-------------- editor/svgicons/jquery.svgicons.js | 2 + 4 files changed, 54 insertions(+), 49 deletions(-) diff --git a/editor/images/svg_edit_icons.svg b/editor/images/svg_edit_icons.svg index c91d8ac1..b238a723 100644 --- a/editor/images/svg_edit_icons.svg +++ b/editor/images/svg_edit_icons.svg @@ -695,24 +695,24 @@ - - - - - - - - + + - - + + + + + + + T + T - --> diff --git a/editor/svg-editor.html b/editor/svg-editor.html index 1451f643..faa91696 100644 --- a/editor/svg-editor.html +++ b/editor/svg-editor.html @@ -173,7 +173,7 @@ script type="text/javascript" src="locale/locale.min.js">
diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 80fee2fc..7d7d1bf2 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -341,6 +341,8 @@ '#tool_fill label': 'fill', '#tool_stroke .icon_label': 'stroke', '#group_opacityLabel': 'opacity', + '#blurLabel': 'blur', + '#font_sizeLabel': 'fontsize', '.flyout_arrow_horiz':'arrow_right', '.dropdown button, #main_button .dropdown':'arrow_down', @@ -2861,47 +2863,48 @@ var SIDEPANEL_MAXWIDTH = 300; var SIDEPANEL_OPENWIDTH = 150; var sidedrag = -1, sidedragging = false; + + var resizePanel = function(evt) { + if (sidedrag == -1) return; + sidedragging = true; + var deltax = sidedrag - evt.pageX; + + var sidepanels = $('#sidepanels'); + var sidewidth = parseInt(sidepanels.css('width')); + if (sidewidth+deltax > SIDEPANEL_MAXWIDTH) { + deltax = SIDEPANEL_MAXWIDTH - sidewidth; + sidewidth = SIDEPANEL_MAXWIDTH; + } + else if (sidewidth+deltax < 2) { + deltax = 2 - sidewidth; + sidewidth = 2; + } + + if (deltax == 0) return; + sidedrag -= deltax; + + var layerpanel = $('#layerpanel'); + workarea.css('right', parseInt(workarea.css('right'))+deltax); + sidepanels.css('width', parseInt(sidepanels.css('width'))+deltax); + layerpanel.css('width', parseInt(layerpanel.css('width'))+deltax); + } + $('#sidepanel_handle') - .mousedown(function(evt) {sidedrag = evt.pageX;}) + .mousedown(function(evt) { + sidedrag = evt.pageX; + $(window).mousemove(resizePanel); + + }) .mouseup(function(evt) { if (!sidedragging) toggleSidePanel(); sidedrag = -1; sidedragging = false; }); - $('#svg_editor') - .mouseup(function(){sidedrag=-1;}) - .mouseout(function(evt){ - if (sidedrag == -1) return; - // if we've moused out of the browser window, then we can stop dragging - // and close the drawer - if (evt.pageX > this.clientWidth) { - sidedrag = -1; - toggleSidePanel(true); - } - }) - .mousemove(function(evt) { - if (sidedrag == -1) return; - sidedragging = true; - var deltax = sidedrag - evt.pageX; - - var sidepanels = $('#sidepanels'); - var sidewidth = parseInt(sidepanels.css('width')); - if (sidewidth+deltax > SIDEPANEL_MAXWIDTH) { - deltax = SIDEPANEL_MAXWIDTH - sidewidth; - sidewidth = SIDEPANEL_MAXWIDTH; - } - else if (sidewidth+deltax < 2) { - deltax = 2 - sidewidth; - sidewidth = 2; - } - - if (deltax == 0) return; - sidedrag -= deltax; - - var layerpanel = $('#layerpanel'); - workarea.css('right', parseInt(workarea.css('right'))+deltax); - sidepanels.css('width', parseInt(sidepanels.css('width'))+deltax); - layerpanel.css('width', parseInt(layerpanel.css('width'))+deltax); + + $(window).mouseup(function() { + sidedrag = -1; + sidedragging = false; + $('#svg_editor').unbind('mousemove', resizePanel); }); // if width is non-zero, then fully close it, otherwise fully open it diff --git a/editor/svgicons/jquery.svgicons.js b/editor/svgicons/jquery.svgicons.js index f12b6917..2db257ea 100644 --- a/editor/svgicons/jquery.svgicons.js +++ b/editor/svgicons/jquery.svgicons.js @@ -377,6 +377,8 @@ $(function() { if(this.getAttribute('xlink:href') == '#' + id) { this.setAttributeNS(xlinkns,'href','#' + new_id); } + }).end().find('[filter="url(#' + id + ')"]').each(function() { + $(this).attr('filter', 'url(#' + new_id + ')'); }); }); return svg_el;