isCursorInViewport

See source code

Whether a collaborator's cursor (page coords) is inside the viewport, with a small margin for the cursor glyph so it isn't culled the instant its hotspot crosses the edge.

Single source of truth for the cursor/hint split: the DOM cursor layer renders a collaborator when this is true, and CollaboratorHintOverlayUtil draws the viewport-edge hint when it's false. Sharing the predicate keeps those two exhaustive and mutually exclusive — a margin change can't open a dead zone (neither renders) or a double-render (both).

function isCursorInViewport(
  cursor: VecLike,
  viewport: {
    maxX: number;
    maxY: number;
    minX: number;
    minY: number;
  },
  zoom: number,
): boolean;

Parameters

NameDescription

cursor

VecLike;

viewport

{
  maxX: number;
  maxY: number;
  minX: number;
  minY: number;
};

zoom

number;

Returns

boolean;
Prev
intersectPolygonPolygon
Next
isSafeFloat