OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 'use strict'; | |
6 | |
7 /** | 5 /** |
8 * Viewport class controls the way the image is displayed (scale, offset etc). | 6 * Viewport class controls the way the image is displayed (scale, offset etc). |
9 * @constructor | 7 * @constructor |
10 */ | 8 */ |
11 function Viewport() { | 9 function Viewport() { |
12 /** | 10 /** |
13 * Size of the full resolution image. | 11 * Size of the full resolution image. |
14 * @type {ImageRect} | 12 * @type {ImageRect} |
15 * @private | 13 * @private |
16 */ | 14 */ |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 var screenWidth = this.screenBounds_.width; | 548 var screenWidth = this.screenBounds_.width; |
551 var screenHeight = this.screenBounds_.height; | 549 var screenHeight = this.screenBounds_.height; |
552 var dx = screenRect.left + screenRect.width / 2 - screenWidth / 2; | 550 var dx = screenRect.left + screenRect.width / 2 - screenWidth / 2; |
553 var dy = screenRect.top + screenRect.height / 2 - screenHeight / 2; | 551 var dy = screenRect.top + screenRect.height / 2 - screenHeight / 2; |
554 return [ | 552 return [ |
555 'translate(' + dx + 'px,' + dy + 'px)', | 553 'translate(' + dx + 'px,' + dy + 'px)', |
556 'scale(' + scaleX + ',' + scaleY + ')', | 554 'scale(' + scaleX + ',' + scaleY + ')', |
557 this.getTransformation() | 555 this.getTransformation() |
558 ].join(' '); | 556 ].join(' '); |
559 }; | 557 }; |
OLD | NEW |