-
Notifications
You must be signed in to change notification settings - Fork 39
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
exeDrag
while dragging the shape applies dramatically
#86
Comments
@aghArdeshir i still don't see the reason why |
Hi. Thanks for the quick reply. The use case is "snapping". Suppose there is a line or there are two elements I want to snap the tops, or centers together when they are in a suitable distance (i.e. <20px). Like how Miro does snapping: I created another sandbox for the use case I have: https://codesandbox.io/p/sandbox/mystifying-heisenberg-3zxxdn?file=%2Fsrc%2Findex.js%3A31%2C13 which shows a message when I should snap. My strategy was to call |
@aghArdeshir got you. I don't think it's possible to emulate "snapping" this way. It's more like separate feature. |
Thanks again for the reply.
I did not understand this part though. I created this third sandbox: https://codesandbox.io/p/sandbox/quizzical-water-9gtn9w?file=%2Fsrc%2Findex.js%3A24%2C85 which tries to snap the element. But the "jumping" of element does not actually snap it. When I ask it to |
@aghArdeshir yes, I see that strange behavior you described. I did not suppose if |
This is how I "supposed" it might work and ended up calling
Just sharing with you, so you know how I thought it should work after reading the docs. |
Another API/Event suggestion that could help with this use case, would be a
This could be a more general purpose mechanism, by which the subjx itself could implement the or the With such a callback, the snapping feature I had in mind could also be implemented easily (I guess) |
When dragging a shape, and in middle of drag, if I call
exeDrag
to move the shape by a pixel, the result would be HUGE changes. What I "guess" is happening by observing the behavior, looks like each call toexeDrag
applies the delta from parameters, plus all the dragging user did by mouse. In the codeSandBox below, If you press "Arrow Down" the shape will be moved down only by one pixel. But if we call the same method to move shape by one pixel while dragging the shape, the shape moves drastically. Just start dragging the shape vertically. (and check the console to make sure how many times we are moving the shape by one pixel. It should not be this much dramatic)CodeSandBox: https://codesandbox.io/p/sandbox/gallant-sun-tdk5lg?file=%2Fsrc%2Findex.js
The text was updated successfully, but these errors were encountered: