← Files Biological Sequence & Alignment ViewerARCHIVED FILE

src/msa/hover-details.ts

438 Bytes · Sep 30, 2026 · 23:01 UTC

↓ Download file

import type { MsaHoverCellDetails } from "./cell-hover-overlay";

export function buildHoverCellDetails(
  content: string,
  target: HTMLElement,
): NonNullable<MsaHoverCellDetails> {
  const rect = target.getBoundingClientRect();
  const placeAbove = rect.top >= 72;
  return {
    content,
    left: rect.left + rect.width / 2,
    placement: placeAbove ? "top" : "bottom",
    top: placeAbove ? rect.top - 6 : rect.bottom + 6,
  };
}

SHA-256: d93b390b08838c923dc003a16e7020dd90e5ea829c86ad86e7800ccf31d2c345