Pick to edit ​
onGraphicPick(handler, options?) subscribes to committed graphics without naming an internal layer. event.id is the graphic id, and the full PickEvent includes the hit feature, pixel, coordinate, and original browser event. Close-then-pick ordering is preserved: a click on another measure during an edit closes the current edit before your handler runs.
const unsubscribe = td.onGraphicPick((event) => {
const graphic = graphics.find((candidate) => candidate.id === event.id);
if (graphic) void startEdit(graphic);
});The returned unsubscribe() is idempotent. Pass { signal } to also remove the handler when an AbortSignal aborts.
For advanced picking on host-selected layers, use onPick(layerId, handler, options?). Adapter authors can recover the measure id from a rendered feature with tryControlMeasureIdFromFeature(feature).
A complete pick → edit loop is in the Quick start.
Composing with host click handling ​
Most hosts also run their own click handler on the map — usually to clear a selection when the user clicks empty space. That logic needs to know whether TacticalDraw itself owns the click, or it will deselect out from under an active edit. ownsInteractionAt(pixel, options?) answers exactly that, independent of TacticalDraw's own pick/click pipeline:
map.on("click", (e) => {
if (td.ownsInteractionAt(e.pixel, { originalEvent: e.originalEvent })) return;
clearHostSelection();
});It covers committed graphics, the active preview (including the measure currently being edited, which is lifted off the graphics layer for the duration), edit handles, and a label's estimated text extent — a click anywhere across a rotated/offset label counts as owned, not just on its anchor point. The guide layer (draw-guide scaffolding) is deliberately excluded since it's never a legitimate click target.
Pass the host's raw event as originalEvent to get the same pointer-type-aware tolerance (onPick's 4px mouse/pen, 12px touch) or an explicit tolerance to override it. The call is a stateless, synchronous query over adapter-cached state — it does not depend on onPick/"click" dispatch having run first, so it's safe to call from any host click handler regardless of ordering relative to TacticalDraw's own pipeline.