uifw/AvKon/aknphysics/src/aknphysics.cpp
branchRCL_3
changeset 23 3d340a0166ff
parent 16 71dd06cfe933
child 25 941195f2d488
--- a/uifw/AvKon/aknphysics/src/aknphysics.cpp	Tue Apr 27 16:55:05 2010 +0300
+++ b/uifw/AvKon/aknphysics/src/aknphysics.cpp	Tue May 11 16:27:42 2010 +0300
@@ -426,7 +426,15 @@
                                           const TTime& aStartTime )
     {
     // Check that world really exists
-    if ( !iEngine || !iEngine->WorldExists() )
+    if ( iEngine )
+        {
+        if ( ( !iLandscape && iWorldSize.iHeight <= iViewSize.iHeight ) ||
+                ( iLandscape && iWorldSize.iWidth <= iViewSize.iWidth ) )
+            {
+            return EFalse;
+            }
+        }
+    else
         {
         return EFalse;
         }
@@ -544,6 +552,14 @@
 //
 EXPORT_C void CAknPhysics::RegisterPanningPosition( const TPoint& aDelta )
     {
+    TInt viewSize = !iLandscape ? iViewSize.iHeight : iViewSize.iWidth;
+    TInt worldSize = !iLandscape ? iWorldSize.iHeight : iWorldSize.iWidth;
+    
+    if ( worldSize <= viewSize )
+        {
+        return;
+        }
+	
     TTimeIntervalMicroSeconds time;
     TInt err( KErrNone );
     if ( iNullThread.Handle() )
@@ -589,7 +605,8 @@
     iPanningDrawOmitted = !drawNow;
     
     TPoint position( iObserver.ViewPosition() );
-    position += aDelta;
+    
+    TPoint movement( aDelta );
 
     if ( iRestrictor && iRestrictor->AllowedViewPosition( position ) )
         {
@@ -602,6 +619,23 @@
                 iEngine->StartFpsLogging();
                 }
             }
+
+        // reduce movement if content is dragged over boundaries
+        if ( OngoingPhysicsAction() == EAknPhysicsActionDragging )
+            {
+            TInt currentPosition = !iLandscape ? position.iY : position.iX;
+            TInt* movementPtr = !iLandscape ? &movement.iY : &movement.iX;
+        
+            TInt top = viewSize / 2;
+            TInt bottom = worldSize - top;
+            
+            if ( currentPosition < top || currentPosition > bottom )
+                {
+                *movementPtr /= 2;
+                }
+            }
+
+        position += movement;
         
         NotifyViewPositionChanged( position, drawNow );