diff options
author | lambroslambrou@google.com <lambroslambrou@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-15 20:51:16 +0000 |
---|---|---|
committer | lambroslambrou@google.com <lambroslambrou@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-15 20:51:16 +0000 |
commit | 6496f98284fd5f99825f94fcd9e51785f0718868 (patch) | |
tree | b643a3c1aee3169d293b9502787530d5dd51a9bb /remoting/webapp | |
parent | e39ba57a6d2929ad66d36a35524c6831c9bfd8e9 (diff) | |
download | chromium_src-6496f98284fd5f99825f94fcd9e51785f0718868.zip chromium_src-6496f98284fd5f99825f94fcd9e51785f0718868.tar.gz chromium_src-6496f98284fd5f99825f94fcd9e51785f0718868.tar.bz2 |
Fix scaling calculation.
BUG=92342
TEST=Verify scale-to-fit works with fat,narrow + tall,thin windows.
Review URL: http://codereview.chromium.org/7633045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96823 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/webapp')
-rw-r--r-- | remoting/webapp/me2mom/client_session.js | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/remoting/webapp/me2mom/client_session.js b/remoting/webapp/me2mom/client_session.js index 021f14f..d697019 100644 --- a/remoting/webapp/me2mom/client_session.js +++ b/remoting/webapp/me2mom/client_session.js @@ -367,8 +367,6 @@ remoting.ClientSession.prototype.onDesktopSizeChanged_ = function() { */ remoting.ClientSession.prototype.toggleScaleToFit = function(shouldScale) { if (shouldScale) { - remoting.debug.log('scale to fit is turned on.'); - if (this.plugin.desktopWidth == 0 || this.plugin.desktopHeight == 0) { remoting.debug.log('desktop size is not known yet.'); @@ -383,27 +381,24 @@ remoting.ClientSession.prototype.toggleScaleToFit = function(shouldScale) { if (height % 2 == 1) --height; - var scale = 1.0; - if (width < height) - scale = 1.0 * height / this.plugin.desktopHeight; - else - scale = 1.0 * width / this.plugin.desktopWidth; - + var scaleFitHeight = 1.0 * height / this.plugin.desktopHeight; + var scaleFitWidth = 1.0 * width / this.plugin.desktopWidth; + var scale = Math.min(scaleFitHeight, scaleFitWidth); if (scale > 1.0) { remoting.debug.log('scale up is not supported'); - return; + scale = 1.0; } this.plugin.width = this.plugin.desktopWidth * scale; this.plugin.height = this.plugin.desktopHeight * scale; } else { - remoting.debug.log('scale to fit is turned off.'); this.plugin.width = this.plugin.desktopWidth; this.plugin.height = this.plugin.desktopHeight; } remoting.debug.log('plugin size is now: ' + this.plugin.width + ' x ' + this.plugin.height + '.'); this.plugin.setScaleToFit(shouldScale); + remoting.debug.log('scale to fit is now: ' + shouldScale); }; /** |