Debian Codegraph @

samples/tests/spec/interactivity/cursor3.svg

raw
1 <?xml version="1.0" standalone="no"?>
2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
3 "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
4
5 <!--
6
7 Licensed to the Apache Software Foundation (ASF) under one or more
8 contributor license agreements. See the NOTICE file distributed with
9 this work for additional information regarding copyright ownership.
10 The ASF licenses this file to You under the Apache License, Version 2.0
11 (the "License"); you may not use this file except in compliance with
12 the License. You may obtain a copy of the License at
13
14 http://www.apache.org/licenses/LICENSE-2.0
15
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
21
22 -->
23 <!-- ========================================================================= -->
24 <!-- Tests support for the cursor property. -->
25 <!-- -->
26 <!-- @author [email protected] -->
27 <!-- @version $Id$ -->
28 <!-- ========================================================================= -->
29
30 <?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
31
32 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
33 id="body" width="450" height="500" viewBox="0 0 450 500" >
34
35 <text class="title" x="50%" y="50">Custom Cursor Image Test</text>
36
37 <script type="text/ecmascript"><![CDATA[
38
39 var hitCount = document.getElementById("hitCount");
40 var hitCountText = hitCount.firstChild;
41 var curHitCount = 0;
42
43 function targetHit() {
44 curHitCount++;
45 hitCountText.data = "" + curHitCount;
46 }
47
48 var hitTargetArea = document.getElementById("hitTargetArea");
49
50 function hotTarget() {
51 hitTargetArea.setAttribute("fill", "gold");
52 }
53
54 function coldTarget() {
55 hitTargetArea.setAttribute("fill", "#eeeeee");
56 }
57
58 var cursorRef = document.getElementById("refCenterSmall");
59
60 function changeCursor(evt) {
61 var target = evt.target;
62 var id = target.getAttribute("id");
63 var cursorId = "cursor" + id;
64 hitTargetArea.setAttribute("cursor", "url(#" + cursorId + "),crosshair");
65
66
67 cursorRef.setAttribute("visibility", "hidden");
68 cursorRef = document.getElementById("ref" + id);
69 cursorRef.setAttribute("visibility", "visible");
70 }
71 ]]></script>
72
73 <text class="label" x="50%" y="125" text-anchor="middle">Try and hit the small black dot
74 <tspan x="50%" dy="+1.4em">after selecting your cursor</tspan></text>
75
76 <g id="hitTargetArea" fill="#eeeeee" transform="translate(175, 150)" shape-rendering="crispEdges" cursor="url(#cursorCenterSmall),crosshair" >
77 <rect x="0" y="0" width="100" height="100" stroke="black"/>
78 <rect x="44" y="44" width="12" height="12" fill="black"/>
79 <rect x="45" y="45" width="10" height="10" fill="#eeeeee" />
80 <rect x="49" y="40" width="2" height="20" fill="black" />
81 <rect y="49" x="40" height="2" width="20" fill="black" />
82 <!-- <line x1="40" y1="50" x2="60" y2="50" stroke="black" />
83 <line y1="40" x1="50" y2="60" x2="50" stroke="black" /> -->
84 <rect x="49" y="49" width="2" height="2" fill="black"
85 onclick="targetHit()"
86 onmouseover="hotTarget()"
87 onmouseout="coldTarget()"/>
88 </g>
89
90 <text class="label" text-anchor="middle" x="50%" y="270" fill="crimson">Hit Count : <tspan id="hitCount">0</tspan></text>
91
92 <text class="label" text-anchor="middle" x="25%" y="340" >Cursor Selection</text>
93
94 <g onclick="changeCursor(evt)" transform="translate(57.5, 400)">
95 <use xlink:href="#CenterSmall" />
96 <use xlink:href="#Center" x="32"/>
97 <use xlink:href="#CenterBig" x="90"/>
98 </g>
99
100 <text class="label" text-anchor="middle" x="75%" y="340" >Current Target Area Cursor</text>
101
102 <g transform="translate(337.5, 394)" visibility="hidden">
103 <use id="refCenter" xlink:href="#Center" />
104 <use id="refCenterSmall" xlink:href="#CenterSmall" visibility="visible"/>
105 <use id="refCenterBig" xlink:href="#CenterBig" />
106 </g>
107
108 <defs>
109 <image id="Center" xlink:href="../../resources/images/hotSpotCenter.png" x="-16" y="-16" width="32" height="32"/>
110 <image id="CenterSmall" xlink:href="../../resources/images/hotSpotCenterSmall.png" x="-8" y="-8" width="16" height="16"/>
111 <image id="CenterBig" xlink:href="../../resources/images/hotSpotCenterBig.png" x="-32" y="-32" width="64" height="64"/>
112
113 <cursor id="cursorCenter" x="16" y="16" xlink:href="../../resources/images/hotSpotCenter.png"/>
114 <cursor id="cursorCenterSmall" x="8" y="8" xlink:href="../../resources/images/hotSpotCenterSmall.png"/>
115 <cursor id="cursorCenterBig" x="32" y="32" xlink:href="../../resources/images/hotSpotCenterBig.png"/>
116 </defs>
117
118 </svg>