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

Drop dragged item if it intersects more than 50% of the drop area #3629

Open
andrikalin opened this issue Apr 25, 2024 · 1 comment
Open

Comments

@andrikalin
Copy link

Hello there and thanks for your library!
I have a question about the basic usage of the drag & drop feature.
In our project, we have a dragging item:

const [{ isDragging }, drag] = useDrag({
	type: 'block',
	item: { id, name, answers, order, parents, description, secondsFalling, accuracyCoefficient },
	collect: (monitor) => ({
	  isDragging: monitor.isDragging(),
	})
});

and drop area where this item can be dropped:

const [, drop] = useDrop({
    accept: 'block',
    drop: handleDrop,
});

The issue I've noticed: the item can be dropped into the drop area only when the cursor is above the drop area. So there are situations when the dragged item is 90% over the drop area, but it can't be dropped because the cursor (the place, where we grabbed the item) isn't over the drop area yet. Check the screenshot for the case demo: https://prnt.sc/KqAukNobfJm9.

Is there an option to trigger drop somehow if the dragged item intersects over 50% of its own width into the drop area, or smth like this?

Thanks in advance!

@amala-locai
Copy link

@andrikalin Did you find any workaround for this issue?

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

No branches or pull requests

2 participants