diff --git a/html/force.js b/html/force.js index 56a3f15..e0aacff 100644 --- a/html/force.js +++ b/html/force.js @@ -27,8 +27,6 @@ function getOffset( el ) { return { top: _y, left: _x } } -var offset = getOffset(document.getElementById('chart')) - var w, h resize() diff --git a/html/geomap.html b/html/geomap.html index 229dcee..26682c8 100644 --- a/html/geomap.html +++ b/html/geomap.html @@ -1,36 +1,61 @@ + - - - - + + + + - - box-sizing:border-box; + Freifunk Lübeck - Knotenkarte - } - .olPopup p { margin:0px; } - + + + + - Freifunk Lübeck - Knotenkarte + - - - - + function getOffset( el ) { + var _x = 0, _y = 0 - -
-

luebeck.freifunk.net

- -
-
- + while( el && !isNaN( el.offsetLeft ) && !isNaN( el.offsetTop ) ) { + _x += el.offsetLeft - el.scrollLeft + _y += el.offsetTop - el.scrollTop + el = el.offsetParent + } + return { top: _y, left: _x } + } + + function resize() { + var offset = getOffset(document.getElementById('map')) + + var w = window.innerWidth - offset.left + var h = window.innerHeight - offset.top - 1 + + d3.select("#map").style("width", w+"px").style("height", h+"px") + resizeMap() + } + + + + +
+

luebeck.freifunk.net

+ +
+
+ diff --git a/html/geomap.js b/html/geomap.js index b2b0297..9eb4c08 100644 --- a/html/geomap.js +++ b/html/geomap.js @@ -1,4 +1,5 @@ var map; +var vectorLayer; OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control); @@ -43,6 +44,17 @@ function init() load_json(vectorLayer, map) } +function resizeMap() +{ + if (map !== undefined) { + map.updateSize() + + // Did someone say Chrome bug? + map.removeLayer(vectorLayer) + map.addLayer(vectorLayer) + } +} + function onPopupClose(evt) { selectControl.unselect(selectedFeature); @@ -54,7 +66,7 @@ function onFeatureSelect(feature) popup = new OpenLayers.Popup.FramedCloud("chicken", feature.geometry.getBounds().getCenterLonLat(), new OpenLayers.Size(100,150), - "
Name:"+feature.attributes.name+"
Description:"+feature.attributes.description+"
", + "
Name: "+feature.attributes.name+"
Description: "+feature.attributes.description+"
", null, true, onPopupClose); feature.popup = popup; map.addPopup(popup);