svnno****@sourc*****
svnno****@sourc*****
2009年 9月 18日 (金) 19:40:45 JST
Revision: 1267 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1267 Author: dhrname Date: 2009-09-18 19:40:44 +0900 (Fri, 18 Sep 2009) Log Message: ----------- functionを一部、無名オブジェクトとして処理 Modified Paths: -------------- branches/05x/051/sie.js Modified: branches/05x/051/sie.js =================================================================== --- branches/05x/051/sie.js 2009-09-17 13:51:29 UTC (rev 1266) +++ branches/05x/051/sie.js 2009-09-18 10:40:44 UTC (rev 1267) @@ -347,12 +347,12 @@ } catch(e){stlog.add(e,3144);} return this; } -STGroupElement.prototype.set = function (sw,sh) { +STGroupElement.prototype.set = (function (sw,sh) { try{ stvsetob(this.children,sw,sh); this.children = this.transformable = null; } catch(e){stlog.addd(e,3145)} -} +}); STGroupElement.prototype.chset = SVGtoVML.prototype.chset; //a要素の処理 @@ -545,7 +545,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 @@ -642,7 +642,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) { @@ -925,7 +925,7 @@ //色のキーワード //PaintColor 色、線などをすべてコントロール -NAIBU.PaintColor = function( /*element*/ ele) { +NAIBU.PaintColor = (function( /*element*/ ele) { if (ele) { this.tar = ele; var defaults = this.defaults; @@ -954,7 +954,7 @@ } } return this; -} +}); //デフォルト値のリスト NAIBU.PaintColor.prototype.defaults = { fill: "black", @@ -972,7 +972,7 @@ //キャッシュ用 NAIBU.PaintColor.prototype.cache = {}; //親コンテナ要素のPaintColorオブジェクトを返す -NAIBU.PaintColor.prototype.getParent = function( /*element*/ ele) { +NAIBU.PaintColor.prototype.getParent = (function( /*element*/ ele) { var parent = ele.parentNode; if (parent.tagName !== "group" && parent.tagName !== "A") { return null; @@ -984,8 +984,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]; @@ -996,9 +996,9 @@ var s = attribute ? attribute.nodeValue : null; return s; } catch(e) {stlog.add(e,659); return null;} -} +}); //内部プロパティを、styleに設定する -NAIBU.PaintColor.prototype.setStyle = function() { +NAIBU.PaintColor.prototype.setStyle = (function() { try { var tst = this.tar for (var i in this) { @@ -1007,9 +1007,9 @@ } } } 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"; @@ -1085,7 +1085,7 @@ this.tar.style.cursor = this.cursor; } w = h = null; -} +}); //色キーワード NAIBU.PaintColor.prototype.keywords = { aliceblue: "#F0F8FF", @@ -1221,19 +1221,19 @@ yellowgreen: "#9ACD32" }; //<color>をVML用に変換 -NAIBU.PaintColor.prototype.color = function( /*string*/ color) { +NAIBU.PaintColor.prototype.color = (function( /*string*/ color) { if (this.keywords[color]) { return this.keywords[color]; } if (color.indexOf("%", 5) > 0) { // %を含むrgb形式の場合 - return color.replace(/[\d.]+%/g, function(s) { + return color.replace(/[\d.]+%/g, (function(s) { return Math.round(2.55 * parseFloat(s)); - }); + })); } 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; @@ -1341,7 +1341,7 @@ } stops = type = lengh = color = colors = opacity = null; return false; -} +}); //font属性、関連プロパティを処理する //PaintColorを継承 @@ -1417,7 +1417,7 @@ NAIBU.comaR = /[A-Za-z]+(?=\s*\()/g; NAIBU.listR = /\([^\)]+\)/g; NAIBU.degR = /[\-\d\.e]+/g; -NAIBU.transformToCTM = function ( /*element*/ ele, /*Matrix*/ matrix) { +NAIBU.transformToCTM = (function ( /*element*/ ele, /*Matrix*/ matrix) { try { var tft = ele.getAttribute("transform"); if (tft) { @@ -1461,21 +1461,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) { @@ -1505,14 +1505,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() { +Matrix.prototype.determinant = (function() { return (this.a * this.d - this.b * this.c); -} +}); //SVGViewSpecを参照 function STViewSpec( /*element*/ ele) { @@ -1751,12 +1751,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;