captureMorph method

void captureMorph()

Remembers the line on screen, before new rows (and a new spec) are set: the next setData starts from it instead of jumping.

Implementation

void captureMorph() {
  _morphFrom = null;
  final mark = _morphMark;
  if (spec.x.morph <= 0 || mark == null || count == 0 || plotWidth <= 0 || morphing) return;
  final (pane, m) = mark;
  final (lo, hi) = yDomain(pane);
  _morphFrom = [
    for (var i = 0; i < count; i++)
      if (rows[i][m.valueField] case final num v) ((xOfRow(i) - plotLeft) / plotWidth, (v - lo) / (hi - lo)),
  ];
  if (_morphFrom!.isEmpty) _morphFrom = null;
}