Author: clopes
Date: 2011-08-03 08:20:06 -0700 (Wed, 03 Aug 2011)
New Revision: 26361

Modified:
   
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/converters/PDFExporter.as
   
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/converters/SVGExporter.as
Log:
Fixed SVG ellipse shape and PDF label alignment/offset.

Modified: 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/converters/PDFExporter.as
===================================================================
--- 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/converters/PDFExporter.as
        2011-08-03 01:13:37 UTC (rev 26360)
+++ 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/converters/PDFExporter.as
        2011-08-03 15:20:06 UTC (rev 26361)
@@ -364,22 +364,29 @@
                         p = toImagePoint(new Point(d.x, d.y), d);
                         // Flare's label cordinates is relative to the label's 
upper-left corner (x,y)=(0,0),
                         // but AlivePDF uses the bottom-left corner instead 
(x,y)=(0,fonSize):
-                        p.y += textHeight;
+                        p.y += (textHeight + yOffset);
+                        p.x += xOffset;
                         
                         switch (hAnchor) {
-                            case Anchors.LEFT:   p.x += (HPAD + xOffset); 
break;
-                            case Anchors.CENTER: p.x -= (xOffset + 
textWidth/2); break;
-                            case Anchors.RIGHT:  p.x -= (HPAD + xOffset + 
textWidth); break;
+                            case Anchors.LEFT:
+                                p.x += (HPAD + d.width/2);
+                                break;
+                            case Anchors.CENTER:
+                                p.x -= (textWidth/2);
+                                break;
+                            case Anchors.RIGHT:
+                                p.x -= (HPAD + textWidth +  + d.width/2);
+                                break;
                         }
                         switch (vAnchor) {
                             case Anchors.TOP:
-                                p.y += (VPAD + yOffset + d.height/2);
+                                p.y += (VPAD + d.height/2);
                                 break;
                             case Anchors.MIDDLE:
-                                p.y -= (VPAD + yOffset + 
(textHeight*lines.length)/2);
+                                p.y -= (VPAD + (textHeight*lines.length)/2);
                                 break;
                             case Anchors.BOTTOM:
-                                p.y -= (VPAD + yOffset + d.height/2 + 
textHeight*lines.length);
+                                p.y -= (VPAD + d.height/2 + 
textHeight*lines.length);
                                 break;
                         }
                     } else {

Modified: 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/converters/SVGExporter.as
===================================================================
--- 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/converters/SVGExporter.as
        2011-08-03 01:13:37 UTC (rev 26360)
+++ 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/converters/SVGExporter.as
        2011-08-03 15:20:06 UTC (rev 26361)
@@ -455,7 +455,7 @@
             
             switch (shape) {
                 case NodeShapes.ELLIPSE:
-                    svg += '<circle cx="'+x+'" cy="'+y+'" 
r="'+(h/2)+'"'+fillOpacity+'/>';
+                    svg += '<ellipse cx="'+x+'" cy="'+y+'" rx="'+(w/2)+'" 
ry="'+(h/2)+'"'+fillOpacity+'/>';
                     break;
                 case NodeShapes.RECTANGLE:
                     svg += '<rect x="'+(x-w/2)+'" y="'+(y-h/2)+'" 
width="'+w+'" height="'+h+'"'+fillOpacity+'/>';

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to