| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chromoting; | 5 package org.chromium.chromoting; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.graphics.Matrix; | 8 import android.graphics.Matrix; |
| 9 import android.graphics.Point; | 9 import android.graphics.Point; |
| 10 import android.graphics.PointF; | 10 import android.graphics.PointF; |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 | 347 |
| 348 default: | 348 default: |
| 349 break; | 349 break; |
| 350 } | 350 } |
| 351 return handled; | 351 return handled; |
| 352 } | 352 } |
| 353 | 353 |
| 354 private void handleClientSizeChanged(int width, int height) { | 354 private void handleClientSizeChanged(int width, int height) { |
| 355 mPanGestureBounds = new Rect( | 355 mPanGestureBounds = new Rect( |
| 356 mEdgeSlopInPx, mEdgeSlopInPx, width - mEdgeSlopInPx, height - mE
dgeSlopInPx); | 356 mEdgeSlopInPx, mEdgeSlopInPx, width - mEdgeSlopInPx, height - mE
dgeSlopInPx); |
| 357 mDesktopCanvas.repositionImageWithZoom(true); | 357 resizeImageToFitScreen(); |
| 358 } | 358 } |
| 359 | 359 |
| 360 private void handleHostSizeChanged(int width, int height) { | 360 private void handleHostSizeChanged(int width, int height) { |
| 361 moveViewport((float) width / 2, (float) height / 2); | 361 resizeImageToFitScreen(); |
| 362 } |
| 363 |
| 364 private void resizeImageToFitScreen() { |
| 362 mDesktopCanvas.resizeImageToFitScreen(); | 365 mDesktopCanvas.resizeImageToFitScreen(); |
| 366 float screenCenterX; |
| 367 float screenCenterY; |
| 368 synchronized (mRenderData) { |
| 369 screenCenterX = (float) mRenderData.screenWidth / 2; |
| 370 screenCenterY = (float) mRenderData.screenHeight / 2; |
| 371 } |
| 372 moveCursorToScreenPoint(screenCenterX, screenCenterY); |
| 363 } | 373 } |
| 364 | 374 |
| 365 private void setInputStrategy(InputStrategyInterface inputStrategy) { | 375 private void setInputStrategy(InputStrategyInterface inputStrategy) { |
| 366 // Since the rules for flinging differ between input modes, we want to s
top running the | 376 // Since the rules for flinging differ between input modes, we want to s
top running the |
| 367 // current fling animation when the mode changes to prevent a wonky expe
rience. | 377 // current fling animation when the mode changes to prevent a wonky expe
rience. |
| 368 mCursorAnimationJob.abortAnimation(); | 378 mCursorAnimationJob.abortAnimation(); |
| 369 mScrollAnimationJob.abortAnimation(); | 379 mScrollAnimationJob.abortAnimation(); |
| 370 mInputStrategy = inputStrategy; | 380 mInputStrategy = inputStrategy; |
| 371 } | 381 } |
| 372 | 382 |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 case 2: | 658 case 2: |
| 649 return BUTTON_RIGHT; | 659 return BUTTON_RIGHT; |
| 650 case 3: | 660 case 3: |
| 651 return BUTTON_MIDDLE; | 661 return BUTTON_MIDDLE; |
| 652 default: | 662 default: |
| 653 return BUTTON_UNDEFINED; | 663 return BUTTON_UNDEFINED; |
| 654 } | 664 } |
| 655 } | 665 } |
| 656 } | 666 } |
| 657 } | 667 } |
| OLD | NEW |