refresh method

void refresh()

Refresh the cached y-position values of spied items.

Implementation

void refresh() {

  _anchors.clear();

  for (final e in _$body.find(_selector)) {
    final href = p.getDataTarget(e)!;
    if (!_ANC_EXP.hasMatch(href))
      continue;

    final $href = $(href);
    if (!$href.isEmpty) {
      final offset = $href.first.offsetTop + (element is BodyElement ? 0 : element.scrollTop);
      _anchors.add(_Anchor(offset, href));
    }
  }

  _anchors.sort((_Anchor a, _Anchor b) => a.offset - b.offset);

}