Debian Codegraph @

samples/tests/spec/scripting/modalEventTest.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 <!-- Simple test to validate that events are properly dispatched. This -->
25 <!-- test shows a problem we had due to isModalEvent. -->
26 <!-- For example: mousedown on red circle, move out of circle, mouseup. -->
27 <!-- This sequence should not trigger the circle's mouseup handler. -->
28 <!-- -->
29 <!-- @author [email protected] -->
30 <!-- @version $Id$ -->
31 <!-- ====================================================================== -->
32
33 <?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
34
35 <svg xmlns="http://www.w3.org/2000/svg"
36 xmlns:xlink="http://www.w3.org/1999/xlink"
37 id="body" width="450" height="500" viewBox="0 0 450 500">
38
39 <title>Modal Event Test</title>
40
41 <text x="50%" y="45" class="title">Modal Event Test</text>
42
43 <text transform="translate(225,140)" class="legend">
44 <tspan x="0" dy="0">Test 1: Press mousedown on circle, move out, release</tspan>
45 <tspan x="0" dy="1.2em">Test 2: Press mousedown out of circle, move in, release</tspan>
46 <tspan x="0" dy="1.2em">Test 3: Press mousedown out of circle, move through, release</tspan>
47 <tspan x="0" dy="1.6em">Hit the clear button between tests</tspan>
48 </text>
49
50 <script type="text/ecmascript"><![CDATA[
51
52 var svgNamespaceURI = "http://www.w3.org/2000/svg";
53
54 function onMouseDown(id) {
55 // First, turn mouse control green
56 var ctrl = document.getElementById("mouseDownCtrl");
57 ctrl.setAttribute("fill", "rgb(0,255,0)");
58 }
59
60 function onMouseUp(id) {
61 // First, turn mouse control green
62 var ctrl = document.getElementById("mouseUpCtrl");
63 ctrl.setAttribute("fill", "rgb(0,255,0)");
64 }
65
66 function clear() {
67 var ctrl = document.getElementById("mouseDownCtrl");
68 ctrl.setAttribute("fill", "gray");
69 ctrl = document.getElementById("mouseUpCtrl");
70 ctrl.setAttribute("fill", "gray");
71 }
72
73
74 ]]></script>
75
76 <defs>
77 <rect id="button" x="-30" y="-15" width="60" height="20" />
78 </defs>
79
80 <style type="text/css"><![CDATA[
81 use.button {
82 fill: #eeeeee;
83 stroke: black;
84 }
85
86 text.button {
87 fill: black;
88 stroke: none;
89 text-anchor: middle;
90 }
91 ]]></style>
92
93 <g id="originalGroup" transform="translate(225,250)">
94 <g id="target" onmousedown="onMouseDown('target')" onmouseup="onMouseUp(evt)" >
95 <circle cx="0" cy="0" r="30" fill="crimson" />
96 </g>
97 </g>
98
99 <g id="insertionPointGroup" transform="translate(225,250) scale(2)">
100 </g>
101
102 <g transform="translate(150, 350)">
103 <circle id="mouseDownCtrl" r="10" stroke="black" fill="gray" />
104 <text class="legend" y="20">mousedown</text>
105 </g>
106
107 <g transform="translate(300, 350)">
108 <circle id="mouseUpCtrl" r="10" stroke="black" fill="gray" />
109 <text class="legend" y="20" >mouseup</text>
110 </g>
111
112 <g transform="translate(225,450)">
113 <a onclick="clear()">
114 <use class="button" xlink:href="#button" />
115 <text class="button">Clear</text>
116 </a>
117 </g>
118 </svg>