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 | <!-- SVGWEB { --> |
---|
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 | dojo.require("dojo.colors"); |
---|
17 | |
---|
18 | makeShapes = function(){ |
---|
19 | var g = dojox.gfx, m = g.matrix; |
---|
20 | |
---|
21 | var grid_size = 200, grid_step = 20, |
---|
22 | surface = g.createSurface("test", grid_size, grid_size) |
---|
23 | /* SVGWEB { */ |
---|
24 | surface.whenLoaded(function() { |
---|
25 | for(var i = 0; i <= grid_size; i += grid_step){ |
---|
26 | surface.createLine({x1: 0, x2: grid_size, y1: i, y2: i}).setStroke("grey"); |
---|
27 | surface.createLine({y1: 0, y2: grid_size, x1: i, x2: i}).setStroke("grey"); |
---|
28 | } |
---|
29 | |
---|
30 | var rect1 = surface.createRect({x: 50, y: 50, width: 100, height: 100, r: 5}).setFill("red").setStroke("black"); |
---|
31 | var img1 = surface.createImage({width: 75, height: 50, src: "../images/eugene-sm.jpg"}). |
---|
32 | setTransform([m.translate(50, 0), m.rotateg(45)]); |
---|
33 | var rect2 = surface.createRect({x: 75, y: 25, width: 50, height: 150, r: 5}).setFill("yellow").setStroke("black"); |
---|
34 | var img2 = surface.createImage({width: 75, height: 50, src: "../images/eugene-sm.jpg"}). |
---|
35 | setTransform([m.translate(50, 120), m.rotateg(-45)]); |
---|
36 | var rect3 = surface.createRect({x: 25, y: 75, width: 150, height: 50, r: 5}).setFill("green").setStroke("black"); |
---|
37 | |
---|
38 | img1.connect("onclick", function(){ alert("image #1"); }); |
---|
39 | img2.connect("onclick", function(){ alert("image #2"); }); |
---|
40 | |
---|
41 | rect1.connect("onclick", function(){ alert("red"); }); |
---|
42 | rect2.connect("onclick", function(){ alert("yellow"); }); |
---|
43 | rect3.connect("onclick", function(){ alert("green"); }); |
---|
44 | }); |
---|
45 | /* } */ |
---|
46 | }; |
---|
47 | |
---|
48 | dojo.addOnLoad(makeShapes); |
---|
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> |
---|