]> dev.renevier.net Git - syp.git/commitdiff
do not display popup when there is no content at all
authorarno <arenevier@fdn.fr>
Sat, 25 Jul 2009 14:27:55 +0000 (16:27 +0200)
committerarno <arenevier@fdn.fr>
Sat, 25 Jul 2009 14:47:44 +0000 (16:47 +0200)
js/syp.js

index e350d88af3ea303dbe1aeeae820351ff8d6fdc5f..d83b1fefe44801cfb69318dc671cac378c54820d 100644 (file)
--- a/js/syp.js
+++ b/js/syp.js
@@ -136,7 +136,11 @@ var SYP = {
         if (permaControl[0]) {
             permaControl[0].div.style.display = "";
         }
-        var popup = feature.popup;
+        if (!feature.popup) {
+            this.map.events.unregister("movestart", this, this._unselect);
+            return;
+        }
+        popup = feature.popup;
         if (popup.visible()) {
             popup.hide();
         }
@@ -154,7 +158,7 @@ var SYP = {
 
         // 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;
@@ -166,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 () {