moveSelection method
Implementation
Future<void> moveSelection(Offset drift) async {
if (selection.value.isEmpty) {
selection.add([await getChildren(workingVFolder.value).first]);
}
if (selection.value.length > 1) {
if (drift.dx > 0 || drift.dy > 0) {
selection.add([selection.value.last]);
} else {
selection.add([selection.value.first]);
}
}
int across = currentLayout.span;
VEntity selected = selection.value.first;
List<VEntity> view = await getChildren(workingVFolder.value).toList();
int index = view.indexOf(selected);
int newIndex =
_SpanUtil.move(index, drift.dx.round(), drift.dy.round(), span: across);
newIndex = max(0, min(view.length - 1, newIndex));
selection.add([view[newIndex]]);
_lastTapped = view[newIndex];
}