calculate bounding box for scribble