From 082523f7f762354032b094e61454747304f8732f Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Mon, 16 Nov 2009 15:19:51 +0000 Subject: [PATCH] Fixed issue 331 and updated svg-icon-loader git-svn-id: http://svg-edit.googlecode.com/svn/trunk@946 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 8 ++++++++ editor/svgicons/jquery.svgicons.js | 18 +++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index e152fbe9..3ed8996b 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -1931,6 +1931,14 @@ function BatchCommand(text) { call("selected", selectedElements); } } + + // make sure the elements are in the correct order + selectedElements.sort(function(a,b) { + if(a && b && a.compareDocumentPosition) { + return 3 - (b.compareDocumentPosition(a) & 6); + } + }); + if(showGrips) { selectorManager.requestSelector(selectedElements[0]).showGrips(true); diff --git a/editor/svgicons/jquery.svgicons.js b/editor/svgicons/jquery.svgicons.js index e5ea490b..998a649c 100644 --- a/editor/svgicons/jquery.svgicons.js +++ b/editor/svgicons/jquery.svgicons.js @@ -1,5 +1,5 @@ /* - * SVG Icon Loader + * SVG Icon Loader 2.0 * * jQuery Plugin for loading SVG icons from a single file * @@ -13,8 +13,8 @@ How to use: 1. Create the SVG master file that includes all icons: The master SVG icon-containing file is an SVG file that contains - elements. Each element should contain the markup of an SVG -icon. The element has an ID that should + elements. Each element should contain the markup of an SVG +icon. The element has an ID that should correspond with the ID of the HTML element used on the page that should contain or optionally be replaced by the icon. Additionally, one empty element should be added at the end with id "svg_eof". @@ -57,7 +57,12 @@ All options are optional and can include: - 'id_match (boolean)': Automatically attempt to match SVG icon ids with corresponding HTML id (default: true) -- 'no_img (boolean)': Prevent attempting to convert the icon into an element (may be faster, help for browser consistency) +- 'no_img (boolean)': Prevent attempting to convert the icon into an + element (may be faster, help for browser consistency) + +- 'svgz (boolean)': Indicate that the file is an SVGZ file, and thus not to + parse as XML. SVGZ files add compression benefits, but getting data from + them fails in Firefox 2 and older. 5. To access an icon at a later point without using the callback, use this: $.getSvgIcon(id (string)); @@ -112,7 +117,10 @@ $(function() { callback: function(icons) { // Sets background color for "close" icon icons['close'].css('background','red'); - } + }, + + svgz: true // Indicates that an SVGZ file is being used + }) });