change 'case' to else-if. This closes #113

This commit is contained in:
Jesse MacFadyen 2015-08-04 12:04:17 -07:00 committed by Vladimir Kotikov
parent b8a68af63f
commit a030c52f7f

View File

@ -20,7 +20,7 @@
*/
/*jshint unused:true, undef:true, browser:true */
/*global Windows:true, URL:true, module:true, require:true */
/*global Windows:true, URL:true, module:true, require:true, WinJS:true */
var Camera = require('./Camera');
@ -701,25 +701,18 @@ function takePictureFromCameraWindows(successCallback, errorCallback, args) {
var UIMaxRes = WMCapture.CameraCaptureUIMaxPhotoResolution;
var totalPixels = targetWidth * targetHeight;
switch (true) {
case (totalPixels <= 320 * 240):
maxRes = UIMaxRes.verySmallQvga;
break;
case (totalPixels <= 640 * 480):
maxRes = UIMaxRes.smallVga;
break;
case (totalPixels <= 1024 * 768):
maxRes = UIMaxRes.mediumXga;
break;
case (totalPixels <= 3 * 1000 * 1000):
maxRes = UIMaxRes.large3M;
break;
case (totalPixels <= 5 * 1000 * 1000):
maxRes = UIMaxRes.veryLarge5M;
break;
default:
maxRes = UIMaxRes.highestAvailable;
break;
if (totalPixels <= 320 * 240) {
maxRes = UIMaxRes.verySmallQvga;
} else if (totalPixels <= 640 * 480) {
maxRes = UIMaxRes.smallVga;
} else if (totalPixels <= 1024 * 768) {
maxRes = UIMaxRes.mediumXga;
} else if (totalPixels <= 3 * 1000 * 1000) {
maxRes = UIMaxRes.large3M;
} else if (totalPixels <= 5 * 1000 * 1000) {
maxRes = UIMaxRes.veryLarge5M;
} else {
maxRes = UIMaxRes.highestAvailable;
}
cameraCaptureUI.photoSettings.maxResolution = maxRes;