refactor(web): centralize multi-select release handling

This commit is contained in:
2026-04-01 10:50:21 +02:00
parent ca947befde
commit a4789d718b
5 changed files with 94 additions and 16 deletions
+21
View File
@@ -65,3 +65,24 @@ export function finalizeMultiSelectDraft<TState extends MultiSelectStateLike>(
currentY,
};
}
export function completeMultiSelectDraft<TState extends MultiSelectStateLike>(
state: TState,
currentX: number,
currentY: number,
emptyState: TState,
minDistancePx = 5,
): { nextState: TState; shouldClear: boolean } {
const finished = finalizeMultiSelectDraft(state, currentX, currentY, minDistancePx);
if (!finished) {
return {
nextState: emptyState,
shouldClear: true,
};
}
return {
nextState: finished,
shouldClear: false,
};
}