-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
CDK Drag and Drop cdkDragBoundary is not working after resize in responsive design #15749
Comments
Hi team, any ETA |
Hi |
Having this issue too. |
@VigneshMadhavan @kadnova here is a workaround First, you will have to observe any viewport changes or anything along those lines.. but after, you can do this .....
@ViewChild(CdkDrag) cdkDrag: CdkDrag;
reset() {
this.cdkDrag._dragRef['_previewRect'] = undefined;
this.cdkDrag._dragRef['_boundaryRect'] = undefined;
}
.... Example here (click the reset button to get it to work again) |
…viewport resize Adds some logic to ensure that an element inside a boundary is contained within it after the viewport is resized and the boundary may have changed size. Fixes angular#15749.
…nges between drag sequences When a drag sequence is started we cache the dimensions of the element and the boundary so that we don't have to cause a reflow for each pixel of dragging, however with the current logic the cached dimensions are only cleared for the case where the item is part of a drop list. As a result, if a freely-dragged item with a boundary changes size between drag sequences its position won't be constrained correctly anymore. These changes fix the issue by correctly clearing the cached dimensions in all cases. Fixes angular#15749.
…nges between drag sequences When a drag sequence is started we cache the dimensions of the element and the boundary so that we don't have to cause a reflow for each pixel of dragging, however with the current logic the cached dimensions are only cleared for the case where the item is part of a drop list. As a result, if a freely-dragged item with a boundary changes size between drag sequences its position won't be constrained correctly anymore. These changes fix the issue by correctly clearing the cached dimensions in all cases. Fixes #15749.
…nges between drag sequences (#16876) When a drag sequence is started we cache the dimensions of the element and the boundary so that we don't have to cause a reflow for each pixel of dragging, however with the current logic the cached dimensions are only cleared for the case where the item is part of a drop list. As a result, if a freely-dragged item with a boundary changes size between drag sequences its position won't be constrained correctly anymore. These changes fix the issue by correctly clearing the cached dimensions in all cases. Fixes #15749.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
What is the expected behavior?
The Drag element should be dragged inside cdkDragBoundary boundary even after resize the browser window.
What is the current behavior?
Dragging area is less than cdkDragBoundary boundary
What are the steps to reproduce?
https://dragndrop-restrction.stackblitz.io/
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular 7
CDK 7
Windows 10
TypeScript 3.1
IE11, Edge, Chrome 73, Firefox 66
Is there anything else we should know?
The dragged item is responsive so it will change as per browser size
The text was updated successfully, but these errors were encountered: