|
|
|
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" >
|
|
|
|
<head>
|
|
|
|
<title>Dojo Unified 2D Graphics</title>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
|
<script type="text/javascript">djConfig = { isDebug: true };</script>
|
|
|
|
<script type="text/javascript" src="../../dojo.js"></script>
|
|
|
|
<script type="text/javascript">dojo.require("dojo.debug.console");</script>
|
|
|
|
<!--<script type="text/javascript" src="../../src/gfx/vml.js"></script>-->
|
|
|
|
<!--<script type="text/javascript" src="../../src/gfx/svg.js"></script>-->
|
|
|
|
<script type="text/javascript">
|
|
|
|
dojo.require("dojo.gfx.*");
|
|
|
|
|
|
|
|
var surface = null;
|
|
|
|
var g1 = null;
|
|
|
|
var g2 = null;
|
|
|
|
var r1 = null;
|
|
|
|
|
|
|
|
makeShapes = function(){
|
|
|
|
surface = dojo.gfx.createSurface(document.getElementById("test"), 500, 500);
|
|
|
|
// make a checkerboard
|
|
|
|
for(var i = 0; i < 500; i += 100){
|
|
|
|
for(var j = 0; j < 500; j += 100){
|
|
|
|
if(i % 200 == j % 200) {
|
|
|
|
surface.createRect({ x: i, y: j }).setFill([255, 0, 0, 0.1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// create groups and shapes
|
|
|
|
g1 = surface.createGroup();
|
|
|
|
g2 = surface.createGroup();
|
|
|
|
r1 = surface.createRect({x: 200, y: 200}).setFill("green").setStroke({});
|
|
|
|
g1.setTransform({dy: -100});
|
|
|
|
//g2.setTransform(dojo.gfx.matrix.rotateAt(-45, 250, 250));
|
|
|
|
g2.setTransform({dx: 100, dy: -100});
|
|
|
|
};
|
|
|
|
|
|
|
|
switchRect = function(){
|
|
|
|
var radio = document.getElementsByName("switch");
|
|
|
|
if(radio[0].checked){
|
|
|
|
surface.add(r1);
|
|
|
|
}else if(radio[1].checked){
|
|
|
|
g1.add(r1);
|
|
|
|
}else if(radio[2].checked){
|
|
|
|
g2.add(r1);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
dojo.addOnLoad(makeShapes);
|
|
|
|
|
|
|
|
</script>
|
|
|
|
<!--
|
|
|
|
<style>
|
|
|
|
v:group { text-align: left; }
|
|
|
|
</style>
|
|
|
|
-->
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<p>Test for dojo.gfx:</p>
|
|
|
|
<p>
|
|
|
|
<input type="radio" name="switch" id="r1_s" checked onclick="switchRect()" /><label for="r1_s">Rectangle belongs to the surface</label><br />
|
|
|
|
<input type="radio" name="switch" id="r1_g1" onclick="switchRect()" /><label for="r1_g1">Rectangle belongs to the group #1</label><br />
|
|
|
|
<input type="radio" name="switch" id="r1_g2" onclick="switchRect()" /><label for="r1_g2">Rectangle belongs to the group #2</label>
|
|
|
|
</p>
|
|
|
|
<div id="test"></div>
|
|
|
|
<p>That's all Folks!</p>
|
|
|
|
</body>
|
|
|
|
</html>
|