[Sie-announce] SIEコード [1244] fill要素の調整(実験中)

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 9月 13日 (日) 23:41:11 JST


Revision: 1244
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1244
Author:   dhrname
Date:     2009-09-13 23:41:11 +0900 (Sun, 13 Sep 2009)

Log Message:
-----------
fill要素の調整(実験中)
TO DO
fillELementの生成をset関数に移す

Modified Paths:
--------------
    branches/05x/051/sie.js

Modified: branches/05x/051/sie.js
===================================================================
--- branches/05x/051/sie.js	2009-09-13 12:07:56 UTC (rev 1243)
+++ branches/05x/051/sie.js	2009-09-13 14:41:11 UTC (rev 1244)
@@ -644,29 +644,42 @@
     this.paint.set(w, h, ttm);
     this.w = w; this.h = h;
     dat = preCom = x = y = x0 = y0 = dx = dy = tma = tmb = tmc = tmd = tme = tmf = null; //解放
+    if(Nnenn) {
+		Nnenn = false;
+		this.setAttributeNS("http://www.w3.org/svg/2000","stroke-width", "10px");
+		this.setAttributeNS("http://www.w3.org/svg/2000","fill", "red");
+	}
   } catch(e) {stlog.add(e,372);}
 }
+Nnenn = true;
 STPath.prototype.setAttributeNS = function ( /*string*/ namespaceURI, /*string*/ name, /*string*/ value) {
+try{  //以下でfill,storke要素のリセットが必要
+  if (this.tar.getElementsByTagName("fill").length > 0) {
+    this.tar.removeChild(this.paint.fillElement);
+  }
+  this.paint.fillElement = document.createElement("v:fill");
+  if (this.tar.getElementsByTagName("stroke").length > 0) {
+    this.tar.removeChild(this.paint.strokeElement);
+  }
+  this.paint.strokeElement = document.createElement("v:stroke");
   if (this.paint.defaults[name] !== void 0) { //スタイルで定義されていれば
-    name = name.replace(/fill-/g, "fill").replace(/stroke-/g, "stroke");
+    name = name.replace(/fill-/, "fill").replace(/stroke-/, "stroke");
     this.paint[name] = value;
-    if (name === "fill" || this.paint.fillElement === void 0) {
-      this.paint.fillElement = document.createElement("v:fill");
-    }
-    if (name === "stroke" || this.paint.strokeElement === void 0) {
-      this.paint.strokeElement = document.createElement("v:stroke");
-    }
     this.paint.set(this.w, this.h, this.transformable);
   }
-  var tn = this[name];
+   var tn = this[name];
   if (tn !== void 0) { //属性が定義されていれば
     if (tn === "transform") {
       this.transformable = NAIBU.transformToCTM(this.tar, this.partransformable)
     }
-    if (typeof tn === "string" || tn instanceof STLength) { //文字列か長さの場合
-      this.set(this.w, this.h);
+    if (typeof tn === "string"){//文字列の場合
+      this[tn] = value;
+    } else if (tn instanceof STLength) { //長さの場合
+      this[tn].newValueSpecifiedUnits(this[tn].uniType, parseFloat(value));
     }
+    this.set(this.w, this.h);
   }
+ }catch(e){stlog.add(e,6824);}
 }
 //QからCに変換
 NAIBU.qtoc = function (/*float*/ x, /*float*/ y, /*Array*/ F) {




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