         let menuCenterX : CGFloat = configuration.menuWidth/2 + FTDefaultMargin
         var menuX : CGFloat = 0
         if (senderXCenter.x + menuCenterX > UIScreen.ft_width()) {
-            senderXCenter.x = min(senderXCenter.x - (UIScreen.ft_width() - configuration.menuWidth - FTDefaultMargin), configuration.menuWidth - FTDefaultMenuArrowWidth - FTDefaultMargin);
-            menuX = UIScreen.ft_width() - configuration.menuWidth - FTDefaultMargin;
+            senderXCenter.x = min(senderXCenter.x - (UIScreen.ft_width() - configuration.menuWidth - FTDefaultMargin), configuration.menuWidth - FTDefaultMenuArrowWidth - FTDefaultMargin)
+            menuX = UIScreen.ft_width() - configuration.menuWidth - FTDefaultMargin
         }else if (senderXCenter.x - menuCenterX < 0){
-            senderXCenter.x = max(FTDefaultMenuCornerRadius + FTDefaultMenuArrowWidth, senderXCenter.x - FTDefaultMargin);
-            menuX = FTDefaultMargin;
-        }else{
-            senderXCenter.x = configuration.menuWidth/2;
-            menuX = senderRect.origin.x + (senderRect.size.width)/2 - configuration.menuWidth/2;
+            senderXCenter.x = max(FTDefaultMenuCornerRadius + FTDefaultMenuArrowWidth, senderXCenter.x - FTDefaultMargin)
+            menuX = FTDefaultMargin
+        }else{
+            senderXCenter.x = configuration.menuWidth/2
+            menuX = senderRect.origin.x + (senderRect.size.width)/2 - configuration.menuWidth/2
         }
         return menuX
     }

}


class FTPopOverMenuView: UIControl {
    
    fileprivate var menuNameArray : [String]!
    fileprivate var menuImageArray : [String]?

    
    fileprivate lazy var tapGesture : UITapGestureRecognizer = {
        let gesture = UITapGestureRecognizer(target: self, action: #selector(onBackgroudViewTapped(gesture:)))
        gesture.delegate = self
        return gesture
    }()

    fileprivate func showForSender(sender: UIView?, or senderFrame: CGRect?, with menuNameArray: [String]!, menuImageArray: [String]?, done: @escaping (NSInteger)->(), cancel:@escaping ()->()){
