| 1 |
<?xml version="1.0" standalone="no"?> |
| 2 |
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN" |
| 3 |
"http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.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 |
<!-- Modification of a circle attributes --> |
| 25 |
<!-- --> |
| 26 |
<!-- @author [email protected] --> |
| 27 |
<!-- @version --> |
| 28 |
<!-- ====================================================================== --> |
| 29 |
|
| 30 |
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?> |
| 31 |
|
| 32 |
<svg id="body" width="450" height="500" overflow="visible" viewBox="0 0 450 500" xmlns:xlink="http://www.w3.org/1999/xlink" |
| 33 |
onload="setup(evt)" > |
| 34 |
<title><tspan> attributes 'onload'</title> |
| 35 |
|
| 36 |
<text id="titleGroup" x="50%" y="45" class="title"><group> attributes in 'onload'</text> |
| 37 |
<text id="titleText" x="50%" y="70" class="title"><text> attributes in 'onload'</text> |
| 38 |
<text id="titleTspan" x="50%" y="95" class="title"><tspan> attributes in 'onload'</text> |
| 39 |
<text id="titleTRef" x="50%" y="120" class="title"><tref> attributes in 'onload'</text> |
| 40 |
<text id="titleTextPath" x="50%" y="145" class="title"><textPath> attributes in 'onload'</text> |
| 41 |
|
| 42 |
<defs> |
| 43 |
<text id="textContent">fox</text> |
| 44 |
<path id="path" d="M 0 0 C 10 -10 60 -10 70 0" /> |
| 45 |
<path id="arrow" style="fill:black;stroke:black" d=" M -5 0 L 5 -5 L 5 5 z" /> |
| 46 |
</defs> |
| 47 |
|
| 48 |
<script type="text/ecmascript"><![CDATA[ |
| 49 |
|
| 50 |
var arrayStyleGroup; |
| 51 |
var currentStyleGroup = 1; |
| 52 |
var nbStyleGroup; |
| 53 |
|
| 54 |
var arrayStyleText; |
| 55 |
var currentStyleText = 1; |
| 56 |
var nbStyleText; |
| 57 |
|
| 58 |
var arrayStyleTspan; |
| 59 |
var currentStyleTspan = 0; |
| 60 |
var nbStyleTspan; |
| 61 |
|
| 62 |
|
| 63 |
var currentStyleTRef = 6; |
| 64 |
var currentStyleTextPath = 2; |
| 65 |
|
| 66 |
var group; |
| 67 |
var text; |
| 68 |
var tspan; |
| 69 |
var tref; |
| 70 |
var textpath; |
| 71 |
var doc; |
| 72 |
|
| 73 |
function setup(evt){ |
| 74 |
|
| 75 |
doc = evt.target.getOwnerDocument(); |
| 76 |
|
| 77 |
arrayStyleGroup = new Array(); |
| 78 |
arrayStyleGroup[0] = 'fill:orange;stroke:blue'; |
| 79 |
arrayStyleGroup[1] = 'fill:orange'; |
| 80 |
arrayStyleGroup[2] = 'stroke:blue'; |
| 81 |
arrayStyleGroup[3] = ''; |
| 82 |
nbStyleGroup = 4; |
| 83 |
|
| 84 |
arrayStyleText = new Array(); |
| 85 |
arrayStyleText[0] = 'text-decoration:underline;fill:crimson'; |
| 86 |
arrayStyleText[1] = 'text-decoration:underline;stroke:black'; |
| 87 |
arrayStyleText[2] = 'fill:green;stroke:red'; |
| 88 |
arrayStyleText[3] = 'stroke:red'; |
| 89 |
arrayStyleText[4] = 'fill:green;fill-opacity:0.6'; |
| 90 |
arrayStyleText[5] = 'stroke-opacity:0.6'; |
| 91 |
arrayStyleText[6] = 'stroke-width:3'; |
| 92 |
arrayStyleText[7] = 'fill:green;text-decoration:underline'; |
| 93 |
arrayStyleText[8] = 'fill:green;text-decoration:overline'; |
| 94 |
arrayStyleText[9] = 'fill:green;text-decoration:line-through'; |
| 95 |
nbStyleText = 10; |
| 96 |
|
| 97 |
arrayStyleTspan = new Array(); |
| 98 |
arrayStyleTspan[0] = 'fill:red;letter-spacing:10'; |
| 99 |
arrayStyleTspan[1] = 'stroke:gold'; |
| 100 |
arrayStyleTspan[2] = 'stroke:gold;fill-opacity:0.6'; |
| 101 |
arrayStyleTspan[3] = 'stroke-opacity:0.6'; |
| 102 |
arrayStyleTspan[4] = 'stroke-width:3'; |
| 103 |
arrayStyleTspan[5] = 'fill:red;text-decoration:underline'; |
| 104 |
arrayStyleTspan[6] = 'fill:red;text-decoration:overline'; |
| 105 |
arrayStyleTspan[7] = 'fill:red;text-decoration:line-through'; |
| 106 |
arrayStyleTspan[8] = 'fill:red;font-family:Times New Roman'; |
| 107 |
nbStyleTspan = 9; |
| 108 |
|
| 109 |
group = doc.getElementById('group'); |
| 110 |
text = doc.getElementById('text'); |
| 111 |
tspan = doc.getElementById('tspan'); |
| 112 |
tref = doc.getElementById('tref'); |
| 113 |
textpath = doc.getElementById('textpath'); |
| 114 |
|
| 115 |
applyTextPathStyle(); |
| 116 |
applyTRefStyle(); |
| 117 |
applyTspanStyle(); |
| 118 |
applyTextStyle(); |
| 119 |
applyGroupStyle(); |
| 120 |
|
| 121 |
} |
| 122 |
|
| 123 |
function nextTextPath() |
| 124 |
{ |
| 125 |
currentStyleTextPath++; |
| 126 |
if ( currentStyleTextPath >= nbStyleTspan ){ |
| 127 |
currentStyleTextPath=0; |
| 128 |
} |
| 129 |
applyTextPathStyle(); |
| 130 |
} |
| 131 |
function previousTextPath() |
| 132 |
{ |
| 133 |
currentStyleTextPath--; |
| 134 |
if ( currentStyleTextPath < 0 ){ |
| 135 |
currentStyleTextPath = nbStyleTspan-1; |
| 136 |
} |
| 137 |
applyTextPathStyle(); |
| 138 |
} |
| 139 |
|
| 140 |
function applyTextPathStyle() |
| 141 |
{ |
| 142 |
textpath.setAttribute('style',arrayStyleTspan[currentStyleTextPath]); |
| 143 |
|
| 144 |
var title = doc.getElementById('titleTextPath'); |
| 145 |
var textnode = title.getFirstChild(); |
| 146 |
textnode.setData('textPath : '+arrayStyleTspan[currentStyleTextPath]); |
| 147 |
} |
| 148 |
|
| 149 |
function nextTRef() |
| 150 |
{ |
| 151 |
currentStyleTRef++; |
| 152 |
if ( currentStyleTRef >= nbStyleTspan ){ |
| 153 |
currentStyleTRef=0; |
| 154 |
} |
| 155 |
applyTRefStyle(); |
| 156 |
} |
| 157 |
function previousTRef() |
| 158 |
{ |
| 159 |
currentStyleTRef--; |
| 160 |
if ( currentStyleTRef < 0 ){ |
| 161 |
currentStyleTRef = nbStyleTspan-1; |
| 162 |
} |
| 163 |
applyTRefStyle(); |
| 164 |
} |
| 165 |
|
| 166 |
function applyTRefStyle() |
| 167 |
{ |
| 168 |
tref.setAttribute('style',arrayStyleTspan[currentStyleTRef]); |
| 169 |
|
| 170 |
var title = doc.getElementById('titleTRef'); |
| 171 |
var textnode = title.getFirstChild(); |
| 172 |
textnode.setData('tref : '+arrayStyleTspan[currentStyleTRef]); |
| 173 |
} |
| 174 |
|
| 175 |
function nextTspan() |
| 176 |
{ |
| 177 |
currentStyleTspan++; |
| 178 |
if ( currentStyleTspan >= nbStyleTspan ){ |
| 179 |
currentStyleTspan=0; |
| 180 |
} |
| 181 |
applyTspanStyle(); |
| 182 |
} |
| 183 |
function previousTspan() |
| 184 |
{ |
| 185 |
currentStyleTspan--; |
| 186 |
if ( currentStyleTspan < 0 ){ |
| 187 |
currentStyleTspan = nbStyleTspan-1; |
| 188 |
} |
| 189 |
applyTspanStyle(); |
| 190 |
} |
| 191 |
|
| 192 |
function applyTspanStyle() |
| 193 |
{ |
| 194 |
tspan.setAttribute('style',arrayStyleTspan[currentStyleTspan]); |
| 195 |
|
| 196 |
var title = doc.getElementById('titleTspan'); |
| 197 |
var textnode = title.getFirstChild(); |
| 198 |
textnode.setData('tspan : '+arrayStyleTspan[currentStyleTspan]); |
| 199 |
} |
| 200 |
|
| 201 |
|
| 202 |
function nextText() |
| 203 |
{ |
| 204 |
currentStyleText++; |
| 205 |
if ( currentStyleText >= nbStyleText ){ |
| 206 |
currentStyleText=0; |
| 207 |
} |
| 208 |
applyTextStyle(); |
| 209 |
} |
| 210 |
function previousText() |
| 211 |
{ |
| 212 |
currentStyleText--; |
| 213 |
if ( currentStyleText < 0 ){ |
| 214 |
currentStyleText = nbStyleText-1; |
| 215 |
} |
| 216 |
applyTextStyle(); |
| 217 |
} |
| 218 |
|
| 219 |
function applyTextStyle() |
| 220 |
{ |
| 221 |
text.setAttribute('style',arrayStyleText[currentStyleText]); |
| 222 |
|
| 223 |
var title = doc.getElementById('titleText'); |
| 224 |
var textnode = title.getFirstChild(); |
| 225 |
textnode.setData('text : '+arrayStyleText[currentStyleText]); |
| 226 |
} |
| 227 |
|
| 228 |
function nextGroup() |
| 229 |
{ |
| 230 |
currentStyleGroup++; |
| 231 |
if ( currentStyleGroup >= nbStyleGroup ){ |
| 232 |
currentStyleGroup=0; |
| 233 |
} |
| 234 |
applyGroupStyle(); |
| 235 |
} |
| 236 |
function previousGroup() |
| 237 |
{ |
| 238 |
currentStyleGroup--; |
| 239 |
if ( currentStyleGroup < 0 ){ |
| 240 |
currentStyleGroup=nbStyleGroup-1; |
| 241 |
} |
| 242 |
applyGroupStyle(); |
| 243 |
} |
| 244 |
|
| 245 |
function applyGroupStyle() |
| 246 |
{ |
| 247 |
group.setAttribute('style',arrayStyleGroup[currentStyleGroup]); |
| 248 |
|
| 249 |
var title = doc.getElementById('titleGroup'); |
| 250 |
var textnode = title.getFirstChild(); |
| 251 |
textnode.setData('group : '+arrayStyleGroup[currentStyleGroup]); |
| 252 |
} |
| 253 |
|
| 254 |
]]> </script> |
| 255 |
|
| 256 |
<g id="test-content" style="font-size:30" > |
| 257 |
<!-- testing only |
| 258 |
<use transform="translate(155,220)" xlink:href="#path" style="stroke:blue;fill:none" /> |
| 259 |
--> |
| 260 |
<g transform="translate(155,220)" id="group" > |
| 261 |
<text dx="-55" id="text" >the |
| 262 |
<textPath id="textpath" xlink:href="#path">quick</textPath> |
| 263 |
<tspan><tspan id="tspan">brown</tspan></tspan> |
| 264 |
<tref id="tref" xlink:href="#textContent" style="fill:gold"/> |
| 265 |
</text> |
| 266 |
|
| 267 |
</g> |
| 268 |
</g> |
| 269 |
|
| 270 |
<g id="legend" > |
| 271 |
<g style="fill:white; stroke:black;text-anchor:middle"> |
| 272 |
<g transform="translate(370,300)" > |
| 273 |
<use xlink:href="#arrow" transform="translate(-40,-5)" onclick="previousTRef()" /> |
| 274 |
<use xlink:href="#arrow" transform="translate(40,-5) rotate(180)" onclick="nextTRef()" /> |
| 275 |
<text style="fill:black;stroke:none" x="0" y="0" ><tref> tests</text> |
| 276 |
</g> |
| 277 |
<g transform="translate(250,300)" > |
| 278 |
<use xlink:href="#arrow" transform="translate(-45,-5)" onclick="previousTspan()" /> |
| 279 |
<use xlink:href="#arrow" transform="translate(45,-5) rotate(180)" onclick="nextTspan()" /> |
| 280 |
<text style="fill:black;stroke:none" x="0" y="0" ><tspan> tests</text> |
| 281 |
</g> |
| 282 |
<g transform="translate(120,300)" > |
| 283 |
<use xlink:href="#arrow" transform="translate(-55,-5)" onclick="previousTextPath()" /> |
| 284 |
<use xlink:href="#arrow" transform="translate(55,-5) rotate(180)" onclick="nextTextPath()" /> |
| 285 |
<text style="fill:black;stroke:none" x="0" y="0" ><textPath> tests</text> |
| 286 |
</g> |
| 287 |
<g transform="translate(225,325)" > |
| 288 |
<use xlink:href="#arrow" transform="translate(-45,-5)" onclick="previousText()" /> |
| 289 |
<use xlink:href="#arrow" transform="translate(45,-5) rotate(180)" onclick="nextText()" /> |
| 290 |
<text style="fill:black;stroke:none" x="0" y="0" ><text> tests</text> |
| 291 |
</g> |
| 292 |
<g transform="translate(225,350)" > |
| 293 |
<use xlink:href="#arrow" transform="translate(-55,-5)" onclick="previousGroup()" /> |
| 294 |
<use xlink:href="#arrow" transform="translate(55,-5) rotate(180)" onclick="nextGroup()" /> |
| 295 |
<text style="fill:black;stroke:none" x="0" y="0" ><group> tests</text> |
| 296 |
</g> |
| 297 |
</g> |
| 298 |
</g> |
| 299 |
</svg> |