Skip to content

Instantly share code, notes, and snippets.

@rexboy7
Created August 13, 2013 11:21
Show Gist options
  • Save rexboy7/6220189 to your computer and use it in GitHub Desktop.
Save rexboy7/6220189 to your computer and use it in GitHub Desktop.
diff --git a/apps/camera/js/camera.js b/apps/camera/js/camera.js
index a80e013..3e01caa 100644
--- a/apps/camera/js/camera.js
+++ b/apps/camera/js/camera.js
@@ -911,9 +911,8 @@ var Camera = {
this._previewConfig = camera.capabilities.previewSizes[0];
}
- var transform = 'rotate(90deg)';
+ var transform = 'rotate(-90deg)';
var width, height;
- var translateX = 0;
// The preview should be larger than the screen, shrink it so that as
// much as possible is on screen.
@@ -925,17 +924,19 @@ var Camera = {
height = screenHeight;
}
+ var translateX = this._pictureSize.height;
+
if (this._camera == 1) {
/* backwards-facing camera */
transform += ' scale(-1, 1)';
- translateX = width;
+ translateX = 0;
}
// Counter the position due to the rotation
// This translation goes after the rotation so the element is shifted up
// (for back camera) - shifted up after it is rotated 90 degress clockwise.
// (for front camera) - shifted up-left after it is mirrored and rotated.
- transform += ' translate(-' + translateX + 'px, -' + height + 'px)';
+ transform += ' translate(-' + translateX + 'px, -' + 0 + 'px)';
// Now add another translation at to center the viewfinder on the screen.
// We put this at the start of the transform, which means it is applied
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment