maxX and maxY should be a integer