uifw/AvKon/aknphysics/src/aknphysics.cpp
branchRCL_3
changeset 23 3d340a0166ff
parent 16 71dd06cfe933
child 25 941195f2d488
equal deleted inserted replaced
18:0aa5fbdfbc30 23:3d340a0166ff
   424 //
   424 //
   425 EXPORT_C TBool CAknPhysics::StartPhysics( TPoint& aDrag, 
   425 EXPORT_C TBool CAknPhysics::StartPhysics( TPoint& aDrag, 
   426                                           const TTime& aStartTime )
   426                                           const TTime& aStartTime )
   427     {
   427     {
   428     // Check that world really exists
   428     // Check that world really exists
   429     if ( !iEngine || !iEngine->WorldExists() )
   429     if ( iEngine )
       
   430         {
       
   431         if ( ( !iLandscape && iWorldSize.iHeight <= iViewSize.iHeight ) ||
       
   432                 ( iLandscape && iWorldSize.iWidth <= iViewSize.iWidth ) )
       
   433             {
       
   434             return EFalse;
       
   435             }
       
   436         }
       
   437     else
   430         {
   438         {
   431         return EFalse;
   439         return EFalse;
   432         }
   440         }
   433     
   441     
   434     iSuspended = EFalse;
   442     iSuspended = EFalse;
   542 // CAknPhysics::RegisterPanningPosition
   550 // CAknPhysics::RegisterPanningPosition
   543 // ---------------------------------------------------------------------------
   551 // ---------------------------------------------------------------------------
   544 //
   552 //
   545 EXPORT_C void CAknPhysics::RegisterPanningPosition( const TPoint& aDelta )
   553 EXPORT_C void CAknPhysics::RegisterPanningPosition( const TPoint& aDelta )
   546     {
   554     {
       
   555     TInt viewSize = !iLandscape ? iViewSize.iHeight : iViewSize.iWidth;
       
   556     TInt worldSize = !iLandscape ? iWorldSize.iHeight : iWorldSize.iWidth;
       
   557     
       
   558     if ( worldSize <= viewSize )
       
   559         {
       
   560         return;
       
   561         }
       
   562 	
   547     TTimeIntervalMicroSeconds time;
   563     TTimeIntervalMicroSeconds time;
   548     TInt err( KErrNone );
   564     TInt err( KErrNone );
   549     if ( iNullThread.Handle() )
   565     if ( iNullThread.Handle() )
   550         {
   566         {
   551         err = iNullThread.GetCpuTime( time );
   567         err = iNullThread.GetCpuTime( time );
   587         }
   603         }
   588 
   604 
   589     iPanningDrawOmitted = !drawNow;
   605     iPanningDrawOmitted = !drawNow;
   590     
   606     
   591     TPoint position( iObserver.ViewPosition() );
   607     TPoint position( iObserver.ViewPosition() );
   592     position += aDelta;
   608     
       
   609     TPoint movement( aDelta );
   593 
   610 
   594     if ( iRestrictor && iRestrictor->AllowedViewPosition( position ) )
   611     if ( iRestrictor && iRestrictor->AllowedViewPosition( position ) )
   595         {
   612         {
   596         if ( OngoingPhysicsAction() == EAknPhysicsActionNone )
   613         if ( OngoingPhysicsAction() == EAknPhysicsActionNone )
   597             {
   614             {
   600             if ( iParamProvider->FpsLoggingEnabled() )
   617             if ( iParamProvider->FpsLoggingEnabled() )
   601                 {
   618                 {
   602                 iEngine->StartFpsLogging();
   619                 iEngine->StartFpsLogging();
   603                 }
   620                 }
   604             }
   621             }
       
   622 
       
   623         // reduce movement if content is dragged over boundaries
       
   624         if ( OngoingPhysicsAction() == EAknPhysicsActionDragging )
       
   625             {
       
   626             TInt currentPosition = !iLandscape ? position.iY : position.iX;
       
   627             TInt* movementPtr = !iLandscape ? &movement.iY : &movement.iX;
       
   628         
       
   629             TInt top = viewSize / 2;
       
   630             TInt bottom = worldSize - top;
       
   631             
       
   632             if ( currentPosition < top || currentPosition > bottom )
       
   633                 {
       
   634                 *movementPtr /= 2;
       
   635                 }
       
   636             }
       
   637 
       
   638         position += movement;
   605         
   639         
   606         NotifyViewPositionChanged( position, drawNow );
   640         NotifyViewPositionChanged( position, drawNow );
   607         
   641         
   608         if ( drawNow )
   642         if ( drawNow )
   609             {
   643             {