From c704d285f28e3341054b817f97d7f30697594d65 Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Wed, 7 Nov 2012 17:21:02 +0100 Subject: [PATCH] SVG Importer: Use importGroup to import defs. --- .DS_Store | Bin 0 -> 6148 bytes examples/.DS_Store | Bin 0 -> 6148 bytes examples/SVG Import/Clipping.html | 176 +++++++++--------- .../SVG Import/Multiple Paths Test 1.html | 76 +++++--- src/svg/SvgImport.js | 14 +- 5 files changed, 151 insertions(+), 115 deletions(-) create mode 100644 .DS_Store create mode 100644 examples/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..1649e864896ef2b4a3d3a304638f3d6102c611f8 GIT binary patch literal 6148 zcmeHKUyIW~5TCt9FYyobMeZIKpQE&;y*A)OC@1(R^xz&m(d2U2Kx|5rS|L`WFMb>S z41NhekH6X7J9>>L_)ke+1X`&%kE~0NQ{?Bm#9rdE|k%^gXTBFan^?H8IK1P zJVv}K=5dzC`2ODLZ5@^Y%fP?J0PkIg5=yC{a&!O2^DHgOPUolCYdN=W@4KGo-a9)@ zXGy*q=gV1AyqHY$)g(^o4MMT*rd7i;OGrdpKq@2ELA68W_ z==-u49Ibs>^@jsr4tv3R?YXYk{^~w>`1r}Qljy_xM=GKoiv=WJ@bLR)DMp#s6)CIyX$F|mZ8HBy&UO}b7hg=jDP z9KL~{;CptiZM2rc189P&@|Em!P{Kw{5TrSOxw!1@z|LqJ(1lPE-3gOjEUoSIDPh8X(-q=FY-V)(?AW z2p$(1W z;^TQt`y)^lT2xqN=>L=PINjvltbW_mIAD?iuR(EBi zTK^Y>Z>4l6?GIQ2Pe!}-Zqt?ZcAIH8nwa!vy=~_C_kHL2FYPHxd@Av(o}KEc4mWhU zUN{SjW~VqW7M7tUW)-jsJX8VxK1dWs&tRcZeL7I7D*&*BW@YgCF2Om{pl7hqhzLyR zRG>~3=87S7I@+b_=NT+C>U0unWW2|WEX)l>sL|0bRd*7eMq672tOBzNEbGS#pZ_~| z-~VTm?2}c%DzH!rh|;#d-2o+Yw$72`vsR*fMPcK9g+`Tv${fea;iGsBMHym}9iV5h T(1;e8{SiClipping - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Clipping a path with a path: - Clipping a compound path with a path: - Clipping a path with a compound path: - Clipping a group with a path: + + + + + + + + + + - - - + - - - - - - - - - - - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Clipping a path with a path: +Clipping a compound path with a path: +Clipping a path with a compound path: +Clipping a group with a path: + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/SVG Import/Multiple Paths Test 1.html b/examples/SVG Import/Multiple Paths Test 1.html index 3afaa70c..8a1b37fa 100644 --- a/examples/SVG Import/Multiple Paths Test 1.html +++ b/examples/SVG Import/Multiple Paths Test 1.html @@ -11,31 +11,57 @@ - - - - - - - - - - - - - - - - - - - - - - - - - I love SVG + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/svg/SvgImport.js b/src/svg/SvgImport.js index c2076373..61252ba9 100644 --- a/src/svg/SvgImport.js +++ b/src/svg/SvgImport.js @@ -61,6 +61,13 @@ new function() { } } } + + if (type == 'defs') { + // I don't think we need to add defs to the DOM. But we might want + // to use Symbols for them? + group.remove(); + grourp = null; + } return group; } @@ -206,12 +213,7 @@ new function() { }, // http://www.w3.org/TR/SVG/struct.html#DefsElement - defs: function(svg, type) { - var group = importGroup(svg, type); - group.remove(); - // I don't think we need to add defs to the DOM. But we might want - // to use Symbols for them? - return null; + defs: importGroup, }, // http://www.w3.org/TR/SVG/shapes.html#InterfaceSVGCircleElement