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

Add options for constrain by each axis #429

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ChugunovRoman
Copy link

Related #305

@ChugunovRoman ChugunovRoman mentioned this pull request Feb 1, 2023
Copy link
Owner

@isaacHagoel isaacHagoel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what's the usecase here? should the element be allowed to leave the origin dropzone?
How is keyboard dragging affected?
How is highlighting potential drop targets affected?

src/pointerAction.js Outdated Show resolved Hide resolved
@ChugunovRoman
Copy link
Author

ChugunovRoman commented Feb 2, 2023

@isaacHagoel

So what's the usecase here?

For example, I use this changes for tab swap by mouse and tabs should be moving only by X coordinate.
Also this feature can be applied in a board for constrain swap columns by Y.
And etc.

should the element be allowed to leave the origin dropzone?

What does this question related to the functionality of constraiting the movement of an element along the axes by dragging with the mouse?
I think that the functionality to allow the element to leave the dropzone is a separate feature that can be implemented if necessary.

How is keyboard dragging affected?

This has no affect on keyboard dragging. The behavior of keyboard dragging does not changed.

How is highlighting potential drop targets affected?

On highlighting potential drop targets this does not affect too.

@isaacHagoel
Copy link
Owner

I'll try to explain my concern better. Let's say I have 4 dropzones of the same type organized this way:
U
L. R
D
If you limit L to the X axis that means that elements can only be moved to R if you are using the mouse/touch but anywhere if you use the keyboard.
Also, when lifting an element from L all dropzones will be highlighted indicating that they are drop targets when in fact they are not. Same issue with the aria messages.
If L happens to be a vertical list, it also means that the items cannot be re-sorted and if R is vertical it means that any element taken from L and moved to R has only one index it can be dropped into.
This doesn't feel like good DX or UX to me. I am open to such feature, generally speaking but it needs to be thought out.

@ChugunovRoman
Copy link
Author

I think I understood. Are you talking about the behavior of the element that was dragged out of the dragzone? I think we also able to change this behavior via new property in the options.

@segovo
Copy link

segovo commented Feb 10, 2023

This feature works great for me, I'd just like to add that changing createDraggedElementFrom() should be considered so that if centreDraggedOnCursor is true it doesn't move the element in one of the constrained axises. In other words, centreDraggedOnCursor should only center an item vertically in a vertical only movement constrained list.

@isaacHagoel
Copy link
Owner

isaacHagoel commented Feb 12, 2023 via email

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

Successfully merging this pull request may close these issues.

3 participants