X-Git-Url: https://dev.renevier.net/?a=blobdiff_plain;f=js%2Fsyp.js;h=d83b1fefe44801cfb69318dc671cac378c54820d;hb=71623749afbd4c1faf523a4ef0f99320a91c68f4;hp=7e69fb75ae61b6b930101cdfce0fdf535a07aabd;hpb=0feade23ffa41ac299b252a93be4da11bc2a16b7;p=syp.git diff --git a/js/syp.js b/js/syp.js index 7e69fb7..d83b1fe 100644 --- a/js/syp.js +++ b/js/syp.js @@ -131,7 +131,16 @@ var SYP = { }, onFeatureUnselect: function (feature) { - var popup = feature.popup; + var map = feature.layer.map; + var permaControl = map.getControlsByClass("OpenLayers.Control.Permalink"); + if (permaControl[0]) { + permaControl[0].div.style.display = ""; + } + if (!feature.popup) { + this.map.events.unregister("movestart", this, this._unselect); + return; + } + popup = feature.popup; if (popup.visible()) { popup.hide(); } @@ -139,13 +148,17 @@ var SYP = { onFeatureSelect: function(feature) { var map = feature.layer.map; + var permaControl = map.getControlsByClass("OpenLayers.Control.Permalink"); + if (permaControl[0]) { + permaControl[0].div.style.display = "none"; + } var popup = feature.popup; var brCorner = SYP.Utils.brCorner(map, 8); // we cannot reuse popup; we need to recreate it in order for IE // expressions to work. Otherwise, we get a 0x0 image on second view. - if (popup) { + if (popup) { popup.destroy(); } var contentHTML; @@ -157,6 +170,10 @@ var SYP = { } else { contentHTML = feature.attributes.description; } + if (!contentHTML || !contentHTML.length) { + this.map.events.register("movestart", this, this._unselect = function () { this.unselect(feature)}); + return; + } popup = SYP.createPopup(brCorner, contentHTML); var control = this; popup.hide = function () {