seek method
Applies the first step steps, from the beginning.
Rebuilt from scratch rather than stepped backwards: a surface has no undo, and a replay that rewound by guessing would be a different session from the one recorded.
Implementation
void seek(int step) {
final int target = step.clamp(0, length);
if (target < _position) {
_controller.dispose();
_controller = SurfaceController(catalogs: [catalog]);
_position = 0;
}
for (var i = _position; i < target; i++) {
_apply(trace.steps[i]);
}
_position = target;
}