2150 |
mathias |
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 |
<!--
|
|
|
10 |
The next line should include Microsoft's Silverligth.js, if you plan to use the silverlight backend
|
|
|
11 |
<script type="text/javascript" src="Silverlight.js"></script>
|
|
|
12 |
-->
|
|
|
13 |
<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true"></script>
|
|
|
14 |
<!--<script type="text/javascript" src="../matrix.js"></script>-->
|
|
|
15 |
<!--<script type="text/javascript" src="../util.js"></script>-->
|
|
|
16 |
<!--<script type="text/javascript" src="../shape.js"></script>-->
|
|
|
17 |
<!--<script type="text/javascript" src="../path.js"></script>-->
|
|
|
18 |
<!--<script type="text/javascript" src="../vml.js"></script>-->
|
|
|
19 |
<!--<script type="text/javascript" src="../svg.js"></script>-->
|
|
|
20 |
<!--<script type="text/javascript" src="../silverlight.js"></script>-->
|
|
|
21 |
<script type="text/javascript">
|
|
|
22 |
dojo.require("dojox.gfx");
|
|
|
23 |
|
|
|
24 |
var surface = null;
|
|
|
25 |
var g1 = null;
|
|
|
26 |
var g2 = null;
|
|
|
27 |
var r1 = null;
|
|
|
28 |
|
|
|
29 |
makeShapes = function(){
|
|
|
30 |
surface = dojox.gfx.createSurface(document.getElementById("test"), 500, 500);
|
|
|
31 |
// make a checkerboard
|
|
|
32 |
for(var i = 0; i < 500; i += 100){
|
|
|
33 |
for(var j = 0; j < 500; j += 100){
|
|
|
34 |
if(i % 200 == j % 200) {
|
|
|
35 |
surface.createRect({ x: i, y: j }).setFill([255, 0, 0, 0.1]);
|
|
|
36 |
}
|
|
|
37 |
}
|
|
|
38 |
}
|
|
|
39 |
// create groups and shapes
|
|
|
40 |
g1 = surface.createGroup();
|
|
|
41 |
g2 = surface.createGroup();
|
|
|
42 |
r1 = surface.createRect({x: 200, y: 200}).setFill("green").setStroke({});
|
|
|
43 |
g1.setTransform({dy: -100});
|
|
|
44 |
//g2.setTransform(dojox.gfx.matrix.rotateAt(-45, 250, 250));
|
|
|
45 |
g2.setTransform({dx: 100, dy: -100});
|
|
|
46 |
};
|
|
|
47 |
|
|
|
48 |
switchRect = function(){
|
|
|
49 |
var radio = document.getElementsByName("switch");
|
|
|
50 |
if(radio[0].checked){
|
|
|
51 |
surface.add(r1);
|
|
|
52 |
}else if(radio[1].checked){
|
|
|
53 |
g1.add(r1);
|
|
|
54 |
}else if(radio[2].checked){
|
|
|
55 |
g2.add(r1);
|
|
|
56 |
}
|
|
|
57 |
};
|
|
|
58 |
|
|
|
59 |
dojo.addOnLoad(makeShapes);
|
|
|
60 |
|
|
|
61 |
</script>
|
|
|
62 |
</head>
|
|
|
63 |
<body>
|
|
|
64 |
<h1>dojox.gfx Group tests</h1>
|
|
|
65 |
<p>
|
|
|
66 |
<input type="radio" name="switch" id="r1_s" checked="checked" onclick="switchRect()" /><label for="r1_s">Rectangle belongs to the surface</label><br />
|
|
|
67 |
<input type="radio" name="switch" id="r1_g1" onclick="switchRect()" /><label for="r1_g1">Rectangle belongs to the group #1</label><br />
|
|
|
68 |
<input type="radio" name="switch" id="r1_g2" onclick="switchRect()" /><label for="r1_g2">Rectangle belongs to the group #2</label>
|
|
|
69 |
</p>
|
|
|
70 |
<div id="test"></div>
|
|
|
71 |
<p>That's all Folks!</p>
|
|
|
72 |
</body>
|
|
|
73 |
</html>
|