OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3 .org/1999/xlink" width="400" height="400" viewBox="0 0 430 430" style="border: 1 px solid black;"> | |
3 <g> | |
4 <text id="line1" x="10" y="70" font-family="Arial" font-size="10" fill="blac k">Hello World. Hello, SVG.</text> | |
5 </g> | |
6 <g transform="translate(100,100)"> | |
7 <text id="line2" x="10" y="70" font-family="Arial" font-size="10" fill="blac k">Hello World. Hello, SVG.</text> | |
8 </g> | |
9 <g transform="translate(200,200)"> | |
10 <text id="line3" x="10" y="70" font-family="Arial" font-size="10" fill="blac k">Hello World. Hello, SVG.</text> | |
11 </g> | |
12 </svg> | |
13 <script src="../../resources/js-test.js"></script> | |
14 <script src="resources/SelectionTestCase.js"></script> | |
15 <script type="text/javascript"> | |
16 var element = document.getElementById('line1'); | |
17 var endPos = element.getEndPositionOfChar(10); | |
18 endPos.y += (element.getBBox().height * 1.5); | |
19 var absEndPos = toAbsoluteCoordinates(endPos, element); | |
20 selectTextFromCharToPoint({ id: 'line1', offset: 0 }, absEndPos, { start: "0", e nd: "11" }); | |
21 selectTextFromCharToPoint({ id: 'line1', offset: 6 }, absEndPos, { start: "6", e nd: "11" }); | |
22 | |
23 endPos = element.getEndPositionOfChar(23); | |
24 endPos.y += (element.getBBox().height * 1.5); | |
25 absEndPos = toAbsoluteCoordinates(endPos, element); | |
26 selectTextFromCharToPoint({ id: 'line1', offset: 12 }, absEndPos, { start: "12", end: "24" }); | |
27 | |
28 element = document.getElementById('line2'); | |
29 endPos = element.getEndPositionOfChar(10); | |
30 endPos.y += (element.getBBox().height * 1.5); | |
31 absEndPos = toAbsoluteCoordinates(endPos, element); | |
32 selectTextFromCharToPoint({ id: 'line2', offset: 0 }, absEndPos, { start: "0", e nd: "11" }); | |
33 | |
34 endPos = element.getEndPositionOfChar(10); | |
fs
2016/02/12 17:05:42
This test would be easier to follow if you wrapped
hyunjunekim2
2016/02/15 13:34:20
Done.
| |
35 endPos.y += (element.getBBox().height * 1.5); | |
36 absEndPos = toAbsoluteCoordinates(endPos, element); | |
37 selectTextFromCharToPoint({ id: 'line2', offset: 6 }, absEndPos, { start: "6", e nd: "11" }); | |
38 | |
39 endPos = element.getEndPositionOfChar(23); | |
40 endPos.y += (element.getBBox().height * 1.5); | |
41 absEndPos = toAbsoluteCoordinates(endPos, element); | |
42 selectTextFromCharToPoint({ id: 'line2', offset: 12 }, absEndPos, { start: "12", end: "24" }); | |
43 | |
44 element = document.getElementById('line3'); | |
45 endPos = element.getEndPositionOfChar(10); | |
46 endPos.y += (element.getBBox().height * 1.5); | |
47 absEndPos = toAbsoluteCoordinates(endPos, element); | |
48 selectTextFromCharToPoint({ id: 'line3', offset: 0 }, absEndPos, { start: "0", e nd: "11" }); | |
49 | |
50 endPos = element.getEndPositionOfChar(10); | |
51 endPos.y += (element.getBBox().height * 1.5); | |
52 absEndPos = toAbsoluteCoordinates(endPos, element); | |
53 selectTextFromCharToPoint({ id: 'line3', offset: 6 }, absEndPos, { start: "6", e nd: "11" }); | |
54 | |
55 endPos = element.getEndPositionOfChar(23); | |
56 endPos.y += (element.getBBox().height * 1.5); | |
57 absEndPos = toAbsoluteCoordinates(endPos, element); | |
58 selectTextFromCharToPoint({ id: 'line3', offset: 12 }, absEndPos, { start: "12", end: "24" }); | |
59 </script> | |
OLD | NEW |