Pull out orientation logic from camera.js