[Mapbender-commits] r5400 - trunk/mapbender/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Sat Jan 23 15:47:51 EST 2010
Author: christoph
Date: 2010-01-23 15:47:51 -0500 (Sat, 23 Jan 2010)
New Revision: 5400
Modified:
trunk/mapbender/http/javascripts/geometry.js
trunk/mapbender/http/javascripts/map.php
Log:
Modified: trunk/mapbender/http/javascripts/geometry.js
===================================================================
--- trunk/mapbender/http/javascripts/geometry.js 2010-01-22 08:22:29 UTC (rev 5399)
+++ trunk/mapbender/http/javascripts/geometry.js 2010-01-23 20:47:51 UTC (rev 5400)
@@ -1644,6 +1644,10 @@
if(t == geomType.point) {
var poiIcon = g.e.getElementValueByName("Mapbender:icon");
+ var poiOffsetX = parseInt(g.e.getElementValueByName("Mapbender:iconOffsetX"), 10);
+
+ var poiOffsetY = parseInt(g.e.getElementValueByName("Mapbender:iconOffsetY"), 10);
+
for(var i=0, ilen = g.count(); i < ilen; i++){
var currentGeom = g.get(i);
var p = realToMap(mapframe, currentGeom.get(0));
@@ -1660,7 +1664,7 @@
) {
// if the point contains a link to an icon, display the icon
if (poiIcon) {
- displayIcon(poiIcon, px, py);
+ displayIcon(poiIcon, px, py, poiOffsetX, poiOffsetY);
}
else {
drawCircle(px-1, py-1, diameter,col);
@@ -1779,11 +1783,19 @@
* @param {Float} x x coordinate within the map frame
* @param {Float} y y coordinate within the map frame
*/
- var displayIcon = function (url, x, y) {
+ var displayIcon = function (url, x, y, offsetX, offsetY) {
+
+ if (typeof offsetX !== "number") {
+ offsetX = -40;
+ }
+
+ if (typeof offsetY !== "number") {
+ offsetY = -40;
+ }
if(ie){
var newImg = document.createElement("img");
- var newImgTop = y - Math.round(80/2);
- var newImgLeft = x - Math.round(80/2);
+ var newImgTop = y + offsetY;
+ var newImgLeft = x + offsetX;
that.canvasDivTag.getTag().innerHTML = "<img name='mapSymbol' id='mapSymbol' src='" + url + "' style='position:absolute;top:"+newImgTop+";left:"+newImgLeft+";z-index:100'/>";
}
else{
@@ -1797,8 +1809,8 @@
newImg.style.position = "absolute";
// center the image at x, y
- newImg.style.top = y - Math.round(80/2);
- newImg.style.left = x - Math.round(80/2);
+ newImg.style.top = y + offsetY;
+ newImg.style.left = x + offsetX;
// newImg.style.top = y - Math.round(80);
// newImg.style.left = x;
newImg.style.zIndex = 100;
Modified: trunk/mapbender/http/javascripts/map.php
===================================================================
--- trunk/mapbender/http/javascripts/map.php 2010-01-22 08:22:29 UTC (rev 5399)
+++ trunk/mapbender/http/javascripts/map.php 2010-01-23 20:47:51 UTC (rev 5400)
@@ -90,6 +90,7 @@
"point.js",
"button.js",
"extent.js",
+ "marker.js",
"backwards_compatibility_to_2.6.js"
);
@@ -257,4 +258,4 @@
});
JS;
-?>
\ No newline at end of file
+?>
More information about the Mapbender_commits
mailing list