svnno****@sourc*****
svnno****@sourc*****
2009年 9月 12日 (土) 23:45:23 JST
Revision: 1241 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1241 Author: dhrname Date: 2009-09-12 23:45:23 +0900 (Sat, 12 Sep 2009) Log Message: ----------- set要素の実装をやめる Modified Paths: -------------- branches/05x/051/sie.js Modified: branches/05x/051/sie.js =================================================================== --- branches/05x/051/sie.js 2009-09-12 14:40:16 UTC (rev 1240) +++ branches/05x/051/sie.js 2009-09-12 14:45:23 UTC (rev 1241) @@ -92,7 +92,6 @@ } //他のページに移動する際に起動 function unsvgtovml() { - clearInterval(NAIBU.time); NAIBU = stlog = STLog = null; } @@ -232,7 +231,7 @@ //chset childNodesで要素を作成していく SVGtoVML.prototype.chset = function _s_chset( /*element*/ ele, /*Matrix*/ matrix, /*float*/w, /*float*/h){ var nods = ele.childNodes, s = null; - var name = "group|shape|defs|STOP|fill|stroke|DIV|SPAN|A|image|rect|USE|set", gname = "DIV|group"; //要素名に合致させる文字列 + var name = "group|shape|defs|STOP|fill|stroke|DIV|SPAN|A|image|rect|USE", gname = "DIV|group"; //要素名に合致させる文字列 var cmatrix = matrix; //子要素に継がせるCTM var te = nods[0]; if (te !== void 0) { @@ -278,8 +277,6 @@ cmatrix = s.transformable; } else if (te.nodeName === "image") { s = new STImage(te, matrix, w, h); - } else if (te.nodeName === "set") { - s = new STSetElement(te, matrix, w, h); } if (s) { this.children[this.children.length] = s; @@ -319,7 +316,6 @@ getURL(this.emd[n].src,ca,this.emd,n+1); } catch(e) {stlog.add(e,185);this.next();} } else { //全要素の読み込みが終われば - EventCaputerStart(); //イベントを開始させる } } catch(e) {stlog.add(e,293);this.onumber++;this.next();} } @@ -1828,157 +1824,6 @@ } catch(e) {stlog.add(e,17155);} } -//SMIL言語のset要素を参照 -function STSetElement( /*element*/ ele, /*Matrix*/ matrix, w, h) { - this.tar = ele; - var begin = new Date(), end = new Date(); - begin.synchParser(ele.getAttribute("begin")); - end.synchParser(ele.getAttribute("end")); - begin.indefinite = false; - end.indefinite = false; - this.to = ele.getAttribute("to") || ""; - this.attrName = ele.getAttribute("attributeName"); - this.transformable = matrix; - this.beginEvent = begin; this.endEvent = end; - this.currentTime = 0; - this.width = w; this.height = h; - return this; -} -//timeLineはアニメーションのタイムラインとして、フレームを再生する際に使用 -NAIBU.timeLine = []; -STSetElement.prototype.set = function(sw, sh) { - this.w = sw; this.h = sh; - try{ - if (this.beginEvent.event !== "") { - var tb = this.beginEvent; - tb.indefinite = true; //これにより、イベントが起きるまで作動を待たせる - this.tar.parentNode.attachEvent("on" +tb.event,(function(){ - tb.indefinite = false; - })); - } - if (this.endEvent.event !== "") { - var te = this.endEvent; - te.indefinite = true; - this.tar.parentNode.attachEvent("on" +te.event,(function(){ - te.indefinite = false; - })); - } - NAIBU.timeLine[NAIBU.timeLine.length] = this; - } catch (e){stlog.add(e,18590)} -} -STSetElement.prototype.frame = function() { - if (this.beginEvent.isFired(this.currentTime) && !this.endEvent.isFired(this.currentTime)) { - var target = this.tar.parentNode; //変更される対象要素 - alert(""); - this.children = []; - if (target.nodeName === "group") { - this.chset(target, this.transformable, this.width, this.height); - } else { - this.chset({childNodes:[target]}, (new Matrix(1,0,0,1,0,0)), this.width, this.height); - } - stvsetob(this.children,this.w,this.h); - } else if(this.endEvent.isFired(this.currentTime)){ - this.beginEvent.indefinite = true; - this.endEvent.indefinite = true; - } - this.currentTime += 100; -} -STSetElement.prototype.chset = SVGtoVML.prototype.chset; - -//setClockValueメソッド。同期させるSMIL言語に使う -Date.prototype.setClockValue = function(str) { - var n = str.indexOf(":"), d = 0, h = 0, min = 0, s = 0; - if (n === -1) { //単位つきTimecount-Valueならば - d = parseFloat(str); - if (isNaN(d)) { - throw new Error("文法エラーです"); - } - var tani = str.match(/[a-z]+/); - tani = tani ? tani : "s"; - d *= this._tani[tani]; - } else { - if (n !== str.lastIndexOf(":")) { //Full-clock-Valueならば - var fullClock = str.match(/(\d+)\:(\d\d)\:([\.\d]+)/); - h = RegExp.$1; min = RegExp.$2; s = RegExp.$3; - } else { - partialClock = str.match(/(\d\d)\:([\.\d]+)/); - min = RegExp.$1; s = RegExp.$2; - } - d = parseInt(h,10)*3600000 + parseInt(min,10)*6000 + parseFloat(s,10)*1000; - } - this.clockValue = d; -} -Date.prototype._tani = {"h":3600000, "min":6000, "s":1000, "ms":1}; -//isFiredメソッド。イベントが発火されたかどうか。返す値はBoolean型。 -Date.prototype.isFired = function(s) { - if (s >= this.clockValue && !this.indefinite) { - return true; - } else { - return false; - } -} -//synchParserメソッド。begin属性の値などの解析を行う。 -Date.prototype.synchParser = function(str) { - var mode = 0, pool = "", midValue = null, idValue = null; - for (var i=0,sti=str.length;i<sti;++i) { - var stri = str.charAt(i); - switch (mode) { - case 0: - if ("+-".indexOf(stri) !== -1 || /[0-9]/.test(stri)) { - mode = 1; - } else { - pool += stri; - mode = 12; - } - break; - case 1: - break; - case 2: - if ("begin|end".indexOf(midValue) !== -1) { - mode = 3; - } else if (midValue.indexOf("accessKey(") === 0) { - mode = 4; - } else if (midValue.indexOf("repeat(") === 0) { - mode = 5; - } - case 3: - case 4: - case 5: - pool += stri; - break; - case 12: - if (stri === ".") { - idValue = pool; - pool = ""; - break; - } else if ("+-".indexOf(stri) !== -1) { //符号ならば - midValue = pool; - pool = ""; - mode = 2; - } - pool += stri; - break; - } - } - if (mode === 1) { - this.setClockValue(str); - } else if (mode === 12) { - midValue = pool; - this.clockValue = 0; - } else { - this.setClockValue(pool); - } - this.id = idValue; - this.mode = mode; - this.event = midValue || pool; -} -function EventCaputerStart(){ -NAIBU.time = setInterval((function() { - for (var i=0,ntli=NAIBU.timeLine.length;i<ntli;++i) { - NAIBU.timeLine[i].frame(); - } -}),41); -} function utf16( /*string*/ s) { return unescape(s); } @@ -2073,8 +1918,7 @@ .replace(/<use\s/g, "<use /><v:group ") .replace(/\/use>/g, "/v:group>") .replace(/<defs(?=\s|>)/g, "<dn:defs") - .replace(/\/defs>/g, "/dn:defs>") - .replace(/<set\s/g, "<dn:set "); + .replace(/\/defs>/g, "/dn:defs>"); var ob = document.createElement("v:group"); var obst = ob.style; ob.innerHTML = dc;