| 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 |
|
| 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 |
dojo.require("dijit.form.CheckBox"); |
| 17 |
dojo.require("dojo.parser"); |
| 18 |
|
| 19 |
var surface = null, shape = null; |
| 20 |
|
| 21 |
createSurface = function(){ |
| 22 |
surface = dojox.gfx.createSurface("test", 300, 300); |
| 23 |
}; |
| 24 |
|
| 25 |
flip = function(){ |
| 26 |
if(dojo.byId("cb").checked){ |
| 27 |
if(!shape){ |
| 28 |
//shape = surface.createRect({x: 100, y: 100, width: 100, height: 100}) |
| 29 |
shape = surface.createCircle({cx: 150, cy : 150, r: 50}) |
| 30 |
.setFill("yellow").setStroke({color: "red", width: 3}); |
| 31 |
}else{ |
| 32 |
surface.add(shape); |
| 33 |
} |
| 34 |
}else{ |
| 35 |
surface.remove(shape); |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
dojo.addOnLoad(createSurface); |
| 40 |
</script> |
| 41 |
|
| 42 |
|
| 43 |
</head> |
| 44 |
|
| 45 |
<body class="tundra"> |
| 46 |
<h1>Testing add/remove shape</h1> |
| 47 |
<p> |
| 48 |
<input type="checkbox" dojoType="dijit.form.CheckBox" id="cb" name="cb" onClick="flip()"> |
| 49 |
<label for="cb">Add shape to the surface</label> |
| 50 |
</p> |
| 51 |
<div id="test" style="width: 300px; height: 300px;"></div> |
| 52 |
<p>That's all Folks!</p> |
| 53 |
</body> |
| 54 |
</html> |