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