You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by jm...@apache.org on 2007/04/09 21:20:33 UTC

svn commit: r526924 - /incubator/xap/trunk/codebase/src/xap/widgets/dojo/Window.js

Author: jmargaris
Date: Mon Apr  9 14:20:32 2007
New Revision: 526924

URL: http://svn.apache.org/viewvc?view=rev&rev=526924
Log:
improved min/max behavior

Modified:
    incubator/xap/trunk/codebase/src/xap/widgets/dojo/Window.js

Modified: incubator/xap/trunk/codebase/src/xap/widgets/dojo/Window.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/widgets/dojo/Window.js?view=diff&rev=526924&r1=526923&r2=526924
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/widgets/dojo/Window.js (original)
+++ incubator/xap/trunk/codebase/src/xap/widgets/dojo/Window.js Mon Apr  9 14:20:32 2007
@@ -122,6 +122,8 @@
 	},
 	
 	
+	
+	//WARNING restore set previous to null!
 	maximizeWindow:function(evt){
 		this.containerNode.style.visibility = "visible" ;
 		if (evt && xap.util.Event.getPreventDefault(evt)){
@@ -129,20 +131,30 @@
 		}
 		
 		var oldWindowState = this.windowState;
-				
-		var previous = {
-			width: this.previous.width,
-			height: this.previous.height,
-			left: this.previous.left,
-			top: this.previous.top,
-			bottom: this.previous.bottom,
-			right: this.previous.right
-		};	
 		
+		//only save bounds if we were going from normal state
+		//to maxmized
 		if (this.windowState === "normal"){
 			this.setPrevious() ;
 		}
 		
+		var previous = null;
+		
+		//save the old bounds in case we are going from
+		//maximized or minimized to maximized
+		//the dojo floating pane code will save previous
+		//but we need to roll back in some cases
+		if (this.previous){		
+			previous = {
+				width: this.previous.width,
+				height: this.previous.height,
+				left: this.previous.left,
+				top: this.previous.top,
+				bottom: this.previous.bottom,
+				right: this.previous.right
+			};	
+		}
+		
 		var restoreParent = this.restoreAction.parentNode;
 		restoreParent.removeChild(this.restoreAction);
 		restoreParent.insertBefore(this.restoreAction,this.minimizeAction);
@@ -154,7 +166,7 @@
 		//is called after the fact to set the window as maximized.
 		//in that case the window can be maximized twice, and we don't want
 		//to save the bounds as the max bounds
-		if (oldWindowState==="maximized"){
+		if ( (oldWindowState==="maximized" || oldWindowState==="minimized") && previous){
 			this.previous = previous;
 		}