Fixed undo bug for undoing too deeply.
Fix #47.  Also refactorized the device rotation. Now, all the app disables the device rotation but it is still possible to rotate the camera when taking pictures and detecting. Refactored all the logic to handle the correct rotation of the prevLayer, the image taken, the boxes of the tabview and the detections.