svnno****@sourc*****
svnno****@sourc*****
2009年 10月 13日 (火) 20:42:10 JST
Revision: 1331
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1331
Author: dhrname
Date: 2009-10-13 20:42:10 +0900 (Tue, 13 Oct 2009)
Log Message:
-----------
0.51統合
Modified Paths:
--------------
trunk/sie.js
Property Changed:
----------------
trunk/sie.js
Modified: trunk/sie.js
===================================================================
--- trunk/sie.js 2009-10-12 13:18:32 UTC (rev 1330)
+++ trunk/sie.js 2009-10-13 11:42:10 UTC (rev 1331)
@@ -56,9 +56,10 @@
//引数にtrueがあれば、例外処理のログを作動させる
stlog = new STLog(false);
var ary = document.getElementsByTagName("script");
- for (var i=0; i < ary.length; i++) {//全script要素をチェックして、type属性がimage/svg+xmlならば、中身をSVGとして処理する
+ //全script要素をチェックして、type属性がimage/svg+xmlならば、中身をSVGとして処理する
+ for (var i=0; i < ary.length; i++) {
var hoge = ary[i].type;
- if (ary[i].type === "image/svg+xml") {
+ if (ary[i].type === "image/svg+xml") {
var ait = ary[i].text;
if (sieb_s && ait.match(/<svg/)) {
//ソース内のタグを除去
@@ -69,9 +70,10 @@
if (isMSIE) {
setVMLNameSpace();
var da = {};
- da.obj = []; da.obj[i] = ary[i]; da.num = i + 1; da.content = ait; da.success = true;
+ da.obj = []; da.obj[i] = ary[i]; da.num = i + 1; da.content = ait.replace(/\shref=/g, " target='_top' xlink:href="); da.success = true;
ca(da);
- } else{
+ } else {
+ ait = ait.replace(/\shref=/g, " target='_top' xlink:href=");
var s = textToSVG(ait,ary[i].getAttribute("width"),ary[i].getAttribute("height"));
ary[i].parentNode.insertBefore(s,ary[i]);
}
@@ -185,7 +187,7 @@
//以下、画像を切り取り
trstyle.overflow = "hidden";
var backrs = backr.currentStyle;
- var viewWidth = w > sw ? sw : w, viewHeight = h > sh ? sh : h;
+ var viewWidth = w > sw ? sw : w, viewHeight = h > sh ? sh : h; //ウィンドウ枠の長さを決定する
var bfl = parseFloat(backrs.left), bft = parseFloat(backrs.top);
var bl = -this.vi._tx, bt = -this.vi._ty;
if (bfl !== 0 && !isNaN(bfl)) { //内部の図形にずれが生じたとき(isNaNはIE8でautoがデフォルト値のため)
@@ -314,6 +316,7 @@
try {
getURL(this.emd[n].src,ca,this.emd,n+1);
} catch(e) {stlog.add(e,185);this.next();}
+ } else { //全要素の読み込みが終われば
}
} catch(e) {stlog.add(e,293);this.onumber++;this.next();}
}
@@ -350,7 +353,7 @@
stvsetob(this.children,sw,sh);
this.children = this.transformable = null;
} catch(e){stlog.addd(e,3145)}
-}
+};
STGroupElement.prototype.chset = SVGtoVML.prototype.chset;
//a要素の処理
@@ -422,7 +425,7 @@
} catch(e) {stlog.add(e,236);}
try {
//以下は、テキストの幅であるtextLengthを算出する
- var arr = this.tspan, textLength = 0, fontSize = this.paint.fontSize, atfontSize = 0, fij = /[fijlt.,:;]/g; //fontSizeは親要素の文字サイズ。atfontSizeは各span要素のサイズ。
+ var arr = this.tspan, textLength = 0, fontSize = this.paint.fontSize, atfontSize = 0, fij = /[fijlt.,:;1]/g; //fontSizeは親要素の文字サイズ。atfontSizeは各span要素のサイズ。
for (var i=0,s={dx:0,dy:0},arri=arr.length;i<arri;++i) {
var ari = arr[i];
ari.paint.fset(w,h,ari.transformable);
@@ -543,7 +546,7 @@
this.transformable = NAIBU.transformToCTM(ele,matrix);
return this;
}
-STPath.prototype.set = function shapeset( /*float*/ w, /*float*/ h) {
+STPath.prototype.set = function ( /*float*/ w, /*float*/ h) {
var dat = "";
try {
var dd = this.d
@@ -640,7 +643,7 @@
this.paint.set(w, h, ttm);
dat = this.paint = ttm = this.transformable = this.d = preCom = x = y = x0 = y0 = dx = dy = tma = tmb = tmc = tmd = tme = tmf = w = h = null; //解放
} catch(e) {stlog.add(e,372);}
-}
+};
//QからCに変換
NAIBU.qtoc = function (/*float*/ x, /*float*/ y, /*Array*/ F) {
@@ -952,7 +955,7 @@
}
}
return this;
-}
+};
//デフォルト値のリスト
NAIBU.PaintColor.prototype.defaults = {
fill: "black",
@@ -982,8 +985,8 @@
}
return cache[id];
}
-}
-NAIBU.PaintColor.prototype.getAttribute = function pcgetAttribute( /*string*/ name) {
+};
+NAIBU.PaintColor.prototype.getAttribute = function ( /*string*/ name) {
try {
var element = this.tar;
var style = element.style[name];
@@ -994,20 +997,20 @@
var s = attribute ? attribute.nodeValue : null;
return s;
} catch(e) {stlog.add(e,659); return null;}
-}
+};
//内部プロパティを、styleに設定する
NAIBU.PaintColor.prototype.setStyle = function() {
try {
var tst = this.tar
for (var i in this) {
if ((typeof this[i]) === "string") { //string型以外は除く
- tst.style[name] = this[i];
+ tst.style[i] = this[i];
}
}
} catch(e) {stlog.add(e,899); return "";}
-}
+};
NAIBU.PaintColor.prototype._urlreg = /url\(#([^)]+)/;
-NAIBU.PaintColor.prototype.set = function pcset(/*float*/ w, /*float*/ h, /*Matrix*/ matrix) {
+NAIBU.PaintColor.prototype.set = function (/*float*/ w, /*float*/ h, /*Matrix*/ matrix) {
var el = this.tar;
if (this.fill === "none") {
el.filled = "false";
@@ -1083,7 +1086,7 @@
this.tar.style.cursor = this.cursor;
}
w = h = null;
-}
+};
//色キーワード
NAIBU.PaintColor.prototype.keywords = {
aliceblue: "#F0F8FF",
@@ -1229,9 +1232,9 @@
});
}
return color;
-}
+};
//linearGradient、radialGradient要素を処理
-NAIBU.PaintColor.prototype.gradient = function pcgradient( /*element*/ ele, /*string*/ id, /*Matrix*/ matrix) {
+NAIBU.PaintColor.prototype.gradient = function ( /*element*/ ele, /*string*/ id, /*Matrix*/ matrix) {
var grad = document.getElementById(id);
if (grad) {
var grad2 = grad;
@@ -1339,7 +1342,7 @@
}
stops = type = lengh = color = colors = opacity = null;
return false;
-}
+};
//font属性、関連プロパティを処理する
//PaintColorを継承
@@ -1391,7 +1394,7 @@
tst.style[sname] = ti;
}
}
- } catch(e) {stlog.add(e,899); return "";}
+ } catch(e) {stlog.add(e,1396); return "";}
}
NAIBU.FontStyle.prototype.fset = function( /*float*/ w, /*float*/ h, /*Matrix*/ matrix) {
try{
@@ -1406,6 +1409,7 @@
}
this.writingMode = tts.writingMode;
tts.marginTop = (this.writingMode === "tb-rl") ? "0px" : -parseFloat(tts.fontSize)+ "px";
+ tts.textIndent = "0px";
} catch(e){stlog.add(e,1185);}
}
@@ -1421,33 +1425,35 @@
var coma = tft.match(NAIBU.comaR); //コマンド文字にマッチ translate
var list = tft.match(NAIBU.listR); //カッコ内のリストにマッチ (10 20 30...)
var a,b,c,d,e,f,lis,deg,rad,degli,matri;
- for (var j=0;j<coma.length;j++) {
+ for (var j=0,cli=coma.length;j<cli;j++) {
lis = list[j], com = coma[j];
deg = lis.match(NAIBU.degR);
- rad = parseFloat(deg[0]) / 180 * Math.PI;
degli = deg.length;
if (degli === 6) {
a = parseFloat(deg[0]); b = parseFloat(deg[1]); c = parseFloat(deg[2]); d = parseFloat(deg[3]); e = parseFloat(deg[4]); f = parseFloat(deg[5]);
- } else if (degli === 3) {
- var cx = parseFloat(deg[1]), cy = parseFloat(deg[2]);
- a = Math.cos(rad); b = Math.sin(rad); c = -b; d = a; e = (1-a)*cx-c*cy; f = -b*cx+(1-d)*cy;
- } else if (degli <= 2) {
- switch (com) {
- case "translate":
- a = 1; b = 0; c = 0; d = 1; e = parseFloat(deg[0]); f = parseFloat(deg[1] || 0);
- break;
- case "scale":
- a = parseFloat(deg[0]); b = 0; c = 0; d = parseFloat(deg[1] || deg[0]); e = 0; f = 0;
- break;
- case "rotate":
- a = Math.cos(rad); b = Math.sin(rad); c = -b; d = a; e = 0; f = 0;
- break;
- case "skewX":
- a = 1; b = 0; c = Math.tan(rad); d = 1; e = 0; f = 0;
- break;
- case "skewY":
- a = 1; b = Math.tan(rad); c = 0; d = 1; e = 0; f = 0;
- break;
+ } else {
+ rad = parseFloat(deg[0]) / 180 * Math.PI;
+ if (degli === 3) {
+ var cx = parseFloat(deg[1]), cy = parseFloat(deg[2]);
+ a = Math.cos(rad); b = Math.sin(rad); c = -b; d = a; e = (1-a)*cx-c*cy; f = -b*cx+(1-d)*cy;
+ } else if (degli <= 2) {
+ switch (com) {
+ case "translate":
+ a = 1; b = 0; c = 0; d = 1; e = parseFloat(deg[0]); f = parseFloat(deg[1] || 0);
+ break;
+ case "scale":
+ a = parseFloat(deg[0]); b = 0; c = 0; d = parseFloat(deg[1] || deg[0]); e = 0; f = 0;
+ break;
+ case "rotate":
+ a = Math.cos(rad); b = Math.sin(rad); c = -b; d = a; e = 0; f = 0;
+ break;
+ case "skewX":
+ a = 1; b = 0; c = Math.tan(rad); d = 1; e = 0; f = 0;
+ break;
+ case "skewY":
+ a = 1; b = Math.tan(rad); c = 0; d = 1; e = 0; f = 0;
+ break;
+ }
}
}
matri = new Matrix(a,b,c,d,e,f);
@@ -1458,21 +1464,21 @@
}
} catch(e) {stlog.add(e,816);}
return matrix;
-}
+};
//SVGPointを参照
function Point( /*number*/ x, /*number*/ y) {
this.x = x; this.y = y;
return this;
}
-Point.prototype.matrixTransform = function pmatrixtransform( /*Matrix*/ m) {
+Point.prototype.matrixTransform = function ( /*Matrix*/ m) {
var x = parseInt(m.a * this.x + m.c * this.y + m.e);
var y = parseInt(m.b * this.x + m.d * this.y + m.f);
if (-1 < x && x < 1) {x=1;}
if (-1 < y && y < 1) {y=1;}
var s = new Point(x,y);
return s;
-}
+};
//Pointのリスト。一括で処理できる
function PList( /*Array*/ d) {
@@ -1502,14 +1508,14 @@
return this;
}
//Matrix同士の積を算出
-Matrix.prototype.multiply = function matrixmultiply( /*Matrix*/ m) {
+Matrix.prototype.multiply = function ( /*Matrix*/ m) {
var s = new Matrix(this.a * m.a + this.c * m.b,this.b * m.a + this.d * m.b,this.a * m.c + this.c * m.d,this.b * m.c + this.d * m.d,this.a * m.e + this.c * m.f + this.e,this.b * m.e + this.d * m.f + this.f);
return s;
-}
+};
//行列式
Matrix.prototype.determinant = function() {
return (this.a * this.d - this.b * this.c);
-}
+};
//SVGViewSpecを参照
function STViewSpec( /*element*/ ele) {
@@ -1748,12 +1754,12 @@
"px": 5,
"%": 2
}
-STLength.prototype.newValueSpecifiedUnits = function stlengthnvsu( /*number*/ ut, /*number*/ value) {
+STLength.prototype.newValueSpecifiedUnits = function ( /*number*/ ut, /*number*/ value) {
this.unitType = ut;
this.value = value * this._n[ut-1];
this.valueInSpecifiedUnits = value;
this._n[1] = 0.01; //初期化
-}
+};
//XLink言語を処理
NAIBU.XLink = function( /*element*/ ele) {
this.tar = ele;
@@ -1808,8 +1814,7 @@
} else{
uri.match(/#(.+)$/);
this.resource = document.getElementById(RegExp.$1);
- var dc = this.resource.cloneNode(true);
- this.tar.appendChild(dc);
+ this.tar.innerHTML = this.resource.outerHTML.replace(/<\/?v\:(fill|stroke)>/g, "");
}
break;
case "new":
Property changes on: trunk/sie.js
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/04x/040/sie.js:812-829
/branches/04x/041/sie.js:891-923
/branches/04x/042/sie.js:927-967
/branches/04x/043/sie.js:969-1013
/branches/04x/044/sie.js:1015-1067
/branches/04x/045/sie.js:1069-1078
/branches/04x/046/sie.js:1080-1129
/branches/04x/047/sie.js:1131-1164
/branches/04x/048/sie.js:1166-1180
/branches/04x/sie.js:830-1181
/branches/05x/050/sie.js:1183-1201
/branches/05x/sie.js:1183-1209
+ /branches/04x/040/sie.js:812-829
/branches/04x/041/sie.js:891-923
/branches/04x/042/sie.js:927-967
/branches/04x/043/sie.js:969-1013
/branches/04x/044/sie.js:1015-1067
/branches/04x/045/sie.js:1069-1078
/branches/04x/046/sie.js:1080-1129
/branches/04x/047/sie.js:1131-1164
/branches/04x/048/sie.js:1166-1180
/branches/04x/sie.js:830-1181
/branches/05x/050/sie.js:1183-1201
/branches/05x/051/sie.js:1207-1323
/branches/05x/sie.js:1183-1328