OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <style> |
| 3 text { |
| 4 font: 10px Arial; |
| 5 } |
| 6 </style> |
| 7 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlin
k" width="400" height="400" style="border: 1px solid black;"> |
| 8 <g> |
| 9 <text id="firsttext" x="130" y="30">Happy, Web</text> |
| 10 <text id="middletext" x="130" y="50">Happy, SVG</text> |
| 11 <text id="endtext" x="130" y="70">Happy, ;)link</text> |
| 12 </g> |
| 13 <text id="line" x="130" y="150">Hello World. Hello, SVG.</text> |
| 14 </svg> |
| 15 <script src="../../resources/js-test.js"></script> |
| 16 <script src="resources/SelectionTestCase.js"></script> |
| 17 <script type="text/javascript"> |
| 18 function getEndPosition(id, offset, gap) { |
| 19 var element = document.getElementById(id); |
| 20 var endPos = element.getEndPositionOfChar(offset); |
| 21 endPos.x += gap.x; |
| 22 endPos.y += gap.y; |
| 23 var absEndPos = toAbsoluteCoordinates(endPos, element); |
| 24 return absEndPos; |
| 25 } |
| 26 |
| 27 selectTextFromCharToPoint({ id: 'line', offset: 0 }, { x: 400, y: 400 }, { start
ElementId: 'line', start: "0", endElementId: "line", end: "24" }); |
| 28 selectTextFromCharToPoint({ id: 'line', offset: 7 }, { x: 400, y: 400 }, { start
ElementId: "line", start: "7", endElementId: "line", end: "24" }); |
| 29 |
| 30 var absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 0}); |
| 31 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem
entId: 'firsttext', start: "0", endElementId: "firsttext", end: "4"}); |
| 32 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 10}); |
| 33 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem
entId: 'firsttext', start: "0", endElementId: "middletext", end: "4"}); |
| 34 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 20}); |
| 35 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem
entId: 'firsttext', start: "0", endElementId: "middletext", end: "4"}); |
| 36 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 30}); |
| 37 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem
entId: 'firsttext', start: "0", endElementId: "endtext", end: "4"}); |
| 38 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 40}); |
| 39 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem
entId: 'firsttext', start: "0", endElementId: "endtext", end: "4"}); |
| 40 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 50}); |
| 41 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem
entId: 'firsttext', start: "0", endElementId: "endtext", end: "4"}); |
| 42 |
| 43 </script> |
OLD | NEW |