[Mapbender-commits] r2025 - branches/2.5/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jan 28 05:11:54 EST 2008


Author: nimix
Date: 2008-01-28 05:11:54 -0500 (Mon, 28 Jan 2008)
New Revision: 2025

Modified:
   branches/2.5/http/javascripts/popup.js
Log:
fix fast dragging bug

Modified: branches/2.5/http/javascripts/popup.js
===================================================================
--- branches/2.5/http/javascripts/popup.js	2008-01-28 10:09:47 UTC (rev 2024)
+++ branches/2.5/http/javascripts/popup.js	2008-01-28 10:11:54 UTC (rev 2025)
@@ -143,21 +143,31 @@
 	popup_count++;
 }
 
+/**
+ * createCatcher creates a helper div over the whole browser frame
+ * @return return the dom element of the div
+ */
 function createCatcher(){
 	$("#mouse_catch").remove();
 	var div=document.createElement('div');
 	div.style.position="absolute";
 	div.style.top="0px";
 	div.style.left="0px";
+//	div.style.backgroundColor='#000000';
+//	div.style.opacity='0.5';
 	div.style.width=document.body.scrollWidth+"px";
 	div.style.height=document.body.scrollHeight+"px";
 	div.id="mouse_catch";
-	div.style.zIndex=popup_top-2;
+	div.style.zIndex=popup_top+2;
 	if(top.ie)
 		div.style.background = "url(../img/transparent.gif)";
 	window.document.body.appendChild(div);
+	return div;
 }
 
+/**
+ * removeCatcher deletes the helper div
+ */
 function removeCatcher(){
 	$("#mouse_catch").remove();
 }
@@ -172,6 +182,7 @@
 	div.id=this.id;
 	div.className = "jqmNotice";
 	
+	//set some attributes
 	div.style.left=String(this.left)+"px";
 	div.style.top=String(this.top)+"px";
 	div.style.width=String(this.width)+"px";
@@ -184,11 +195,33 @@
 	
 	//create window
 	document.body.appendChild(div);
-	$(div.firstChild).mousedown(function(){this.parentNode.style.zIndex=popup_top++;createCatcher();});
-	$(div.firstChild).mouseup(function(){removeCatcher();});
-	$(div.lastChild).mousedown(function(){this.parentNode.style.zIndex=popup_top++;createCatcher();});
-	$(div.lastChild).mouseup(function(){removeCatcher();});	
 	
+	//Bind events on title click (move window)
+	$(div.firstChild).mousedown(function(){
+		//set to top
+		this.parentNode.style.zIndex=popup_top++;
+		//create helper div to steal mouse events
+		$(createCatcher()).mouseup(function(){
+			//hand event to move routine
+			$().trigger('mouseup');
+			//remove helper div
+			removeCatcher();
+		})
+	;});
+	//bind events for resizing window
+	$(div.lastChild).mousedown(function(){
+		//set to top
+		this.parentNode.style.zIndex=popup_top++;
+		//create helper div to steal mouse events
+		$(createCatcher()).mouseup(function(){
+			//hand event to move routine
+			$().trigger('mouseup');
+			//remove helper div
+			removeCatcher();
+		})
+	;});
+	
+	//attach jquery window classes to div
 	$("#"+this.id, document).jqDrag('.jqDrag').jqResize('.jqResize').jqm({
       overlay: 0,
       onShow: function(h) {
@@ -305,4 +338,5 @@
  */
 mb_popup.prototype.isVisible = function(){
 	return document.getElementById(this.id)?true:false;
-}
\ No newline at end of file
+}
+



More information about the Mapbender_commits mailing list