From 12376baf148afee289fbb53dd16ee2a0841d5290 Mon Sep 17 00:00:00 2001 From: arno Date: Sat, 8 Aug 2009 12:59:55 +0200 Subject: [PATCH] option to show popup near marker --- inc/settings.php | 4 ++++ inc/templates_index.php | 6 ++++++ js/syp.js | 9 +++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/inc/settings.php b/inc/settings.php index 50797f0..5d4910a 100644 --- a/inc/settings.php +++ b/inc/settings.php @@ -46,4 +46,8 @@ define ("THUMBSDIRURL", ""); // max size (either width or height) of thumbnails. If one dimension of // uploaded image is bigger, images will be resized. define ("THUMBSMAXSIZE", 400); + +// if set to 0 (default), popup will appear at bottom right corner of the map. +// If set to 1 or true, popup will appear near marker. +define ("POPUPNEARFEATURE", 0); ?> diff --git a/inc/templates_index.php b/inc/templates_index.php index 722daa9..9f54d3b 100644 --- a/inc/templates_index.php +++ b/inc/templates_index.php @@ -49,6 +49,12 @@ if (defined ("THUMBSMAXSIZE") && (THUMBSMAXSIZE > 0)) { diff --git a/js/syp.js b/js/syp.js index cf92ef5..2c87c2b 100644 --- a/js/syp.js +++ b/js/syp.js @@ -169,7 +169,12 @@ var SYP = { } var popup = feature.popup; - var brCorner = SYP.Utils.brCorner(map, 8); + var popupPos = null; + if (sypPopupNearFeature) { + popupPos = feature.geometry.getBounds().getCenterLonLat(); + } else { + popupPos = 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. @@ -189,7 +194,7 @@ var SYP = { this.map.events.register("movestart", this, this._unselect = function () { this.unselect(feature)}); return; } - popup = SYP.createPopup(brCorner, contentHTML); + popup = SYP.createPopup(popupPos, contentHTML); var control = this; popup.hide = function () { OpenLayers.Element.hide(this.div); -- 2.39.2