photosgallery/viewframework/views/zoomview/src/glxzoommathsengine.cpp
branchRCL_3
changeset 32 78ad99c24f08
parent 18 bcb43dc84c44
child 35 420f6808bf21
--- a/photosgallery/viewframework/views/zoomview/src/glxzoommathsengine.cpp	Tue May 11 16:13:40 2010 +0300
+++ b/photosgallery/viewframework/views/zoomview/src/glxzoommathsengine.cpp	Tue May 25 12:42:31 2010 +0300
@@ -222,7 +222,6 @@
     // centerTranslationfactor is the vector representation of that amount. 
     if (NULL != apZoomFocus)
         {
-		// Offcenter Zooming will be enabled later on.
         centerTranslationfactor.iX = (((apZoomFocus->iX - halfScreenWidth) * newZoomRatio)/oldZoomRatio) + (halfScreenWidth - apZoomFocus->iX);         
         centerTranslationfactor.iY = (((apZoomFocus->iY - halfScreenHeight) * newZoomRatio)/oldZoomRatio) + (halfScreenHeight - apZoomFocus->iY);
         }
@@ -392,7 +391,7 @@
 // UpdatePanFactor: Calculates the Pan Factor based on time the key was pressed
 //-------------------------------------------------------------------------------------
 //
-void TGlxZoomAndPanMathsEngine::UpdatePanFactor(TTime& /*aPanTime*/)
+void TGlxZoomAndPanMathsEngine::UpdatePanFactor()
     {
     TRACER("void TGlxZoomAndPanMathsEngine::UpdatePanFactor()");
     
@@ -491,7 +490,13 @@
     {
     TRACER("void TGlxZoomAndPanMathsEngine::OrientationChanged()");
     iScreenSize.iWidth          = aNewScreenRect.Width();    
-    iScreenSize.iHeight         = aNewScreenRect.Height();    
+    iScreenSize.iHeight         = aNewScreenRect.Height();
+	
+    //Choose the minimum of the below.
+    TReal32 imageWidthRatio  = ((TReal32)iScreenSize.iWidth  / iActualImageSize.iWidth  )*100.0F;
+    TReal32 imageHeightRatio = ((TReal32)iScreenSize.iHeight / iActualImageSize.iHeight )*100.0F;
+	iMinZoomRatio = Min(imageWidthRatio, imageHeightRatio);
+    GLX_LOG_INFO1("NewZoomRatio: New minimum Zoom Ratio = %d", TInt(iMinZoomRatio));		
     }
 
 //-------------------------------------------------------------------------------------
@@ -516,7 +521,7 @@
     }
 
 //-------------------------------------------------------------------------------------
-// ImageVirtualSize: retrieves the screen size .    
+// SetupPanOperation: Starts the Pan operations from the maths Engine's pont of view.    
 //-------------------------------------------------------------------------------------
 //
 void TGlxZoomAndPanMathsEngine::SetupPanOperation()
@@ -525,8 +530,22 @@
     iContinuousPanOperations = 0 ; 
     }
 
+//-------------------------------------------------------------------------------------
+// LastPanOffset: retrieves the last pan Offset.    
+//-------------------------------------------------------------------------------------
+//
 TPoint TGlxZoomAndPanMathsEngine::LastPanOffset()
     {
     TRACER("TGlxZoomAndPanMathsEngine::LastPanOffset()");
     return iLastPanOffset;
     }
+
+//-------------------------------------------------------------------------------------
+// MinimumZoomRatio: Retrieves the minimum Zoom threshold.    
+//-------------------------------------------------------------------------------------
+//
+TInt TGlxZoomAndPanMathsEngine::MinimumZoomRatio()
+    {
+    TRACER("TGlxZoomAndPanMathsEngine::MinimumZoomRatio");
+	return iMinZoomRatio;
+    }