[Mapbender-commits] r3689 - trunk/mapbender/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Mar 12 13:20:11 EDT 2009
Author: verenadiewald
Date: 2009-03-12 13:20:11 -0400 (Thu, 12 Mar 2009)
New Revision: 3689
Modified:
trunk/mapbender/http/javascripts/mod_tooltip.php
Log:
improved workflow
Modified: trunk/mapbender/http/javascripts/mod_tooltip.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_tooltip.php 2009-03-12 17:11:45 UTC (rev 3688)
+++ trunk/mapbender/http/javascripts/mod_tooltip.php 2009-03-12 17:20:11 UTC (rev 3689)
@@ -69,29 +69,38 @@
//buttonWfs_toDigitize_on ="0";
function mod_tooltipInit(){
-var tooltip_map = getMapObjByName(tooltipTarget);
-var ind = getMapObjIndexByName(tooltipTarget);
-var myMapObj = mb_mapObj[ind];
+ var tooltip_map = getMapObjByName(tooltipTarget);
+ var ind = getMapObjIndexByName(tooltipTarget);
+ var myMapObj = mb_mapObj[ind];
-var map_el = myMapObj.getDomElement();
+ var map_el = myMapObj.getDomElement();
$(map_el.ownerDocument).mousemove(function(event){
- var point = tooltip_map.getMousePos(event);
+ point = tooltip_map.getMousePosition(event);
//mb_getMousePos(event,myMapObj.getMousePosition(event));
- mod_tooltip_run();
+ mod_tooltip_run(point);
}).mouseout(function(){mouseMoves=0;});
}
eventInit.register(mod_tooltipInit);
-function mod_tooltip_run(){
+function mod_tooltip_run(point){
mouseMoves++;
- setTimeout("if(mouseMoves=="+mouseMoves+"&&clickX=="+clickX+"&&clickY=="+clickY+")fireRequests();",tooltip_timeDelay);
+ var currentMouseMoves = mouseMoves;
+ setTimeout(function () {
+ if(point !== null && mouseMoves == currentMouseMoves) {
+ fireRequests(point);
+ }
+ }
+ ,tooltip_timeDelay
+ );
}
-function fireRequests(){
+function fireRequests(point){
+
+
+
var ind = getMapObjIndexByName(tooltipTarget);
- point = new Point(clickX,clickY);
var point_geom = new Geometry(geomType.point);
point_geom.addPoint(mapToReal(tooltipTarget,point));
visibleRequest = 0;
@@ -135,8 +144,9 @@
for(var k=0;k < no_result_text.length;k++){
if(js_code.indexOf(no_result_text[k])!==-1){
- if(!isFirstResult())
+ if(!isFirstResult()) {
displayResultDoc("");
+ }
return;
}
}
@@ -175,8 +185,9 @@
function displayResultDoc(html){
//test if we have a fixed destination and create popup otherwise
- if(tooltip_destinationFrame=="")
+ if(tooltip_destinationFrame=="") {
return showBalloonFrame(html);
+ }
//put the frame there
$("#"+tooltip_destinationFrame).each(function(){
@@ -185,7 +196,7 @@
oDoc = oDoc.document;
}
if(isFirstResult())
- oDoc.open();
+ oDoc.open();
oDoc.write(html);
if(isLastResult())
oDoc.close();
@@ -195,7 +206,8 @@
function showBalloonFrame(html){
if(isFirstResult()){
- //claculate Position
+ //calculate Position
+
x=point.x+parseInt(document.getElementById(tooltipTarget).style.left);
y=point.y+parseInt(document.getElementById(tooltipTarget).style.top);
@@ -216,6 +228,7 @@
//finally display popup
tooltipWin.show();
+ visibleRequest++;
}
function getWfsRequests(target, geom, checkscale, filteroption){
More information about the Mapbender_commits
mailing list