Debian Codegraph @

dojox/gfx/tests/test_group2.html

raw symbols SCIP
1 <html>
2 <head>
3 <title>Testing add/remove shape</title>
4 <style type="text/css">
5 @import "../../../dojo/resources/dojo.css";
6 @import "../../../dijit/tests/css/dijitTests.css";
7 @import "../../../dijit/themes/tundra/tundra.css";
8 </style>
9 <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug: true, parseOnLoad: true"></script>
10 <script type="text/javascript">
11 dojo.require("dojox.gfx");
12 dojo.require("dijit.form.CheckBox");
13 dojo.require("dojo.parser");
14
15 var surface = null, shape = null;
16
17 createSurface = function(){
18 surface = dojox.gfx.createSurface("test", 300, 300);
19 };
20
21 flip = function(){
22 if(dijit.byId("cb").checked){
23 if(!shape){
24 //shape = surface.createRect({x: 100, y: 100, width: 100, height: 100})
25 shape = surface.createCircle({cx: 150, cy : 150, r: 50})
26 .setFill("yellow").setStroke({color: "red", width: 3});
27 }else{
28 surface.add(shape);
29 }
30 }else{
31 surface.clear(); // Shapes removed from the surface can now be added back to it.
32 //surface.remove(shape);
33 }
34 }
35
36 dojo.addOnLoad(createSurface);
37 </script>
38
39
40 </head>
41
42 <body class="tundra">
43 <h1>Testing add/remove shape</h1>
44 <p>
45 <input type="checkbox" dojoType="dijit.form.CheckBox" id="cb" name="cb" onClick="flip()">
46 <label for="cb">Add shape to the surface</label>
47 </p>
48 <div id="test" style="width: 300px; height: 300px;"></div>
49 <p>That's all Folks!</p>
50 </body>
51 </html>