modify for control pop-buttons's direction,the code looks ugly,i will update it ASAP