]> dev.renevier.net Git - syp.git/blob - pan-redraw-svg.html
ec1126b942d5adcb43ed6bb7c3eb0a7605f520d2
[syp.git] / pan-redraw-svg.html
1 <html xmlns="http://www.w3.org/1999/xhtml">
2   <head>
3     <link rel="stylesheet" href="../../theme/default/style.css" type="text/css" />
4     <style type="text/css">
5         #map {
6             width: 512px;
7             height: 512px;
8             border: 1px solid gray;
9         }
10     </style>
11
12     <script src="../../lib/OpenLayers.js"></script>
13     <script type="text/javascript">
14         var map, point;
15
16         function init(){
17             var options = {
18                 projection: new OpenLayers.Projection("EPSG:900913"),
19                 displayProjection: new OpenLayers.Projection("EPSG:4326"),
20                 units: "m",
21                 maxResolution: 20, //0.07464553542137146,
22                 maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
23                                                  20037508, 20037508.34)
24             };
25             map = new OpenLayers.Map('map', options);
26             var vector = new OpenLayers.Layer.Vector(
27                     "Vectors",
28                     {isBaseLayer: true}
29             );
30             map.addLayer(vector);
31
32             var x =  -20000;//4.33791754;
33             var y = 20000;
34             point = new OpenLayers.Feature.Vector(
35                 new OpenLayers.Geometry.Point(x, y)
36             );
37             
38             map.addLayer(vector);
39             vector.addFeatures([point]);
40             map.setCenter(new OpenLayers.LonLat(0, 0), 5);
41         }
42         
43         function pan(){
44             map.panTo(point.geometry.getBounds().getCenterLonLat());
45         }
46
47     </script>
48   </head>
49   <body onload="init()">
50     <h3 id="title">SVG inValidRange Redraw Test Case</h3>
51     <p>Before fixing #1631, after klicking Go! no point would have appeared. The Go! button
52     pans the map over a long distance. Before dragging, the point would have been
53     outside the valid range, and the pan operation would not have triggered the SVG
54     coordinate system to be recreated. The new vector rendering takes care of all this. </p>
55     <div id="map"></div>
56     <input type="button" value="Go!" onclick="pan();"></input>
57   </body>
58 </html>