if (alignmentId.substring(0, 2) === '90') {
    min = Math.min(p1.y, p2.y);
    max = Math.max(p1.y, p2.y);
  } else {