Ignore:
Timestamp:
2015-03-11T10:12:30+13:00 (9 years ago)
Author:
davidb
Message:

Changes so i) the choose-palette is a single interactive SVG csurface; 2) the JS runs more smoothly when 'started' at one of the later pages; and 3) changes to remove many of the warnings browsers produce when loading the page

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/nz-flag-design/trunk/main-form/choose-canvas.html

    r29740 r29773  
    3232            <p>If you hover the mouse over a flag size, you will be able to see some countries that currently use that ratio!</p>
    3333            <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>
     34                <div class="ratioDiv flagHover" id="ratio23" onclick="updateCanvasDimensions(2, 3)" title="2:3"></div>
     35                <div class="ratioDiv" style="border-width:2px;" id="ratio12" onclick="updateCanvasDimensions(1, 2)" title="1:2"></div>
     36                <div class="ratioDiv" id="ratio35" onclick="updateCanvasDimensions(3, 5)" title="3:5"></div>
    3737                <div style="clear: both"></div>
    3838            </div>
     
    4040
    4141            <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>
     42                <div class="ratioDiv" id="ratio1019" onclick="updateCanvasDimensions(10, 19)" title="10:19"></div>
     43                <div class="ratioDiv" id="ratio58" onclick="updateCanvasDimensions(5, 8)" title="5:8"></div>
     44                <div class="ratioDiv" id="ratio811" onclick="updateCanvasDimensions(8, 11)" title="8:11"></div>
    4545                <div style="clear: both"></div>
    4646            </div>           
     
    5252            var currentRatio = "ratio12";       
    5353           
    54             function updateCanvasDimentions(height, width) {
     54            function updateCanvasDimensions(height, width) {
    5555                // Show feedback by highlighting the chosen square
    5656                document.getElementById(currentRatio).style.borderColor = 'black';
     57                document.getElementById(currentRatio).style.borderWidth = '1px';
    5758                currentRatio = "ratio" + height + width;
    5859                document.getElementById(currentRatio).style.borderColor = 'white';
     60                document.getElementById(currentRatio).style.borderWidth = '2px';
    5961               
    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;
     62                // Changing the value of sizeConstant will change the
     63                //  size of the svg canvas without affecting the
     64            //  width/height ratios
     65
     66            var sizeConstant = 400;
    6567               
    6668                var h = sizeConstant;
    6769                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);
     70
     71            if (typeof flagCanvasSettings !== 'undefined') {
     72                  flagCanvasSettings.width = w;
     73                  flagCanvasSettings.height = h;
     74            }                               
    7475            }
    7576        </script>
Note: See TracChangeset for help on using the changeset viewer.