// First check That the modified points are present in view port
point = visiblePoint;
isPresentInViewPort = true;
- } else if (viewportRect.contains(leftRect.location())) {
+ } else if ((leftRect.x() >= viewportRect.x() && leftRect.x() <= viewportRect.maxX()) && (leftRect.y() >= viewportRect.y() && leftRect.y() <= viewportRect.maxY())) {
+ // This condition will handle the case if leftRect.x() == viewportRect.maxX().
+ // So there are might some content that where leftRect.maxX > viewportRect.maxX().
// else if the calculated point is not in the view port area the
// draw context menu at left point if visible
point = leftRect.location();
isPresentInViewPort = true;
- } else if (viewportRect.contains(rightRect.maxXMinYCorner())) {
+ } else if ((rightRect.x() >= viewportRect.x() && rightRect.x() <= viewportRect.maxX()) && (rightRect.y() >= viewportRect.y() && rightRect.y() <= viewportRect.maxY())) {
+ // This condition will handle the case if rightRect.x() == viewportRect.maxX().
+ // So there are might some content that where rightRect.maxX > viewportRect.maxX().
// else if the calculated point is not in the view port area the
// draw context menu at right point if visible
point = rightRect.maxXMinYCorner();