const dx = Math.max(Math.abs(px - cx) - (rect.right - rect.left) / 2, 0);