220 // In such a case the zoom happens around that point. So we need to translate (move) the |
220 // In such a case the zoom happens around that point. So we need to translate (move) the |
221 // center in such a way that the relative position of the zoom facus does not change. |
221 // center in such a way that the relative position of the zoom facus does not change. |
222 // centerTranslationfactor is the vector representation of that amount. |
222 // centerTranslationfactor is the vector representation of that amount. |
223 if (NULL != apZoomFocus) |
223 if (NULL != apZoomFocus) |
224 { |
224 { |
225 // Offcenter Zooming will be enabled later on. |
|
226 centerTranslationfactor.iX = (((apZoomFocus->iX - halfScreenWidth) * newZoomRatio)/oldZoomRatio) + (halfScreenWidth - apZoomFocus->iX); |
225 centerTranslationfactor.iX = (((apZoomFocus->iX - halfScreenWidth) * newZoomRatio)/oldZoomRatio) + (halfScreenWidth - apZoomFocus->iX); |
227 centerTranslationfactor.iY = (((apZoomFocus->iY - halfScreenHeight) * newZoomRatio)/oldZoomRatio) + (halfScreenHeight - apZoomFocus->iY); |
226 centerTranslationfactor.iY = (((apZoomFocus->iY - halfScreenHeight) * newZoomRatio)/oldZoomRatio) + (halfScreenHeight - apZoomFocus->iY); |
228 } |
227 } |
229 |
228 |
230 GLX_LOG_INFO1(" Zoom: newZoomRatio = %d. ", newZoomRatio ); |
229 GLX_LOG_INFO1(" Zoom: newZoomRatio = %d. ", newZoomRatio ); |
390 |
389 |
391 //------------------------------------------------------------------------------------- |
390 //------------------------------------------------------------------------------------- |
392 // UpdatePanFactor: Calculates the Pan Factor based on time the key was pressed |
391 // UpdatePanFactor: Calculates the Pan Factor based on time the key was pressed |
393 //------------------------------------------------------------------------------------- |
392 //------------------------------------------------------------------------------------- |
394 // |
393 // |
395 void TGlxZoomAndPanMathsEngine::UpdatePanFactor(TTime& /*aPanTime*/) |
394 void TGlxZoomAndPanMathsEngine::UpdatePanFactor() |
396 { |
395 { |
397 TRACER("void TGlxZoomAndPanMathsEngine::UpdatePanFactor()"); |
396 TRACER("void TGlxZoomAndPanMathsEngine::UpdatePanFactor()"); |
398 |
397 |
399 iContinuousPanOperations++; |
398 iContinuousPanOperations++; |
400 |
399 |
489 // |
488 // |
490 void TGlxZoomAndPanMathsEngine::OrientationChanged(const TRect& aNewScreenRect) |
489 void TGlxZoomAndPanMathsEngine::OrientationChanged(const TRect& aNewScreenRect) |
491 { |
490 { |
492 TRACER("void TGlxZoomAndPanMathsEngine::OrientationChanged()"); |
491 TRACER("void TGlxZoomAndPanMathsEngine::OrientationChanged()"); |
493 iScreenSize.iWidth = aNewScreenRect.Width(); |
492 iScreenSize.iWidth = aNewScreenRect.Width(); |
494 iScreenSize.iHeight = aNewScreenRect.Height(); |
493 iScreenSize.iHeight = aNewScreenRect.Height(); |
|
494 |
|
495 //Choose the minimum of the below. |
|
496 TReal32 imageWidthRatio = ((TReal32)iScreenSize.iWidth / iActualImageSize.iWidth )*100.0F; |
|
497 TReal32 imageHeightRatio = ((TReal32)iScreenSize.iHeight / iActualImageSize.iHeight )*100.0F; |
|
498 iMinZoomRatio = Min(imageWidthRatio, imageHeightRatio); |
|
499 GLX_LOG_INFO1("NewZoomRatio: New minimum Zoom Ratio = %d", TInt(iMinZoomRatio)); |
495 } |
500 } |
496 |
501 |
497 //------------------------------------------------------------------------------------- |
502 //------------------------------------------------------------------------------------- |
498 // ImageVirtualSize: retieves the virtual size of the image. |
503 // ImageVirtualSize: retieves the virtual size of the image. |
499 //------------------------------------------------------------------------------------- |
504 //------------------------------------------------------------------------------------- |
514 TRACER("TGlxZoomAndPanMathsEngine::ScreenSize()"); |
519 TRACER("TGlxZoomAndPanMathsEngine::ScreenSize()"); |
515 return iScreenSize; |
520 return iScreenSize; |
516 } |
521 } |
517 |
522 |
518 //------------------------------------------------------------------------------------- |
523 //------------------------------------------------------------------------------------- |
519 // ImageVirtualSize: retrieves the screen size . |
524 // SetupPanOperation: Starts the Pan operations from the maths Engine's pont of view. |
520 //------------------------------------------------------------------------------------- |
525 //------------------------------------------------------------------------------------- |
521 // |
526 // |
522 void TGlxZoomAndPanMathsEngine::SetupPanOperation() |
527 void TGlxZoomAndPanMathsEngine::SetupPanOperation() |
523 { |
528 { |
524 TRACER("TGlxZoomAndPanMathsEngine::SetupPanOperation()"); |
529 TRACER("TGlxZoomAndPanMathsEngine::SetupPanOperation()"); |
525 iContinuousPanOperations = 0 ; |
530 iContinuousPanOperations = 0 ; |
526 } |
531 } |
527 |
532 |
|
533 //------------------------------------------------------------------------------------- |
|
534 // LastPanOffset: retrieves the last pan Offset. |
|
535 //------------------------------------------------------------------------------------- |
|
536 // |
528 TPoint TGlxZoomAndPanMathsEngine::LastPanOffset() |
537 TPoint TGlxZoomAndPanMathsEngine::LastPanOffset() |
529 { |
538 { |
530 TRACER("TGlxZoomAndPanMathsEngine::LastPanOffset()"); |
539 TRACER("TGlxZoomAndPanMathsEngine::LastPanOffset()"); |
531 return iLastPanOffset; |
540 return iLastPanOffset; |
532 } |
541 } |
|
542 |
|
543 //------------------------------------------------------------------------------------- |
|
544 // MinimumZoomRatio: Retrieves the minimum Zoom threshold. |
|
545 //------------------------------------------------------------------------------------- |
|
546 // |
|
547 TInt TGlxZoomAndPanMathsEngine::MinimumZoomRatio() |
|
548 { |
|
549 TRACER("TGlxZoomAndPanMathsEngine::MinimumZoomRatio"); |
|
550 return iMinZoomRatio; |
|
551 } |