Debian Codegraph @

dojox/gfx/tests/svgweb/test_group1.html

raw symbols SCIP
1 <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" >
2 <head>
3 <title>Dojo Unified 2D Graphics</title>
4 <style type="text/css">
5 @import "../../../../dojo/resources/dojo.css";
6 @import "../../../../dijit/tests/css/dijitTests.css";
7 </style>
8 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9 <!-- SVGWEB { -->
10 <meta name="svg.render.forceflash" content="true"/>
11 <script src="svgweb/src/svg.js" data-path="svgweb/src"></script>
12 <script src="../../../../dojo/dojo.js" data-dojo-config="isDebug:true,forceGfxRenderer:'svg'" type="text/javascript"></script>
13 <!-- } -->
14 <script type="text/javascript">
15 dojo.require("dojox.gfx");
16
17 var surface = null;
18 var g1 = null;
19 var g2 = null;
20 var r1 = null;
21
22 makeShapes = function(){
23 surface = dojox.gfx.createSurface(document.getElementById("test"), 500, 500);
24 /* SVGWEB { */
25 surface.whenLoaded(function() {
26 // make a checkerboard
27 for(var i = 0; i < 500; i += 100){
28 for(var j = 0; j < 500; j += 100){
29 if(i % 200 == j % 200) {
30 surface.createRect({ x: i, y: j }).setFill([255, 0, 0, 0.1]);
31 }
32 }
33 }
34 // create groups and shapes
35 g1 = surface.createGroup();
36 g2 = surface.createGroup();
37 r1 = surface.createRect({x: 200, y: 200}).setFill("green").setStroke({});
38 g1.setTransform({dy: -100});
39 //g2.setTransform(dojox.gfx.matrix.rotateAt(-45, 250, 250));
40 g2.setTransform({dx: 100, dy: -100});
41 });
42 /* } */
43 };
44
45 switchRect = function(){
46 var radio = document.getElementsByName("switch");
47 if(radio[0].checked){
48 surface.add(r1);
49 }else if(radio[1].checked){
50 g1.add(r1);
51 }else if(radio[2].checked){
52 g2.add(r1);
53 }
54 };
55
56 dojo.addOnLoad(makeShapes);
57
58 </script>
59 </head>
60 <body>
61 <h1>dojox.gfx Group tests</h1>
62 <p>
63 <input type="radio" name="switch" id="r1_s" checked="checked" onclick="switchRect()" /><label for="r1_s">Rectangle belongs to the surface</label><br />
64 <input type="radio" name="switch" id="r1_g1" onclick="switchRect()" /><label for="r1_g1">Rectangle belongs to the group #1</label><br />
65 <input type="radio" name="switch" id="r1_g2" onclick="switchRect()" /><label for="r1_g2">Rectangle belongs to the group #2</label>
66 </p>
67 <div id="test"></div>
68 <p>That's all Folks!</p>
69 </body>
70 </html>