update Anchors
fun updateAnchors(newAnchors: UnstyledDraggableAnchors<T>, newTarget: T = if (!offset.isNaN()) {
newAnchors.closestAnchor(offset) ?: targetValue
} else targetValue)
Update the anchors. If there is no ongoing anchoredDrag operation, snap to the newTarget, otherwise restart the ongoing anchoredDrag operation (e.g. an animation) with the new anchors.
If your anchors depend on the size of the layout, updateAnchors should be called in the layout (placement) phase, e.g. through Modifier.onSizeChanged. This ensures that the state is set up within the same frame. For static anchors, or anchors with different data dependencies, updateAnchors is safe to be called from side effects or layout.
Parameters
new Anchors
The new anchors.
new Target
The new target, by default the closest anchor or the current target if there are no anchors.