1 | <!DOCTYPE html>
|
---|
2 | <html id="story">
|
---|
3 | <head>
|
---|
4 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
---|
5 | <meta name="viewport" content="width=device-width, initial-scale=1"/>
|
---|
6 | <title>Canvas Size</title>
|
---|
7 |
|
---|
8 | </head>
|
---|
9 | <body>
|
---|
10 | <div data-role="page" id="choose-canvas-page"
|
---|
11 | class="demo-page"
|
---|
12 | data-dom-cache="true"
|
---|
13 | data-prev="index"
|
---|
14 | data-next="choose-palette">
|
---|
15 |
|
---|
16 | <div data-role="content">
|
---|
17 |
|
---|
18 | <div data-role="controlgroup" class="control" data-mini="true">
|
---|
19 | <a href="#" class="next right-button res-fwd" style="right:1%;"></a>
|
---|
20 | <a href="#" class="prev left-button gen-back" style="left:1%;"></a>
|
---|
21 | </div>
|
---|
22 |
|
---|
23 | <div class="story-page">
|
---|
24 |
|
---|
25 | <!-- put custom content here -->
|
---|
26 | <span class="left story-icon idea" ></span>
|
---|
27 | <h2>Canvas Size</h2>
|
---|
28 |
|
---|
29 | <div class="dialog" id="dialog" title="Ratio Select Dialog" width="800px">
|
---|
30 | <br><br>
|
---|
31 | <h2>Please choose from the following aspect ratios.</h2>
|
---|
32 | <p>If you hover the mouse over a flag size, you will be able to see some countries that currently use that ratio!</p>
|
---|
33 | <div class="centredDiv">
|
---|
34 | <div class="ratioDiv flagHover" id="ratio23" onclick="updateCanvasDimentions(2, 3)" title="2:3"></div>
|
---|
35 | <div class="ratioDiv" id="ratio12" onclick="updateCanvasDimentions(1, 2)" title="1:2"></div>
|
---|
36 | <div class="ratioDiv" id="ratio35" onclick="updateCanvasDimentions(3, 5)" title="3:5"></div>
|
---|
37 | <div style="clear: both"></div>
|
---|
38 | </div>
|
---|
39 | <p class="optionline">2:3 1:2 3:5</p><br>
|
---|
40 |
|
---|
41 | <div class="centredDiv">
|
---|
42 | <div class="ratioDiv" id="ratio1019" onclick="updateCanvasDimentions(10, 19)" title="10:19"></div>
|
---|
43 | <div class="ratioDiv" id="ratio58" onclick="updateCanvasDimentions(5, 8)" title="5:8"></div>
|
---|
44 | <div class="ratioDiv" id="ratio811" onclick="updateCanvasDimentions(8, 11)" title="8:11"></div>
|
---|
45 | <div style="clear: both"></div>
|
---|
46 | </div>
|
---|
47 | <p class="optionline">10:19 5:8 8:11</p>
|
---|
48 | </div>
|
---|
49 |
|
---|
50 | <script>
|
---|
51 | // Variable for the currently selected flag ratio
|
---|
52 | var currentRatio = "ratio12";
|
---|
53 |
|
---|
54 | function updateCanvasDimentions(height, width) {
|
---|
55 | // Show feedback by highlighting the chosen square
|
---|
56 | document.getElementById(currentRatio).style.borderColor = 'black';
|
---|
57 | currentRatio = "ratio" + height + width;
|
---|
58 | document.getElementById(currentRatio).style.borderColor = 'white';
|
---|
59 |
|
---|
60 | var design_frame = document.getElementById('design-2d-iframe');
|
---|
61 | var svgCanvas = design_frame.contentWindow.svgCanvas;
|
---|
62 |
|
---|
63 | // Changing the value of sizeConstant will change the size of the svg canvas without affecting the width/height ratios
|
---|
64 | var sizeConstant = 400;
|
---|
65 |
|
---|
66 | var h = sizeConstant;
|
---|
67 | var w = (sizeConstant / height) * width;
|
---|
68 |
|
---|
69 | flagCanvasSettings.width = w;
|
---|
70 | flagCanvasSettings.height = h;
|
---|
71 |
|
---|
72 | // Set the new canvas size
|
---|
73 | svgCanvas.setResolution(w, h);
|
---|
74 | }
|
---|
75 | </script>
|
---|
76 |
|
---|
77 | <!-- end of putting custom content -->
|
---|
78 |
|
---|
79 | </div> <!-- end story-page-->
|
---|
80 |
|
---|
81 | </div><!-- /content -->
|
---|
82 |
|
---|
83 | </div><!-- /page -->
|
---|
84 |
|
---|
85 | </body>
|
---|
86 | </html>
|
---|