[Sie-announce] SIEコード [1934]

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 7月 9日 (金) 23:26:52 JST


Revision: 1934
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1934
Author:   dhrname
Date:     2010-07-09 23:26:52 +0900 (Fri, 09 Jul 2010)

Log Message:
-----------


Modified Paths:
--------------
    branches/06x/061/org/w3c/dom/svg.js

Modified: branches/06x/061/org/w3c/dom/svg.js
===================================================================
--- branches/06x/061/org/w3c/dom/svg.js	2010-07-09 14:06:33 UTC (rev 1933)
+++ branches/06x/061/org/w3c/dom/svg.js	2010-07-09 14:26:52 UTC (rev 1934)
@@ -3431,6 +3431,7 @@
   /*readonly SVGAnimatedLength*/ this.r = new SVGAnimatedLength();
   /*readonly SVGAnimatedLength*/ this.fx = new SVGAnimatedLength();
   /*readonly SVGAnimatedLength*/ this.fy = new SVGAnimatedLength();
+  this.cx.baseVal.value = this.cy.baseVal.value = this.r.baseVal.value = 0.5;
   this.addEventListener("DOMNodeInsertedIntoDocument", function(evt) {
     var grad = evt.target, ele = evt._tar, tar = evt._ttar; //eleはv:fill要素。tarはターゲットとになる要素
     if (!!!ele) { //まだ、path要素などが設定されていない場合
@@ -3443,25 +3444,21 @@
       /*VMLでは、図の形状に沿って、円状のグラデーションを処理するようになっているため、
        *四角だとおかしな模様が出てしまう。以下はそれを避ける処理
        */
-      var cx = parseFloat((grad.getAttributeNS(null, "cx") || "0.5"));
-      var cy = parseFloat((grad.getAttributeNS(null, "cy") || "0.5"));
-      var r = rx = ry = parseFloat((grad.getAttributeNS(null, "r") || "0.5"));
-      var el = this.w, et = this.h, er = 0, eb = 0;
-      var data = this.tar.path.value;
+      var cx = grad.cx.baseVal.value, cy = grad.cy.baseVal.value;
+      var r = rx = ry = grad.r.baseVal.value;
+      var tarrect = tar.getBBox();
+      var el = tar.viewport.width, et = tar.viewport.height, er = 0, eb = 0;
       var units = grad.getAttributeNS(null, "gradientUnits");
       if (!units || units === "objectBoundingBox") {
         //%の場合は小数点に変換(10% -> 0.1)
         cx = cx > 1 ? cx/100 : cx; cy = cy > 1 ? cy/100 : cy; r = r > 1 ? r/100 : r;
         //要素の境界領域を求める(四隅の座標を求める)
-        var degis = data.match(/[0-9\-]+/g);
-        for (var i=0,degisli=degis.length;i<degisli;i+=2) {
-          var nx = parseInt(degis[i]), ny = parseInt(degis[i+1]);
-          el = el > nx ? nx : el;
-          et = et > ny ? ny : et;
-          er = er > nx ? er : nx;
-          eb = eb > ny ? eb : ny; nx = ny = null;
-        }
-        degis = null;
+        var nx = tarrect.x, ny = tarrect.y;
+        el = el > nx ? nx : el;
+        et = et > ny ? ny : et;
+        er = er > nx ? er : nx;
+        eb = eb > ny ? eb : ny;
+        nx = ny = null;
         cx = cx*(er - el) + el; cy = cy*(eb - et) + et; rx = r*(er - el); ry = r*(eb - et);
       }
       var gt = grad.getAttributeNS(null, "gradientTransform");




Sie-announce メーリングリストの案内
Back to archive index