[Sie-announce] SIEコード [1850] #で始まる色の処理について、SVGColorを修正

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 5月 31日 (月) 20:10:36 JST


Revision: 1850
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1850
Author:   dhrname
Date:     2010-05-31 20:10:36 +0900 (Mon, 31 May 2010)

Log Message:
-----------
#で始まる色の処理について、SVGColorを修正

Modified Paths:
--------------
    branches/ufltima/dom/svg.js

Modified: branches/ufltima/dom/svg.js
===================================================================
--- branches/ufltima/dom/svg.js	2010-05-31 11:09:37 UTC (rev 1849)
+++ branches/ufltima/dom/svg.js	2010-05-31 11:10:36 UTC (rev 1850)
@@ -565,12 +565,15 @@
     rgbColor = rgbColor.replace(/[\d.]+%/g, function(s) {
       return Math.round((2.55 * parseFloat(s)));
     });
+    var s = rgbColor.match(/\d+/g);
   } else if (rgbColor.indexOf("#") === 0) {  //#を含む場合
-    rgbColor = rgbColor.replace(/[\da-f][\da-f]/gi, function(s) {
-      return (parseInt(s, 16)+",");
-    });
+    var s = [], _parseInt = parseInt;
+    s[0] = _parseInt(rgbColor.charAt(1)+rgbColor.charAt(2), 16)+ "";
+    s[1] = _parseInt(rgbColor.charAt(3)+rgbColor.charAt(4), 16)+ "";
+    s[2] = _parseInt(rgbColor.charAt(5)+rgbColor.charAt(6), 16)+ "";
+  } else {
+    var s = rgbColor.match(/\d+/g);
   }
-  var s = rgbColor.match(/\d+/g);
   this.rgbColor.red.cssText = s[0];
   this.rgbColor.green.cssText = s[1];
   this.rgbColor.blue.cssText = s[2];




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