1 | <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" > |
---|
2 | <head> |
---|
3 | <title>Testing image 4</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 | <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug: true"></script> |
---|
10 | <!--<script type="text/javascript" src="../vml.js"></script>--> |
---|
11 | <!--<script type="text/javascript" src="../svg.js"></script>--> |
---|
12 | <!--<script type="text/javascript" src="../silverlight.js"></script>--> |
---|
13 | <script type="text/javascript"> |
---|
14 | dojo.require("dojox.gfx"); |
---|
15 | dojo.require("dojo.colors"); |
---|
16 | |
---|
17 | var grid_size = 200, grid_step = 20; |
---|
18 | |
---|
19 | createSurface = function(){ |
---|
20 | var surface = dojox.gfx.createSurface("test", grid_size, grid_size) |
---|
21 | surface.whenLoaded(makeShapes); |
---|
22 | }; |
---|
23 | |
---|
24 | makeShapes = function(surface){ |
---|
25 | var g = dojox.gfx, m = g.matrix; |
---|
26 | |
---|
27 | for(var i = 0; i <= grid_size; i += grid_step){ |
---|
28 | surface.createLine({x1: 0, x2: grid_size, y1: i, y2: i}).setStroke("grey"); |
---|
29 | surface.createLine({y1: 0, y2: grid_size, x1: i, x2: i}).setStroke("grey"); |
---|
30 | } |
---|
31 | |
---|
32 | var rect1 = surface.createRect({x: 50, y: 50, width: 100, height: 100, r: 5}).setFill("red").setStroke("black"); |
---|
33 | var img1 = surface.createImage({width: 75, height: 50, src: "images/eugene-sm.jpg"}). |
---|
34 | setTransform([m.translate(50, 0), m.rotateg(45)]); |
---|
35 | var rect2 = surface.createRect({x: 75, y: 25, width: 50, height: 150, r: 5}).setFill("yellow").setStroke("black"); |
---|
36 | var img2 = surface.createImage({width: 75, height: 50, src: "images/eugene-sm.jpg"}). |
---|
37 | setTransform([m.translate(50, 120), m.rotateg(-45)]); |
---|
38 | var rect3 = surface.createRect({x: 25, y: 75, width: 150, height: 50, r: 5}).setFill("green").setStroke("black"); |
---|
39 | |
---|
40 | img1.connect("onclick", function(){ alert("image #1"); }); |
---|
41 | img2.connect("onclick", function(){ alert("image #2"); }); |
---|
42 | |
---|
43 | rect1.connect("onclick", function(){ alert("red"); }); |
---|
44 | rect2.connect("onclick", function(){ alert("yellow"); }); |
---|
45 | rect3.connect("onclick", function(){ alert("green"); }); |
---|
46 | }; |
---|
47 | |
---|
48 | dojo.addOnLoad(createSurface); |
---|
49 | |
---|
50 | </script> |
---|
51 | </head> |
---|
52 | <body> |
---|
53 | <h1>dojox.gfx Image event tests</h1> |
---|
54 | <p>Note: Silverlight doesn't allow downloading images when run from a file system. This demo should be run from a server.</p> |
---|
55 | <div id="test"></div> |
---|
56 | <p>That's all Folks!</p> |
---|
57 | </body> |
---|
58 | </html> |
---|