File: visibilityOnClick.svg

package info (click to toggle)
batik 1.16%2Bdfsg-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 29,180 kB
  • sloc: java: 191,940; xml: 19,062; javascript: 1,276; sh: 85; makefile: 5
file content (135 lines) | stat: -rw-r--r-- 6,193 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN"
"http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd">

<!--

   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

-->
<!-- ====================================================================== -->
<!-- Modification of the visibility property                                -->
<!--                                                                        -->
<!-- @author tkormann@ilog.fr                                               -->
<!-- @version $Id: visibilityOnClick.svg 1803034 2017-07-26 12:00:06Z ssteiner $ -->
<!-- ====================================================================== -->

<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>  

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="body" width="450" height="500" viewBox="0 0 450 500">
  <title>'visibility' property on 'onclick</title>

  <text x="50%" y="45" class="title">'visibility' property on 'onclick'</text>

  <script type="text/ecmascript"><![CDATA[
    function changeVisibility(elem, newValue) {
       elem.style.setProperty("visibility", newValue, "");
    }
    function doChange() {
       changeVisibility(document.getElementById("gHide"),  "hidden");
       changeVisibility(document.getElementById("r1Hide"), "hidden");
       changeVisibility(document.getElementById("r2Hide"), "hidden");
       changeVisibility(document.getElementById("r3Hide"), "hidden");
       changeVisibility(document.getElementById("r4Hide"), "hidden");
       changeVisibility(document.getElementById("i1Hide"), "hidden");

       changeVisibility(document.getElementById("gShow"),  "visible");
       changeVisibility(document.getElementById("r1Show"), "visible");
       changeVisibility(document.getElementById("r2Show"), "visible");
       changeVisibility(document.getElementById("r3Show"), "visible");
       changeVisibility(document.getElementById("r4Show"), "visible");
       changeVisibility(document.getElementById("i1Show"), "visible");
    }

    // This function is only called if test is run from regard.
    function regardStart() {
       doChange();
       setTimeout('regardTestInstance.scriptDone()', 200);
    }
    ]]></script>

  <linearGradient id="grad">
    <stop style="stop-color:crimson" offset="0" />
    <stop style="stop-color:gold" offset="1" />
  </linearGradient>



  <g id="test-content" stroke="black" stroke-width="1">
      <g stroke="black" onclick="doChange()" >
         <circle cx="100" cy="100"  r="10"           fill="crimson"/>
         <line   x1="85"  x2="115" y1="100" y2="100" fill="none" />
         <line   x1="100" x2="100" y1="85"  y2="115" fill="none" />
      </g>
      <text class="legend" style="text-anchor:start" stroke="none">
         <tspan x="150" y="97">Click on the Click Target (crimson circle)</tspan>
         <tspan x="150" y="113">to toggle visibility on elements.</tspan>
      </text>

    <g id="gHide" style="visibility:visible">
      <rect  x="100" y="150" width="100" height="50" style="fill:#eee"/>
      <rect  x="150" y="150" width="100" height="50" style="fill:gold"/>
      <rect  x="200" y="150" width="100" height="50" style="fill:crimson"/>
      <rect  x="250" y="150" width="100" height="50" style="fill:url(#grad)"/>
      <image x="350" y="150" width="50"  height="50" 
        xlink:href="../../resources/images/png2.png"/>
    </g>

    <g>
      <g style="fill:#eee">
         <rect  id="r1Hide" x="100" y="225" width="100" height="50"
                style="visibility:visible"/></g>
      <g style="fill:gold">
         <rect  id="r2Hide" x="150" y="225" width="100" height="50" 
                style="visibility:visible"/></g>
      <g style="fill:crimson">
         <rect  id="r3Hide" x="200" y="225" width="100" height="50"
                style="visibility:visible"/></g>
      <g style="fill:url(#grad)">
         <rect  id="r4Hide" x="250" y="225" width="100" height="50" 
                style="visibility:visible"/></g>
      <image id="i1Hide" x="350" y="225" width="50" height="50" 
             xlink:href="../../resources/images/png2.png"/>
    </g>

    <g id="gShow" style="visibility:hidden">
      <rect  x="100" y="300" width="100" height="50" style="fill:#eee"/>
      <rect  x="150" y="300" width="100" height="50" style="fill:gold"/>
      <rect  x="200" y="300" width="100" height="50" style="fill:crimson"/>
      <rect  x="250" y="300" width="100" height="50" style="fill:url(#grad)"/>
      <image x="350" y="300" width="50"  height="50" 
        xlink:href="../../resources/images/png2.png"/>
    </g>

    <g>
     <g style="fill:#eee">
         <rect  id="r1Show" x="100" y="375" width="100" height="50"
                style="visibility:hidden"/></g>
      <g style="fill:gold">
         <rect  id="r2Show" x="150" y="375" width="100" height="50"
                style="visibility:hidden"/></g>
      <g style="fill:crimson">
         <rect  id="r3Show" x="200" y="375" width="100" height="50"
                style="visibility:hidden"/></g>
      <g style="fill:url(#grad)">
         <rect  id="r4Show" x="250" y="375" width="100" height="50"
                style="visibility:hidden"/></g>
      <g><image id="i1Show" x="350" y="375" width="50" height="50" 
                style="visibility:hidden"
                xlink:href="../../resources/images/png2.png"/></g>
    </g>
  </g>
</svg>