UNPKG

dojox

Version:

Dojo eXtensions, a rollup of many useful sub-projects and varying states of maturity – from very stable and robust, to alpha and experimental. See individual projects contain README files for details.

59 lines (51 loc) 2.43 kB
<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" data-dojo-config="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>