-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(cdk/drag-drop): introduce resetToBoundary
#30436
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
Conversation
src/cdk/drag-drop/drag-ref.ts
Outdated
resetToBoundary(): void { | ||
// can be null if the drag item was never dragged. | ||
if (this._boundaryElement) { | ||
let x = this._boundaryElement.offsetWidth - this._rootElement.offsetWidth, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I follow why we need the offset here, it seems like it just gets moved all the way to the right of the boundary. I think we should check if the element is outside the boundary and move it by the amount of overflow pixels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I initially just moved it to the right of the boundary. I have made it calculate now offset of the overflown pixels. lemme know if this needs any more correction.
Looks like there's a merge conflicts in the API goldens. |
this commit introduces `resetToBoundary` in DragRef which allows user to align DragItem to its boundary on demand if at one point it was at a place where the boundary element used to be and has shrinked causing DragItem to be outside of the boundary box fixes angular#30325
this commit introduces
resetToBoundary
in DragRef which allows user to align DragItem to its boundary on demand if at one point it was at a place where the boundary element used to be and has shrinked causing DragItem to be outside of the boundary boxfixes #30325