Skip to content
New issue

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

[FEATURE] Multi-axis support in Reorder.Group #1400

Open
tommoor opened this issue Dec 23, 2021 · 18 comments · May be fixed by #1862
Open

[FEATURE] Multi-axis support in Reorder.Group #1400

tommoor opened this issue Dec 23, 2021 · 18 comments · May be fixed by #1862
Labels
feature New feature or request

Comments

@tommoor
Copy link

tommoor commented Dec 23, 2021

Is your feature request related to a problem? Please describe.

The new Reorder components are great for horizontal and vertical lists, it would be fantastic to have first class support in the same api for re-orderable grids. I also raised this on twitter as the wording in the docs can be read as if this feature already exists.

Describe the solution you'd like

Ideally the axis prop on Reorder.Group would take an additional option axis="xy", or similar. It could be that the reality of dual axis makes the interface more complex, but this would be the ideal.

Describe alternatives you've considered

The alternative would be custom building using the drag and drop primitives as pre-5.

@tommoor tommoor added the feature New feature or request label Dec 23, 2021
@nanxiaobei
Copy link

Really need this!

@AndrejGajdos
Copy link

would be great having this feature

@chocobuckle
Copy link

That "To allow dragging on both axes, pass the drag prop to child Reorder.Item components." line in the Reorder.Group props section completely threw me for the past 2 days. I too was under the impression that xy reordering was supported after reading that, only to now stumble upon the Twitter thead linked to above.

Would be fantastic if this could be added.

@cjoecker
Copy link

cjoecker commented Sep 2, 2022

Just submitted a Pull Request. This is how it is going to look:
Reorder

@flackeryy
Copy link

Updates here ?

@cjoecker
Copy link

cjoecker commented Nov 15, 2022

Updates here ?

The PR is open since Sep 01 but no answers yet :(

@flackeryy
Copy link

Yeah I see... however I have almost working example on codesandbox with custom drag dandlers, but it has some problems that i'm trying to resolve... So wanted to check if there is something ready from the box.

So i'll try to resolve bugs of my version :(

@cjoecker
Copy link

You could also copy-paste what I made and use patch-package to save the changes in your node-modules

@flackeryy
Copy link

@cjoecker

just in case, maybe you know a solution..

If you could look at this very old variant that I found, it looks like the old onDrag handler on each box, returns point parameter that looks like a dragged distance from the initial position of a component.

For example: when the first box on 0 index, and you drag in to right, the point parameter returns x pixels you already dragged from the box initial position. When the box switched to 1 index, point parameter returns x is negative value until you move box finally to new position, and once you move more and more to right, it has x as positive value so It looks like, once box index is updated (reordered), it understands that initial x,y changed and point parameter has new correct info.


The problem now, in latest framer-motion version, onDrag handler returns point, offset, delta parameters that are completely different to what was before, in old version. I'm checking the docs description to each parameter and its not same.

So it looks like right now onDrag event doesn't contain the parameter that contains dragged distance from the initial position of a component. However I need it to make my code works correctly...

@flackeryy
Copy link

Ah.. nevermind, sorry, I understand why it is happened like I want in old version. In old version, each box has positionTransition handler that gets a new position delta after reorder and updates it, so that why it understands the new position x,y.

Just sad that this handler is removed in new versions, and need to understand how to make similar move now

@flackeryy
Copy link

@cjoecker done! it's new onUpdate property, it contains x,y of dragged component based on current component position. Exactly what I need. Sorry for bothering you.

@mattgperry
Copy link
Collaborator

@cjoecker I don't know why I've not been getting updates to your PR but thanks, I'll take a look asap although the next week will probably be a little busy with layout animation work

@mattgperry mattgperry linked a pull request Jan 4, 2023 that will close this issue
@nanxiaobei
Copy link

Any updates?

@artemshchirov
Copy link

Any updates?

@cjoecker
Copy link

@mattgperry the PR for this issue is open for more than one year. Can you give it a check, please?

@jxhnxllxn
Copy link

any updates?

@alexanderhorner
Copy link

Would also really appreciate this!

@ImZaryab
Copy link

Need this feature ASAP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.