Function restrictRotateToHandler