| 1 |
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" > |
| 2 |
<head> |
| 3 |
<title>Testing surface resizing</title> |
| 4 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 5 |
<style type="text/css"> |
| 6 |
@import "../../../dojo/resources/dojo.css"; |
| 7 |
@import "../../../dijit/tests/css/dijitTests.css"; |
| 8 |
</style> |
| 9 |
<script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug: true"></script> |
| 10 |
<script type="text/javascript"> |
| 11 |
dojo.require("dojox.gfx"); |
| 12 |
dojo.require("dojox.gfx.shape"); |
| 13 |
dojo.require("dojox.gfx.path"); |
| 14 |
dojo.require("dojox.gfx.arc"); |
| 15 |
|
| 16 |
var surface; |
| 17 |
|
| 18 |
createSurface = function(){ |
| 19 |
surface = dojox.gfx.createSurface("test", 500, 500); |
| 20 |
surface.whenLoaded(makeShapes); |
| 21 |
}; |
| 22 |
|
| 23 |
makeShapes = function(){ |
| 24 |
surface.createRect({width: 300, height: 300}).setFill([255, 0, 0, 0.3]).setStroke("red"); |
| 25 |
surface.createRect({x: 200, y: 200, width: 300, height: 300}).setFill([0, 0, 255, 0.3]).setStroke("green"); |
| 26 |
}; |
| 27 |
|
| 28 |
getDim = function(){ |
| 29 |
var t = surface.getDimensions(); |
| 30 |
alert("dimensions: " + t.width + " by " + t.height); |
| 31 |
}; |
| 32 |
|
| 33 |
make500x500 = function(){ surface.setDimensions(500, 500); }; |
| 34 |
make400x400 = function(){ surface.setDimensions(400, 400); }; |
| 35 |
make300x300 = function(){ surface.setDimensions(300, 300); }; |
| 36 |
|
| 37 |
dojo.addOnLoad(createSurface); |
| 38 |
|
| 39 |
</script> |
| 40 |
</head> |
| 41 |
<body> |
| 42 |
<h1>Testing surface resizing</h1> |
| 43 |
|
| 44 |
<p> |
| 45 |
<button onclick="getDim();">getDimensions</button> |
| 46 |
|
| 47 |
<button onclick="make300x300();">Make 300x300</button> |
| 48 |
|
| 49 |
<button onclick="make400x400();">Make 400x400</button> |
| 50 |
|
| 51 |
<button onclick="make500x500();">Make 500x500</button> |
| 52 |
</p> |
| 53 |
<div id="test" style="width: 500px; height: 500px;"></div> |
| 54 |
<p>That's all Folks!</p> |
| 55 |
</body> |
| 56 |
</html> |