diff options
Diffstat (limited to 'misc/openlayers/tests/manual/page-position.html')
-rw-r--r-- | misc/openlayers/tests/manual/page-position.html | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/misc/openlayers/tests/manual/page-position.html b/misc/openlayers/tests/manual/page-position.html new file mode 100644 index 0000000..a59dfde --- /dev/null +++ b/misc/openlayers/tests/manual/page-position.html @@ -0,0 +1,103 @@ +<!DOCTYPE HTML> +<html> + <head> + <title>Page Position Test</title> + + <link rel="stylesheet" href="../../theme/default/style.css" type="text/css" /> + <link rel="stylesheet" href="../../examples/style.css" type="text/css" /> + <style type="text/css"> + #mapwrap { + border: 10px solid red; + width: 532px; + height: 276px; + } + #map { + position: absolute; + border: 10px solid #ccc; + width: 512px; + height: 256px; + } + #controlToggle li { + list-style: none; + } + p { + width: 512px; + } + #scrollspace { + height: 500px; + } + </style> + <script src="../../lib/OpenLayers.js"></script> + <script type="text/javascript"> + var map, drawControls; + function init(){ + map = new OpenLayers.Map('map'); + + var wmsLayer = new OpenLayers.Layer.WMS( "OpenLayers WMS", + "http://vmap0.tiles.osgeo.org/wms/vmap0?", {layers: 'basic'}); + + var lineLayer = new OpenLayers.Layer.Vector("Line Layer"); + + map.addLayers([wmsLayer, lineLayer]); + map.addControl(new OpenLayers.Control.LayerSwitcher()); + map.addControl(new OpenLayers.Control.MousePosition()); + + drawControl = new OpenLayers.Control.DrawFeature(lineLayer, + OpenLayers.Handler.Path); + + map.addControl(drawControl); + + map.setCenter(new OpenLayers.LonLat(0, 0), 3); + + document.getElementById('noneToggle').checked = true; + } + + function toggleControl(element) { + var control = drawControl; + if(element.value == "draw" && element.checked) { + control.activate(); + } else { + control.deactivate(); + } + } + </script> + </head> + <body onload="init()"> + <h1 id="title">OpenLayers Page Position Test</h1> + + <p id="shortdesc"> + Test if borders and scroll position cause unwanted offsets on the + mouse positions reported by map events. + </p> + <div id="mapwrap"> + <div id="map"></div> + </div> + + <ul id="controlToggle"> + <li> + <input type="radio" name="type" value="none" id="noneToggle" + onclick="toggleControl(this);" checked="checked" /> + <label for="noneToggle">navigate</label> + </li> + <li> + <input type="radio" name="type" value="draw" id="lineToggle" onclick="toggleControl(this);" /> + <label for="lineToggle">draw line</label> + </li> + </ul> + + <div id="docs"> + <p>This map's div has a border and absolute positioning, wrapped + by a container which also has a border. The page is also + scrollable. Neither the borders nor scrolling the page should + result in unwanted offsets on pixel positions reported by map + events.</p> + <p>With the line drawing control active, click on the map to add a + point. The point should be drawn at the exact mouse location.</p> + <p>With the navigation control active, shift-drag a zoom rectangle. + The rectangle's corner should align exactly with the mouse + cursor.</p> + <p>Scroll the page and repeat the above tests.</p> + <div id="scrollspace"><div> + </div> + </body> +</html> |