pre-select closest, next or prev scala definition