determine the orientation from custom code