]> dev.renevier.net Git - syj.git/blobdiff - public/js/syjraw.js
some files were missing copyright information
[syj.git] / public / js / syjraw.js
index ec783f4d677685ddf82e1d4cb5fc5d267940e5eb..b07e0b984d1936e6f03b54a238e72c6f6feeddb8 100644 (file)
@@ -1,3 +1,8 @@
+/*  This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier,
+    and is published under the AGPL license. */
+
+"use strict";
+
 var WGS84 = new OpenLayers.Projection("EPSG:4326");
 var Mercator = new OpenLayers.Projection("EPSG:900913");
 
@@ -11,9 +16,18 @@ var styleMap = {
     })
 };
 
+function resizeMap() {
+    var map = document.getElementById('map');
+    map.style.width = map.offsetWidth.toString() + 'px';
+    map.style.height = map.offsetHeight.toString() + 'px';
+}
+
 function init() {
     var map = new OpenLayers.Map('map', {
-                controls: [ new OpenLayers.Control.Attribution() ],
+                controls: [
+                    new OpenLayers.Control.Navigation(),
+                    new OpenLayers.Control.Attribution()
+                ],
                 theme: null}),
 
          baseLayer = new OpenLayers.Layer.OSM("OSM", null, { attribution: SyjStrings.osmAttribution }),
@@ -28,12 +42,16 @@ function init() {
 
     map.addLayers([baseLayer, viewLayer]);
     viewLayer.addFeatures([wkt.read(gInitialGeom.data)]);
-    extent = viewLayer.getDataExtent();
+    var extent = viewLayer.getDataExtent();
     map.updateSize();
     map.zoomToExtent(extent);
-
+    resizeMap();
 }
 
+window.onresize = function() {
+    resizeMap();
+};
+
 if (window.addEventListener) {
     window.addEventListener("load", init, false);
 } else {