| 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 Hot Spot 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("refNW"); |
| 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 |
|
| 72 |
]]></script> |
| 73 |
|
| 74 |
<text class="label" x="50%" y="125" text-anchor="middle">Try and hit the small black dot |
| 75 |
<tspan x="50%" dy="+1.4em">after selecting your cursor</tspan></text> |
| 76 |
|
| 77 |
<g id="hitTargetArea" fill="#eeeeee" transform="translate(175, 150)" shape-rendering="crispEdges" cursor="url(#cursorNW),crosshair" > |
| 78 |
<rect x="0" y="0" width="100" height="100" stroke="black"/> |
| 79 |
<rect x="44" y="44" width="12" height="12" fill="black"/> |
| 80 |
<rect x="45" y="45" width="10" height="10" fill="#eeeeee" /> |
| 81 |
<rect x="49" y="40" width="2" height="20" fill="black" /> |
| 82 |
<rect y="49" x="40" height="2" width="20" fill="black" /> |
| 83 |
<!-- <line x1="40" y1="50" x2="60" y2="50" stroke="black" /> |
| 84 |
<line y1="40" x1="50" y2="60" x2="50" stroke="black" /> --> |
| 85 |
<rect x="49" y="49" width="2" height="2" fill="black" |
| 86 |
onclick="targetHit()" |
| 87 |
onmouseover="hotTarget()" |
| 88 |
onmouseout="coldTarget()"/> |
| 89 |
</g> |
| 90 |
|
| 91 |
<text class="label" text-anchor="middle" x="50%" y="270" fill="crimson">Hit Count : <tspan id="hitCount">0</tspan></text> |
| 92 |
|
| 93 |
<text class="label" text-anchor="middle" x="25%" y="340" >Cursor Selection</text> |
| 94 |
|
| 95 |
<g onclick="changeCursor(evt)" transform="translate(112.5, 410)"> |
| 96 |
<use xlink:href="#Center" x="-16" y="-16" /> |
| 97 |
<use xlink:href="#NW" x="-50" y="-50" /> |
| 98 |
<use xlink:href="#N" x="-16" y="-50" /> |
| 99 |
<use xlink:href="#NE" x="18" y="-50" /> |
| 100 |
<use xlink:href="#E" x="18" y="-16" /> |
| 101 |
<use xlink:href="#SE" x="18" y="18" /> |
| 102 |
<use xlink:href="#S" x="-16" y="18" /> |
| 103 |
<use xlink:href="#SW" x="-50" y="18" /> |
| 104 |
<use xlink:href="#W" x="-50" y="-16" /> |
| 105 |
</g> |
| 106 |
|
| 107 |
<text class="label" text-anchor="middle" x="75%" y="340" >Current Target Area Cursor</text> |
| 108 |
|
| 109 |
<g transform="translate(321.5, 394)" visibility="hidden"> |
| 110 |
<use id="refCenter" xlink:href="#Center" /> |
| 111 |
<use id="refNW" xlink:href="#NW" visibility="visible"/> |
| 112 |
<use id="refN" xlink:href="#N" /> |
| 113 |
<use id="refNE" xlink:href="#NE" /> |
| 114 |
<use id="refE" xlink:href="#E" /> |
| 115 |
<use id="refSE" xlink:href="#SE" /> |
| 116 |
<use id="refS" xlink:href="#S" /> |
| 117 |
<use id="refSW" xlink:href="#SW" /> |
| 118 |
<use id="refW" xlink:href="#W" /> |
| 119 |
</g> |
| 120 |
|
| 121 |
<defs> |
| 122 |
<image id="Center" xlink:href="../../resources/images/hotSpotCenter.png" width="32" height="32"/> |
| 123 |
<image id="NW" xlink:href="../../resources/images/hotSpotNW.png" width="32" height="32"/> |
| 124 |
<image id="N" xlink:href="../../resources/images/hotSpotN.png" width="32" height="32"/> |
| 125 |
<image id="NE" xlink:href="../../resources/images/hotSpotNE.png" width="32" height="32"/> |
| 126 |
<image id="E" xlink:href="../../resources/images/hotSpotE.png" width="32" height="32"/> |
| 127 |
<image id="SE" xlink:href="../../resources/images/hotSpotSE.png" width="32" height="32"/> |
| 128 |
<image id="S" xlink:href="../../resources/images/hotSpotS.png" width="32" height="32"/> |
| 129 |
<image id="SW" xlink:href="../../resources/images/hotSpotSW.png" width="32" height="32"/> |
| 130 |
<image id="W" xlink:href="../../resources/images/hotSpotW.png" width="32" height="32"/> |
| 131 |
|
| 132 |
<cursor id="cursorCenter" x="16" y="16" xlink:href="../../resources/images/hotSpotCenter.png"/> |
| 133 |
<cursor id="cursorNW" x="0" y="0" xlink:href="../../resources/images/hotSpotNW.png"/> |
| 134 |
<cursor id="cursorN" x="16" y="0" xlink:href="../../resources/images/hotSpotN.png"/> |
| 135 |
<cursor id="cursorNE" x="32" y="0" xlink:href="../../resources/images/hotSpotNE.png"/> |
| 136 |
<cursor id="cursorE" x="32" y="16" xlink:href="../../resources/images/hotSpotE.png"/> |
| 137 |
<cursor id="cursorSE" x="32" y="32" xlink:href="../../resources/images/hotSpotSE.png"/> |
| 138 |
<cursor id="cursorS" x="16" y="32" xlink:href="../../resources/images/hotSpotS.png"/> |
| 139 |
<cursor id="cursorSW" x="0" y="32" xlink:href="../../resources/images/hotSpotSW.png"/> |
| 140 |
<cursor id="cursorW" x="0" y="16" xlink:href="../../resources/images/hotSpotW.png"/> |
| 141 |
</defs> |
| 142 |
|
| 143 |
</svg> |