X-Git-Url: https://dev.renevier.net/?a=blobdiff_plain;f=public%2Fjs%2Fsyj.js;h=85db31ac775e901508f4b65116bf498449d94fcb;hb=d52fa81549b32a16a59b17732adb19a0c6559cc1;hp=a297706556f1b0f0c406de57e3d208724e2c5ea8;hpb=e534c17db2f3986751f4a96900e4aaae56d34873;p=syj.git diff --git a/public/js/syj.js b/public/js/syj.js index a297706..85db31a 100644 --- a/public/js/syj.js +++ b/public/js/syj.js @@ -100,7 +100,12 @@ var SYJDataUi = (function() { if (!infotoggler) { infotoggler = new Toggler('path-infos-content'); $("path-infos-toggler").insert({bottom: infotoggler.element}); - $("path-infos-anchor").observe('click', function(evt) { + var anchor = $("path-infos-anchor"); + var parent = anchor.up('.menu-item'); + if (parent) { + anchor = parent; + } + anchor.observe('click', function(evt) { evt.stop(); infotoggler.toggle(evt); }); @@ -283,7 +288,11 @@ var SYJView = { theme: null }); - baseLayer = new OpenLayers.Layer.OSM("OSM", null, { wrapDateLine: true , attribution: SyjStrings.osmAttribution }); + baseLayer = new OpenLayers.Layer.OSM("OSM", [ + 'http://a.tile.openstreetmap.org/${z}/${x}/${y}.png', + 'http://b.tile.openstreetmap.org/${z}/${x}/${y}.png', + 'http://c.tile.openstreetmap.org/${z}/${x}/${y}.png'], + { wrapDateLine: true , attribution: SyjStrings.osmAttribution }); layerOptions = {format: OpenLayers.Format.WKT, projection: WGS84, @@ -441,6 +450,13 @@ var SYJView = { } else { this.map.setCenter(center, zoom); } + this.resizeMap(); + }, + + resizeMap: function() { + var map = $('map'); + map.style.width = map.offsetWidth.toString() + 'px'; + map.style.height = map.offsetHeight.toString() + 'px'; }, observer: function(evt) { @@ -651,7 +667,12 @@ var SYJModalClass = Class.create({ closeMethods: ["onescapekey", "onouterclick", "onbutton"] }); - $(this.type + "_control_anchor").observe("click", function(evt) { + var anchor = $(this.type + '_control_anchor'); + var parent = anchor.up('.menu-item'); + if (parent) { + anchor = parent; + } + anchor.observe("click", function(evt) { this.modalbox.show(); evt.stop(); }.bindAsEventListener(this)); @@ -1272,3 +1293,7 @@ window.onbeforeunload = function() { return undefined; } }; + +window.onresize = function() { + SYJView.resizeMap(); +};