Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #15086 from davidflanagan/bug939679v1.2
Browse files Browse the repository at this point in the history
Merge pull request #14912 from davidflanagan/bug939679
  • Loading branch information
David Flanagan committed Jan 7, 2014
2 parents a4c9d0e + 02cbcaf commit 1e8bca8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions apps/camera/js/camera.js
Expand Up @@ -946,14 +946,19 @@ var Camera = {

var viewfinder = this.viewfinder;
var style = viewfinder.style;
// Switch screen dimensions to landscape
var screenWidth = document.body.clientHeight * window.devicePixelRatio;
var screenHeight = document.body.clientWidth * window.devicePixelRatio;
// Switch screen dimensions to landscape. The screen width/height is css
// pixel size. The following calculation are all based on css pixel.
var screenWidth = document.body.clientHeight;
var screenHeight = document.body.clientWidth;
var pictureAspectRatio = this._pictureSize.height / this._pictureSize.width;
var screenAspectRatio = screenHeight / screenWidth;

// Previews should match the aspect ratio and not be smaller than the screen
var validPreviews = camera.capabilities.previewSizes.filter(function(res) {
// Note that we are using the screen size in CSS pixels and not
// multiplying by devicePixelRatio. We assume that the preview sizes
// returned by the camera are in CSS pixels, not device pixels.
// This is the way things seem to work on the Helix.
var isLarger = res.height >= screenHeight && res.width >= screenWidth;
var aspectRatio = res.height / res.width;
var matchesRatio = Math.abs(aspectRatio - pictureAspectRatio) < 0.05;
Expand Down

0 comments on commit 1e8bca8

Please sign in to comment.