update bound function and scaling function, add setMaxWidth and setMaxHeight function