[Mapbender-commits] r3225 - in trunk/mapbender: http/javascripts lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Nov 12 03:51:01 EST 2008


Author: christoph
Date: 2008-11-12 03:51:01 -0500 (Wed, 12 Nov 2008)
New Revision: 3225

Modified:
   trunk/mapbender/http/javascripts/mod_pan.php
   trunk/mapbender/lib/core.js
Log:
aligning code to changes in

http://trac.osgeo.org/mapbender/ticket/323

Modified: trunk/mapbender/http/javascripts/mod_pan.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_pan.php	2008-11-12 08:50:12 UTC (rev 3224)
+++ trunk/mapbender/http/javascripts/mod_pan.php	2008-11-12 08:51:01 UTC (rev 3225)
@@ -22,8 +22,8 @@
 ?>
 var mod_pan_elName = "pan1";
 var mod_pan_frameName = "";
+var mod_pan_MapObj = null;
 
-
 var mod_pan_img_on = new Image(); mod_pan_img_on.src = "<?php  echo preg_replace("/_off/","_on",$e_src);  ?>";
 var mod_pan_img_off = new Image(); mod_pan_img_off.src = "<?php  echo $e_src;  ?>";
 var mod_pan_img_over = new Image(); mod_pan_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
@@ -32,6 +32,7 @@
 var mb_panActive = false;
 
 function init_mod_pan(ind){
+	mod_pan_MapObj = getMapObjByName(mod_pan_target);
 	mb_button[ind] = document.getElementById(mod_pan_elName);
 	mb_button[ind].img_over = mod_pan_img_over.src;
 	mb_button[ind].img_on = mod_pan_img_on.src;
@@ -43,26 +44,25 @@
 	mb_button[ind].stop = new Function ("mod_pan_disable()");
 }
 function mod_pan_click(){   
-	var p = window.frames[mod_pan_target].document.getElementById("maps");
+	var p = mod_pan_MapObj.getDomElement();
 	p.style.cursor = "pointer";
 	
-	var el = window.frames[mod_pan_target].document; 
-	el.onmousedown = mod_pan_start;
-	el.onmouseup = mod_pan_stop;
-	el.onmousemove = mod_pan_run;
+	p.onmousedown = mod_pan_start;
+	p.onmouseup = mod_pan_stop;
+	p.onmousemove = mod_pan_run;
 }
 function mod_pan_disable(){
-	var p = window.frames[mod_pan_target].document.getElementById("maps");
-	p.style.cursor = "";
-	
-	var el = window.frames[mod_pan_target].document; 
-	el.onmousedown = null;
-	el.onmouseup = null;
-	el.onmousemove = null;
+	var p = mod_pan_MapObj.getDomElement();
+	p.style.cursor = "pointer";
+
+	p.onmousedown = null;
+	p.onmouseup = null;
+	p.onmousemove = null;
 }
 function mod_pan_start(e){
 	mb_panActive = true;
 	mb_getMousePos(e,mod_pan_target);
+	var el = mod_pan_MapObj.getDomElement();
 	mb_start_x=clickX;
 	mb_start_y=clickY;
 	mb_end_x = clickX;
@@ -71,7 +71,7 @@
 }
 function mod_pan_run(e){
 	if(mb_panActive){
-		mb_getMousePos(e,mod_pan_target);
+		mb_getMousePos(e,mod_pan_MapObj.frameName);
 		mb_end_x = clickX;
 		mb_end_y = clickY;
 		mod_pan_move_map();
@@ -87,27 +87,27 @@
 	mb_panActive = false;
 	var dif_x = mb_end_x - mb_start_x;
 	var dif_y = mb_end_y - mb_start_y;
-	for(var i=0; i<mb_mapObj.length; i++){
-		if(mb_mapObj[i].frameName == mod_pan_target){
-			var width = mb_mapObj[i].width;
-			var height = mb_mapObj[i].height;      
-		}
-	} 
+	var width = mod_pan_MapObj.width;
+	var height = mod_pan_MapObj.height;      
+
+	var el = mod_pan_MapObj.getDomElement();
 	var center_x = (width / 2)  - dif_x;
 	var center_y = (height / 2) - dif_y;
 	var real_center = makeClickPos2RealWorldPos(mod_pan_target,center_x, center_y);   
-	mb_arrangeElement(mod_pan_target, "maps", 0, 0);
+
+	mb_arrangeElement(mod_pan_MapObj.frameName, mod_pan_target+"_maps", 0, 0);
 	for(var i=0; i<mb_PanSubElements.length; i++){
-		mb_arrangeElement(mod_pan_target, mb_PanSubElements[i], 0, 0);
-	}
+		mb_arrangeElement(mod_pan_MapObj.frameName, mb_PanSubElements[i], 0, 0);
+	} 
    zoom(mod_pan_target,false, 1.0, real_center[0], real_center[1]);   
 }
 function mod_pan_move_map(){
 	var dif_x = mb_end_x - mb_start_x;
 	var dif_y = mb_end_y - mb_start_y;
-	mb_arrangeElement(mod_pan_target, "maps", dif_x, dif_y);
+	
+	mb_arrangeElement(mod_pan_MapObj.frameName, mod_pan_target+"_maps", dif_x, dif_y);
 	for(var i=0; i<mb_PanSubElements.length; i++){
-		mb_arrangeElement(mod_pan_target, mb_PanSubElements[i], dif_x, dif_y);
+		mb_arrangeElement(mod_pan_MapObj.frameName, mb_PanSubElements[i], dif_x, dif_y);
 	} 
 	return false;  
-}
\ No newline at end of file
+}

Modified: trunk/mapbender/lib/core.js
===================================================================
--- trunk/mapbender/lib/core.js	2008-11-12 08:50:12 UTC (rev 3224)
+++ trunk/mapbender/lib/core.js	2008-11-12 08:51:01 UTC (rev 3225)
@@ -28,11 +28,6 @@
 var eventBeforeMapRequest = new MapbenderEvent();
 
 /**
- * Triggered before the scale is calculated.
- */
-var eventBeforeGetScale = new MapbenderEvent();
-
-/**
  * Triggered before a feature info is requested.
  */
 var eventBeforeFeatureInfo = new MapbenderEvent();
@@ -128,15 +123,6 @@
  * deprecated wrapped function
  * @deprecated
  */
-function mb_registerGetScalePreFunctions(stringFunction){
-//	mb_GetScalePreFunctions[mb_GetScalePreFunctions.length] = stringFunction;
-	eventBeforeGetScale.register(stringFunction);
-}
-
-/**
- * deprecated wrapped function
- * @deprecated
- */
 function mb_registerloadWmsSubFunctions(stringFunction){
 //	mb_loadWmsSubFunctions[mb_loadWmsSubFunctions.length] = stringFunction;
 	eventAfterLoadWMS.register(stringFunction);



More information about the Mapbender_commits mailing list