We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I need to rotated a SortableProvider.
In the example https://solid-dnd.com/?example=Sortable%2520list%2520%28vertical%29 I did that like:
<SortableProvider ids={ids()}> <div class="flex flex-col w-80 gap-4 mt-40 rotate-[90deg] items-start"> <For each={items()}>{(item) => <Sortable item={item} />}</For> </div> </SortableProvider>
(https://github.com/georgfaust/solid-dnd-examples/blob/ac61ff21f0a59ba7d8d6dcb295c6c980a2180ee1/src/sortable_list_vertical.jsx#L59C13-L63C32)
This does not work, because the transformer does sth like
delta.x = targetLayout.x - currentLayout.x; delta.y = targetLayout.y - currentLayout.y; ... return { x: transform.x + delta.x, y: transform.y + delta.y };
which is not correct due to the rotation of the container.
I could adjust the transformation, but I'd need access to sortableState but useSortableContext always returns null.
sortableState
useSortableContext
null
initialIds
sortedIds
The text was updated successfully, but these errors were encountered:
This seems to be a simple fix, but has to happen inside the lib, I just added:
if (currentLayout && targetLayout) { delta.x = targetLayout.x - currentLayout.x; delta.y = targetLayout.y - currentLayout.y; if (dndState.active.draggable) { delta = Vector.rotate(delta, -dndState.active.draggable.data.rotation) <-- added this } }
here:
solid-dnd/src/create-sortable.ts
Line 49 in 809014f
Usage like:
<MySortableProvider onDragStart={onDragStartSortableThisIsNeverCalled} ids={ids()}> <div style={`transform: rotate(${rotation}deg);`}> <For each={items()}>{(item) => <Sortable item={item} rotation={rotation} /> }</For> </div> </MySortableProvider>
Note, that I have to put the rotation into the sortable, as there seems to be no way to put data into the SortableProvider.
Sorry, something went wrong.
No branches or pull requests
I need to rotated a SortableProvider.
In the example https://solid-dnd.com/?example=Sortable%2520list%2520%28vertical%29 I did that like:
(https://github.com/georgfaust/solid-dnd-examples/blob/ac61ff21f0a59ba7d8d6dcb295c6c980a2180ee1/src/sortable_list_vertical.jsx#L59C13-L63C32)
This does not work, because the transformer does sth like
which is not correct due to the rotation of the container.
I could adjust the transformation, but I'd need access to
sortableState
butuseSortableContext
always returnsnull
.sortableState
(needinitialIds
andsortedIds
)The text was updated successfully, but these errors were encountered: