Files
openlayers/master/examples/test_image4.html
Éric Lemoine 5d14b9e2d4 Updated
2013-02-20 10:38:25 +01:00

59 lines
2.4 KiB
HTML

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" >
<head>
<title>Testing image 4</title>
<style type="text/css">
@import "../../../../dojo/resources/dojo.css";
@import "../../../../dijit/tests/css/dijitTests.css";
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- SVGWEB { -->
<meta name="svg.render.forceflash" content="true"/>
<script src="svgweb/src/svg.js" data-path="svgweb/src"></script>
<script src="../../../../dojo/dojo.js" djConfig="isDebug:true,forceGfxRenderer:'svg'" type="text/javascript"></script>
<!-- } -->
<script type="text/javascript">
dojo.require("dojox.gfx");
dojo.require("dojo.colors");
makeShapes = function(){
var g = dojox.gfx, m = g.matrix;
var grid_size = 200, grid_step = 20,
surface = g.createSurface("test", grid_size, grid_size)
/* SVGWEB { */
surface.whenLoaded(function() {
for(var i = 0; i <= grid_size; i += grid_step){
surface.createLine({x1: 0, x2: grid_size, y1: i, y2: i}).setStroke("grey");
surface.createLine({y1: 0, y2: grid_size, x1: i, x2: i}).setStroke("grey");
}
var rect1 = surface.createRect({x: 50, y: 50, width: 100, height: 100, r: 5}).setFill("red").setStroke("black");
var img1 = surface.createImage({width: 75, height: 50, src: "../images/eugene-sm.jpg"}).
setTransform([m.translate(50, 0), m.rotateg(45)]);
var rect2 = surface.createRect({x: 75, y: 25, width: 50, height: 150, r: 5}).setFill("yellow").setStroke("black");
var img2 = surface.createImage({width: 75, height: 50, src: "../images/eugene-sm.jpg"}).
setTransform([m.translate(50, 120), m.rotateg(-45)]);
var rect3 = surface.createRect({x: 25, y: 75, width: 150, height: 50, r: 5}).setFill("green").setStroke("black");
img1.connect("onclick", function(){ alert("image #1"); });
img2.connect("onclick", function(){ alert("image #2"); });
rect1.connect("onclick", function(){ alert("red"); });
rect2.connect("onclick", function(){ alert("yellow"); });
rect3.connect("onclick", function(){ alert("green"); });
});
/* } */
};
dojo.addOnLoad(makeShapes);
</script>
</head>
<body>
<h1>dojox.gfx Image event tests</h1>
<p>Note: Silverlight doesn't allow downloading images when run from a file system. This demo should be run from a server.</p>
<div id="test"></div>
<p>That's all Folks!</p>
</body>
</html>