nextspace
    Preparing search index...

    Interface LabelCandidate

    A label wanting to be drawn, measured in screen pixels.

    interface LabelCandidate {
        alternates?: LabelPosition[];
        hardObstacle?: boolean;
        height: number;
        id: string;
        priority: number;
        required?: boolean;
        width: number;
        x: number;
        y: number;
    }
    Index

    Properties

    alternates?: LabelPosition[]

    Other spots to try, in order, before the label is dropped — e.g. above a node rather than only ever below it. Same size, different anchor; the first spot (this candidate's own x/y, tried first) or alternate that clears every rule wins.

    hardObstacle?: boolean

    Not a label at all, just a reservation — a node's own circle, or a shown origin pill. No candidate may be drawn over one of these, required or not: a label is worth losing space over another label's tidiness, never worth hiding a different node entirely and blocking its own click target.

    height: number
    id: string
    priority: number

    Higher wins a collision. Degree is the natural choice: the better-connected node is the one worth naming.

    required?: boolean

    Never dropped for overlapping another label. The node under the cursor and its neighbours are named over whatever other label has to give way — but never over a hardObstacle; see below.

    width: number
    x: number
    y: number