Dynamic diagram. Breaking connecting lines after dragging rectangles

How to update the lines so that they do not break away from the rectangles after dragging?