source: Dev/trunk/src/client/dojox/gfx/tests/test_image3.html

Last change on this file was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

  • Property svn:executable set to *
File size: 2.4 KB
Line 
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<script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug: true"></script>
10<script type="text/javascript">
11dojo.require("dojox.gfx");
12
13var surface, image = null, grid_size = 1000, grid_step = 50, surface2, image2
14        m = dojox.gfx.matrix;
15
16createSurface = function(){
17        surface = dojox.gfx.createSurface("test", 800, 600);
18        surface.whenLoaded(makeShapes);
19
20    //create second test
21    surface2 = dojox.gfx.createSurface("test2", 600, 600);
22        surface2.whenLoaded(makeShapes2);
23};
24
25makeShapes = function(surface){
26        for(var i = 0; i <= grid_size; i += grid_step){
27                surface.createLine({x1: 0, x2: grid_size, y1: i, y2: i}).setStroke("black");
28                surface.createLine({y1: 0, y2: grid_size, x1: i, x2: i}).setStroke("black");
29        }
30    image = surface.createImage({width: 150, height: 100, src: "images/eugene-sm.jpg"});
31    image.connect("onclick", function(){ alert("You didn't expect a download, did you?"); });
32};
33
34makeShapes2 = function(surface){
35    image2 = surface.createImage({width: 150, height: 100, src: "images/eugene-sm.jpg"});
36};
37
38transformImage = function(){
39        if(window.scaled){
40                surface.setDimensions(800,600);
41                image.setTransform({});
42               
43                surface2.setDimensions(600,600);
44                image2.setTransform();
45        }else{
46                surface.setDimensions(1000,600);
47            image.setTransform({xx: 6, yy: 6});
48
49            surface2.setDimensions(800,600);
50            image2.setTransform({xx: 5, yy: 5});
51        }
52        window.scaled=!window.scaled;
53};
54
55dojo.addOnLoad(createSurface);
56
57</script>
58</head>
59<body>
60<h1>dojox.gfx Image tests</h1>
61<p>Clicking the following button should enlarge the surface and the image.<br>
62In the first Test: The image should not be cropped on the right and the background of grid should be red.<br>
63In the secondd test: the cavas should stay the same size, the image is increased and scrollbars appear
64        </p>
65<p>
66<input type="button" onclick="transformImage()" value="scale/reset"/><br />
67</p>
68<div id="test" style="background-color:red"></div>
69<p>second test with overflow=auto</p>
70<div style="overflow:auto;background-color:red;width:602px;height:602px;"><div id="test2"></div></div>
71<p>That's all Folks!</p>
72</body>
73</html>
Note: See TracBrowser for help on using the repository browser.