                 }
             }
         } else { // even without the option, don't want image completely out of screen
-            if ((newX + newWidth > frame.maxX && newX > superview!.bounds.width - boundMargin) ||
-                (newX + newWidth < frame.maxX && newX + newWidth < boundMargin) ||
-                (newY + newHeight > frame.maxY && newY > superview!.bounds.height - boundMargin) ||
-                (newY + newHeight < frame.maxY && newHeight < boundMargin))
+            if ((newX > superview!.bounds.width - boundMargin) ||
+                (newX + newWidth < boundMargin) ||
+                (newY > superview!.bounds.height - boundMargin) ||
+                (newY + newHeight < boundMargin))
             {
                 return;
             }

    }
    
    override open func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        guard enableMoving || enableResizing else { return }
        
        // If a e.g. UITextView isFirstResponder, the touch might be cancelled abruptly
        superview?.endEditing(true)

        
        isValidTap = false
        
        if enableDragResizing && curAnchor!.isResizing() {
            resizeUsingTouchLoc(touch.location(in: superview!))
        } else if enableMoving {
            translateUsingTouchLoc(touchPos)
