Skip to content

Allow configuring hover/tooltip delay and search radius #177

@sanghoonio

Description

@sanghoonio

Summary

The hover tooltip behavior on EmbeddingViewMosaic is intermittent — sometimes hovering over points shows the highlight circle and tooltip, sometimes it doesn't. This is caused by hardcoded values in the tooltip throttle and hit detection that aren't exposed as configurable props.

Root Cause

Two hardcoded values in the library cause inconsistent hover detection:

1. throttleTooltip delay (packages/component/src/lib/utils.ts, line 42-43)

let delayMS = 300;
let recentThresholdMS = 300;

The first hover after a period of inactivity has a 300ms delay. During that delay, if the cursor moves, the pending query is replaced — so fast mouse movement means tooltips never appear. Once a tooltip has been shown recently (within 300ms), subsequent hovers are immediate, which is why hover works consistently after the first successful tooltip.

2. queryClosestPoint search radius (packages/component/src/lib/embedding_view/mosaic_client.ts, line 221)

let rMax = unitDistance * 12;

The hit detection searches within a 12-pixel radius in data coordinates. At certain zoom levels or point densities, the nearest point may fall outside this radius, returning null. The lastDistance cache starts at 0 (skipped), so the first query only uses the 12px fallback.

Requested Change

Expose these as configurable options, either through EmbeddingViewConfig or as separate props on EmbeddingViewMosaic / EmbeddingView:

  • tooltipDelay — delay in ms before showing tooltip on hover (default: 300)
  • tooltipRecentThreshold — threshold in ms for "recently visible" fast-path (default: 300)
  • hoverRadius — search radius multiplier for hit detection (default: 12)

Alternatively, a simpler disableHoverTooltip boolean prop would also be useful for cases where consumers want to suppress hover tooltips entirely (e.g., showing tooltips only on click/selection).

Context

We're using EmbeddingViewMosaic with ~50k points. Users experience the hover as unreliable — sometimes the highlight circle appears on hover, sometimes it doesn't, with no apparent pattern. The inconsistency is confusing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions