svnno****@sourc*****
svnno****@sourc*****
2010年 4月 20日 (火) 23:00:58 JST
Revision: 1798
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1798
Author: dhrname
Date: 2010-04-20 23:00:56 +0900 (Tue, 20 Apr 2010)
Log Message:
-----------
Modified Paths:
--------------
branches/ufltima/dom/svg.js
Modified: branches/ufltima/dom/svg.js
===================================================================
--- branches/ufltima/dom/svg.js 2010-04-20 13:34:48 UTC (rev 1797)
+++ branches/ufltima/dom/svg.js 2010-04-20 14:00:56 UTC (rev 1798)
@@ -2747,26 +2747,38 @@
} else {
var s = this.ownerDocument.createSVGPoint(), t = this.firstChild;
var x = y = 0;
- var h = this.getSubStringLength(0, charnum), n = m = 0, xory;
+ var n = m = 0, xory;
var isYokogaki = ((style.getPropertyValue("writing-mode")) === "lr-tb") ? true : false;
- if (isYokogaki) {
- x = h;
- xory = "y";
- } else {
- y = h;
- xory = "x";
- }
var txb = this.x.baseVal, tyb = this.y.baseVal;
if (txb.numberOfItems > charnum) {
x = txb.getItem(charnum).value;
} else {
x = txb.getItem(txb.numberOfItems-1).value;
+ if (isYokogaki) {
+ x += this.getSubStringLength(txb.numberOfItems-1, charnum);
+ }
}
if (tyb.numberOfItems > charnum) {
y = tyb.getItem(charnum).value;
} else {
y = tyb.getItem(tyb.numberOfItems-1).value;
+ if (!isYokogaki) {
+ y += this.getSubStringLength(tyb.numberOfItems-1, charnum);
+ }
}
+ s.x = x;
+ s.y = y;
+ while (t) {
+ if (t.nodeName === "#text") {
+ m += t.length;
+ } else if (t.localName === "tspan"){
+ var p = m;
+ m += t.getNumberOfChars();
+ if (m > charnum) {
+ s = t.getEndPositionOfChar(charnum-p);
+ }
+ }
+ }
return s;
}
};