Plane Coordinates & Line Equations
On the coordinate plane, two points already fix their distance: the horizontal and vertical gaps make a right triangle whose hypotenuse is that distance, by Pythagoras. The midpoint is just the average of the two points' coordinates on each axis. A line, in turn, is set entirely by its slope and y-intercept. Drag B and the distance and its triangle change; adjust slope and intercept and the line pivots and slides.
On the coordinate plane the distance uses Pythagoras, the midpoint is the average of coordinates.