Setting maxX and maxY.