You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2007/04/13 17:48:07 UTC

svn commit: r528531 - /lenya/trunk/src/modules/languageselector/xslt/resizesvg.xsl

Author: andreas
Date: Fri Apr 13 08:48:06 2007
New Revision: 528531

URL: http://svn.apache.org/viewvc?view=rev&rev=528531
Log:
Language selector flag resizing: use fixed aspect ratio

Modified:
    lenya/trunk/src/modules/languageselector/xslt/resizesvg.xsl

Modified: lenya/trunk/src/modules/languageselector/xslt/resizesvg.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/languageselector/xslt/resizesvg.xsl?view=diff&rev=528531&r1=528530&r2=528531
==============================================================================
--- lenya/trunk/src/modules/languageselector/xslt/resizesvg.xsl (original)
+++ lenya/trunk/src/modules/languageselector/xslt/resizesvg.xsl Fri Apr 13 08:48:06 2007
@@ -27,7 +27,10 @@
 
   <!-- prevent users from causing memory overflows: -->
   <xsl:variable name="maxHeight" select="1024"/>
-
+  
+  <!-- the width:height-ratio -->
+  <xsl:variable name="ratio" select="1.5"/>
+  
   <!-- 
      scales an svg to height $height.
      this is done by surrounding the image with a new <svg/> element with the desired height and 
@@ -36,11 +39,8 @@
   <xsl:template match="/svg:svg">
     <xsl:choose>
       <xsl:when test="number($height) &gt; 0 and number($height) &lt;= $maxHeight">
-        <svg:svg viewBox="0 0 {@width} {@height}">
-          <xsl:attribute name="height"><xsl:value-of select="$height"/></xsl:attribute>
-          <xsl:if test="number(@width) &gt; 0 and number(@height) &gt; 0">
-            <xsl:attribute name="width"><xsl:value-of select="ceiling(@width div @height * $height)"/></xsl:attribute>
-          </xsl:if>
+        <svg:svg viewBox="0 0 {@width} {@height}" width="{$height * $ratio}" height="{$height}"
+          preserveAspectRatio="none">
           <xsl:copy>
             <xsl:apply-templates select="@*|node()"/>
           </xsl:copy> 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org