-
Notifications
You must be signed in to change notification settings - Fork 1k
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
When using bounds, I expect ui.x and ui.y within bounds #200
Comments
Definitely surprising for me too. Have to build some custom logic around to get the correct behavior. |
Same. I essentially have to do this: onDrag = (e, ui) => {
const boundingBox = this.refElement.getBoundingClientRect();
let actualX = ui.x;
let actualY = ui.y;
if (ui.x < boundingBox.left) {
actualX = boundingBox.left;
} else if (ui.x > boundingBox.left + boundingBox.width) {
actualX = boundingBox.left + boundingBox.width;
}
// Do the same for ui.y
// return actualX and actualY for use, rather than the original `ui` object
} |
Was surprise as well |
Ref: #226 |
Fixed in 55f701e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This follow up #150
When creating a draggable with bounds, if your mouse pointer goes outside the bounds, the draggable element stays within the bounds.
However, using a event listener on onDrag like this below shows that the
ui.x
property is the one of the pointer, not the one of the draggable (ie : the ui.x continues to be updated even if I'm outside of the bounds)The text was updated successfully, but these errors were encountered: