| 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 rect's x,y,width and height attributes in an --> |
| 25 |
<!-- 'onclick' event handler. This is actually mostly testing a change in --> |
| 26 |
<!-- the documents size. --> |
| 27 |
<!-- --> |
| 28 |
<!-- @author [email protected] --> |
| 29 |
<!-- @version $Id$ --> |
| 30 |
<!-- ========================================================================= --> |
| 31 |
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?> |
| 32 |
<svg id="body" width="450" height="500" viewBox="0 0 450 500"> |
| 33 |
<title><rect> moving display updated with forceRedraw()</title> |
| 34 |
|
| 35 |
<script type="text/ecmascript"><![CDATA[ |
| 36 |
var root = document.rootElement; |
| 37 |
|
| 38 |
function setRect(target, color){ |
| 39 |
var t = document.getElementById(target); |
| 40 |
t.setAttributeNS(null, "fill", color); |
| 41 |
} |
| 42 |
|
| 43 |
var suspendId; |
| 44 |
function testForce(target, time) { |
| 45 |
suspendId = root.suspendRedraw(time); |
| 46 |
setRect(target, "crimson"); |
| 47 |
root.forceRedraw(); |
| 48 |
} |
| 49 |
|
| 50 |
function testForce2(target, time) { |
| 51 |
suspendId = root.suspendRedraw(time); |
| 52 |
setRect(target, "crimson"); |
| 53 |
setTimeout("root.forceRedraw()",(time/2)); |
| 54 |
} |
| 55 |
|
| 56 |
function testForce3(target, time) { |
| 57 |
suspendId = root.suspendRedraw(time); |
| 58 |
setRect(target, "blue"); |
| 59 |
root.forceRedraw(); |
| 60 |
setRect(target, "crimson"); |
| 61 |
} |
| 62 |
|
| 63 |
function moveX(target) { |
| 64 |
var e = document.getElementById(target); |
| 65 |
var base = e.getAttributeNS(null, "x"); |
| 66 |
for (var x=0; x<350; x++) { |
| 67 |
var v = (1*base)+x; |
| 68 |
e.setAttributeNS(null, "x", v); |
| 69 |
root.forceRedraw(); |
| 70 |
} |
| 71 |
} |
| 72 |
]]></script> |
| 73 |
|
| 74 |
<text x="50%" y="40" class="title" |
| 75 |
><rect> fill modification with redraw suspended.</text> |
| 76 |
|
| 77 |
|
| 78 |
<g id="test-content" font-size="10"> |
| 79 |
<rect id="rect.t1" fill="gold" x="10" y="50" width="80" height="40" |
| 80 |
onclick="testForce('rect.t1', 2000)"/> |
| 81 |
|
| 82 |
<rect id="rect.t2" fill="gold" x="235" y="50" width="80" height="40" |
| 83 |
onclick="testForce2('rect.t2', 4000)"/> |
| 84 |
|
| 85 |
<rect id="rect.t3" fill="gold" x="10" y="100" width="80" height="40" |
| 86 |
onclick="testForce3('rect.t3', 4000)"/> |
| 87 |
|
| 88 |
<rect id="rect.t4" fill="gold" x="10" y="170" width="80" height="40" |
| 89 |
onclick="moveX('rect.t4')"/> |
| 90 |
|
| 91 |
<text x="100" y="67">suspendRedraw 2000 |
| 92 |
<tspan x="100" y="79">immediate forceRepaint()</tspan></text> |
| 93 |
|
| 94 |
<text x="320" y="67">suspendRedraw 2000 |
| 95 |
<tspan x="320" y="79">forceRepaint() @1s</tspan></text> |
| 96 |
|
| 97 |
<text x="100" y="110">suspendRedraw 2000 |
| 98 |
<tspan x="100" y="120">fill='blue'</tspan> |
| 99 |
<tspan x="100" y="130">forceRepaint()</tspan> |
| 100 |
<tspan x="100" y="140">fill='crimson'</tspan></text> |
| 101 |
|
| 102 |
<text x="225" y="230" class="legend" |
| 103 |
>Loop on x with forceRepaint</text> |
| 104 |
</g> |
| 105 |
</svg> |