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
|
<?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 a rect's x,y,width and height attributes in an -->
<!-- 'onclick' event handler. This is actually mostly testing a change in -->
<!-- the documents size. -->
<!-- -->
<!-- @author deweese@apache.org -->
<!-- @version $Id: forceRedraw.svg 1733420 2016-03-03 07:41:59Z gadams $ -->
<!-- ========================================================================= -->
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
<svg id="body" width="450" height="500" viewBox="0 0 450 500">
<title><rect> moving display updated with forceRedraw()</title>
<script type="text/ecmascript"><![CDATA[
var root = document.rootElement;
function setRect(target, color){
var t = document.getElementById(target);
t.setAttributeNS(null, "fill", color);
}
var suspendId;
function testForce(target, time) {
suspendId = root.suspendRedraw(time);
setRect(target, "crimson");
root.forceRedraw();
}
function testForce2(target, time) {
suspendId = root.suspendRedraw(time);
setRect(target, "crimson");
setTimeout("root.forceRedraw()",(time/2));
}
function testForce3(target, time) {
suspendId = root.suspendRedraw(time);
setRect(target, "blue");
root.forceRedraw();
setRect(target, "crimson");
}
function moveX(target) {
var e = document.getElementById(target);
var base = e.getAttributeNS(null, "x");
for (var x=0; x<350; x++) {
var v = (1*base)+x;
e.setAttributeNS(null, "x", v);
root.forceRedraw();
}
}
]]></script>
<text x="50%" y="40" class="title"
><rect> fill modification with redraw suspended.</text>
<g id="test-content" font-size="10">
<rect id="rect.t1" fill="gold" x="10" y="50" width="80" height="40"
onclick="testForce('rect.t1', 2000)"/>
<rect id="rect.t2" fill="gold" x="235" y="50" width="80" height="40"
onclick="testForce2('rect.t2', 4000)"/>
<rect id="rect.t3" fill="gold" x="10" y="100" width="80" height="40"
onclick="testForce3('rect.t3', 4000)"/>
<rect id="rect.t4" fill="gold" x="10" y="170" width="80" height="40"
onclick="moveX('rect.t4')"/>
<text x="100" y="67">suspendRedraw 2000
<tspan x="100" y="79">immediate forceRepaint()</tspan></text>
<text x="320" y="67">suspendRedraw 2000
<tspan x="320" y="79">forceRepaint() @1s</tspan></text>
<text x="100" y="110">suspendRedraw 2000
<tspan x="100" y="120">fill='blue'</tspan>
<tspan x="100" y="130">forceRepaint()</tspan>
<tspan x="100" y="140">fill='crimson'</tspan></text>
<text x="225" y="230" class="legend"
>Loop on x with forceRepaint</text>
</g>
</svg>
|