| 1 |
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" > |
| 2 |
<head> |
| 3 |
<title>Testing image 3</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 |
<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 |
|
| 17 |
var surface, image = null, grid_size = 1000, grid_step = 50, surface2, image2 |
| 18 |
m = dojox.gfx.matrix; |
| 19 |
|
| 20 |
makeShapes = function(){ |
| 21 |
surface = dojox.gfx.createSurface("test", 800, 600); |
| 22 |
/* SVGWEB { */ |
| 23 |
surface.whenLoaded(function() { |
| 24 |
for(var i = 0; i <= grid_size; i += grid_step){ |
| 25 |
surface.createLine({x1: 0, x2: grid_size, y1: i, y2: i}).setStroke("black"); |
| 26 |
surface.createLine({y1: 0, y2: grid_size, x1: i, x2: i}).setStroke("black"); |
| 27 |
} |
| 28 |
image = surface.createImage({width: 150, height: 100, src: "../images/eugene-sm.jpg"}); |
| 29 |
image.connect("onclick", function(){ alert("You didn't expect a download, did you?"); }); |
| 30 |
}); |
| 31 |
/* } */ |
| 32 |
|
| 33 |
//create second test |
| 34 |
surface2 = dojox.gfx.createSurface("test2", 600, 600); |
| 35 |
/* SVGWEB { */ |
| 36 |
surface2.whenLoaded(function() { |
| 37 |
image2 = surface2.createImage({width: 150, height: 100, src: "../images/eugene-sm.jpg"}); |
| 38 |
}); |
| 39 |
/* } */ |
| 40 |
}; |
| 41 |
|
| 42 |
transformImage = function(){ |
| 43 |
if(window.scaled){ |
| 44 |
surface.setDimensions(800,600); |
| 45 |
image.setTransform({}); |
| 46 |
|
| 47 |
surface2.setDimensions(600,600); |
| 48 |
image2.setTransform({}); |
| 49 |
}else{ |
| 50 |
surface.setDimensions(1000,600); |
| 51 |
image.setTransform({xx: 6, yy: 6}); |
| 52 |
|
| 53 |
surface2.setDimensions(800,600); |
| 54 |
image2.setTransform({xx: 5, yy: 5}); |
| 55 |
} |
| 56 |
window.scaled=!window.scaled; |
| 57 |
}; |
| 58 |
|
| 59 |
dojo.addOnLoad(makeShapes); |
| 60 |
|
| 61 |
</script> |
| 62 |
</head> |
| 63 |
<body> |
| 64 |
<h1>dojox.gfx Image tests</h1> |
| 65 |
<p>Clicking the following button should enlarge the surface and the image.<br> |
| 66 |
In the first Test: The image should not be cropped on the right and the background of grid should be red.<br> |
| 67 |
In the secondd test: the cavas should stay the same size, the image is increased and scrollbars appear |
| 68 |
</p> |
| 69 |
<p> |
| 70 |
<input type="button" onclick="transformImage()" value="scale/reset"/><br /> |
| 71 |
</p> |
| 72 |
<div id="test" style="background-color:red"></div> |
| 73 |
<p>second test with overflow=auto</p> |
| 74 |
<div style="overflow:auto;background-color:red;width:602px;height:602px;"><div id="test2"></div></div> |
| 75 |
<p>That's all Folks!</p> |
| 76 |
</body> |
| 77 |
</html> |