selectionAnchor property
Offset?
get
selectionAnchor
Where a tooltip points: the top of the selected row's place, or the middle of the selected slice's outer edge.
Implementation
Offset? get selectionAnchor {
final sel = selection;
if (sel == null || sel.index >= count) return null;
final pane = spec.panes[sel.pane];
if (pane.polar) {
final k = sel.mark ?? pane.marks.indexWhere((m) => m.type == 'arc');
if (k < 0) return null;
final m = pane.marks[k];
final (center, outer, _) = arcGeometry(sel.pane, m);
for (final s in slices(m)) {
if (s.index != sel.index) continue;
final mid = s.start + s.sweep / 2;
return center + Offset(math.sin(mid), -math.cos(mid)) * outer;
}
return center;
}
return Offset(xOfRow(sel.index), plotRect(sel.pane).top);
}