svnno****@sourc*****
svnno****@sourc*****
2010年 4月 6日 (火) 23:12:00 JST
Revision: 1781 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1781 Author: dhrname Date: 2010-04-06 23:12:00 +0900 (Tue, 06 Apr 2010) Log Message: ----------- 1, unloadの後処理を追加 2, circle要素を実装 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-04-05 14:45:02 UTC (rev 1780) +++ branches/ufltima/dom/svg.js 2010-04-06 14:12:00 UTC (rev 1781) @@ -1223,6 +1223,7 @@ var backdown = bt + viewHeight + 1; trstyle.clip = "rect(" +bt+ "px " +backright+ "px " +backdown+ "px " +bl+ "px)"; alert((new Date()).getTime() - dew.getTime()); + doc = str = fi = attr = null; return s; }; objei.getSVGDocument(); @@ -2283,7 +2284,7 @@ list = ["m",x,y, "l",x,yh, xw,yh, xw,y, "x e"]; } //以下は、配列listそのものをCTMで座標変換していく処理 - var par = tar.ownerSVGElement, ctm = tar.getScreenCTM(); + var par = tar.ownerDocument.documentElement, ctm = tar.getScreenCTM(); for (var i=0, lili=list.length;i<lili;) { if (isNaN(list[i])) { //コマンド文字は読み飛ばす ++i; @@ -2316,6 +2317,41 @@ /*readonly SVGAnimatedLength*/ this.cx = new SVGAnimatedLength(); /*readonly SVGAnimatedLength*/ this.cy = new SVGAnimatedLength(); /*readonly SVGAnimatedLength*/ this.r = new SVGAnimatedLength(); + this.addEventListener("DOMNodeInserted", function(evt){ + if (evt.eventPhase === Event.BUBBLING_PHASE) { + return; //強制終了させる + } + this.addEventListener("DOMNodeInsertedIntoDocument", function(evt) { + var tar = evt.target; + var cx = this.cx.baseVal.value, cy = this.cy.baseVal.value, rx = ry = this.r.baseVal.value; + var top = cy - ry, left = cx - rx, bottom = cy + ry, right = cx + rx; + var rrx = rx * 0.55228, rry = ry * 0.55228; + var list = ["m", cx,top, "c", cx-rrx,top, left,cy-rry, left,cy, left,cy+rry, cx-rrx,bottom, cx,bottom, cx+rrx,bottom, right,cy+rry, right,cy, right,cy-rry, cx+rrx,top, cx,top, "x e"]; + //以下は、配列listそのものをCTMで座標変換していく処理 + var par = tar.ownerDocument.documentElement, ctm = tar.getScreenCTM(); + for (var i=0, lili=list.length;i<lili;) { + if (isNaN(list[i])) { //コマンド文字は読み飛ばす + ++i; + continue; + } + var p = par.createSVGPoint(list[i], list[i+1]); + var pmt = p.matrixTransform(ctm); + ++i; + list[i] = pmt.x; + ++i; + list[i] = pmt.y; + p = pmt = null; + } + var dat = list.join(" "); + //VMLに結び付けていく + var ele = tar._tar, vi = tar.ownerDocument.documentElement.viewport; + var w = vi.width, h = vi.hight; + ele.path = dat; + ele.coordsize = w + " " + h; + list = dat = ele = null; + dat = list = pl = plm = w = h = null; //解放 + }, false); + }, false); return this; }; SVGCircleElement.constructor = SVGElement; @@ -2327,6 +2363,13 @@ /*readonly SVGAnimatedLength*/ this.cy = new SVGAnimatedLength(); /*readonly SVGAnimatedLength*/ this.rx = new SVGAnimatedLength(); /*readonly SVGAnimatedLength*/ this.ry = new SVGAnimatedLength(); + this.addEventListener("DOMNodeInserted", function(evt){ + if (evt.eventPhase === Event.BUBBLING_PHASE) { + return; //強制終了させる + } + this.addEventListener("DOMNodeInsertedIntoDocument", function(evt) { + }, false); + }, false); return this; }; SVGEllipseElement.constructor = SVGElement; @@ -2338,6 +2381,13 @@ /*readonly SVGAnimatedLength*/ this.y1 = new SVGAnimatedLength(); /*readonly SVGAnimatedLength*/ this.x2 = new SVGAnimatedLength(); /*readonly SVGAnimatedLength*/ this.y2 = new SVGAnimatedLength(); + this.addEventListener("DOMNodeInserted", function(evt){ + if (evt.eventPhase === Event.BUBBLING_PHASE) { + return; //強制終了させる + } + this.addEventListener("DOMNodeInsertedIntoDocument", function(evt) { + }, false); + }, false); return this; }; SVGLineElement.constructor = SVGElement; @@ -2347,6 +2397,13 @@ SVGElement.apply(this, arguments); //interface SVGAnimatedPoints /*readonly SVGPointList*/ this.animatedPoints = this.points = new SVGPointList(); + this.addEventListener("DOMNodeInserted", function(evt){ + if (evt.eventPhase === Event.BUBBLING_PHASE) { + return; //強制終了させる + } + this.addEventListener("DOMNodeInsertedIntoDocument", function(evt) { + }, false); + }, false); return this; }; SVGPolylineElement.constructor = SVGElement; @@ -2356,6 +2413,13 @@ SVGElement.apply(this, arguments); //interface SVGAnimatedPoints /*readonly SVGPointList*/ this.animatedPoints = this.points = new SVGPointList(); + this.addEventListener("DOMNodeInserted", function(evt){ + if (evt.eventPhase === Event.BUBBLING_PHASE) { + return; //強制終了させる + } + this.addEventListener("DOMNodeInsertedIntoDocument", function(evt) { + }, false); + }, false); return this; }; SVGPolygonElement.constructor = SVGElement; @@ -3168,4 +3232,11 @@ window['on'+evt] = lis; } }; -NAIBU.addEvent("load", GetSVGDocument); \ No newline at end of file +function unsvgtovml() { + try { + window = null; + NAIBU = stlog = STLog = document = null; + } catch(e) {} +} +NAIBU.addEvent("load", GetSVGDocument); +NAIBU.addEvent("unload", unsvgtovml); \ No newline at end of file