DragControls Snap to a position multiple Objects Loop

Hello, I’m trying to mimic a snap behavior while dragging an object on a single axis, it seems easy at a glance, I thought I would use the DragControls Class and manipulate the positions of the dragged object. but the result is way more confusing. .
Here is a codepen for an example : https://codepen.io/MedAmineMod/pen/NWzXegM