svnno****@sourc*****
svnno****@sourc*****
2009年 3月 11日 (水) 23:18:38 JST
Revision: 1065 http://svn.sourceforge.jp/view?root=sie&view=rev&rev=1065 Author: dhrname Date: 2009-03-11 23:18:38 +0900 (Wed, 11 Mar 2009) Log Message: ----------- radialGradient要素のcx属性とcy属性とr属性に対応 Modified Paths: -------------- branches/04x/044/sie.js Modified: branches/04x/044/sie.js =================================================================== --- branches/04x/044/sie.js 2009-03-11 13:14:22 UTC (rev 1064) +++ branches/04x/044/sie.js 2009-03-11 14:18:38 UTC (rev 1065) @@ -1256,15 +1256,26 @@ ele.setAttribute("type", "gradientTitle"); ele.setAttribute("focus", "100%"); ele.setAttribute("focusposition", "0.5 0.5"); - var degis = (this.tar.getAttribute("path")+"").match(/[0-9\-]+/g); + var cx = parseFloat((grad.getAttribute("cx") || "0.5").replace(/%/, "")); + var cy = parseFloat((grad.getAttribute("cy") || "0.5").replace(/%/, "")); + var r = rx = ry = parseFloat((grad.getAttribute("r") || "0.5").replace(/%/, "")); var el = this.w, et = this.h, er = 0, eb = 0; - for (var i=0,degisli=degis.length;i<degisli;i+=2) { - var nx = parseInt(degis[i]), ny = parseInt(degis[i+1]); - el = el > nx ? nx : el; - et = et > ny ? ny : et; - er = er > nx ? er : nx; - eb = eb > ny ? eb : ny; + var units = grad.getAttribute("gradientUnits"); + if (!units || units === "objectBoundingBox") { + //%の場合は小数点に変換(10% -> 0.1) + cx = cx > 1 ? cx/100 : cx; cy = cy > 1 ? cy/100 : cy; r = r > 1 ? r/100 : r; + var degis = (this.tar.getAttribute("path")+"").match(/[0-9\-]+/g); + for (var i=0,degisli=degis.length;i<degisli;i+=2) { + var nx = parseInt(degis[i]), ny = parseInt(degis[i+1]); + el = el > nx ? nx : el; + et = et > ny ? ny : et; + er = er > nx ? er : nx; + eb = eb > ny ? eb : ny; + } + cx = cx*(er - el) + el; cy = cy*(eb - et) + et; rx = r*(er - el); ry = r*(eb - et) } + el = cx - rx; et = cy - ry; er = cx + rx; eb = cy + ry; + alert(el+" "+et+" "+er+" "+eb); var outline = document.getElementById("_NAIBU_outline"); var background = document.createElement("div"), gradient = document.createElement("div"); background.style.position = "absolute"; gradient.style.position = "absolute";