-
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: incorrect position when dragging child element #13107
Comments
It seems like this is due to the fact that |
Copying over the calculation from the touch event seems to result in the correct behavior. const x = (this._isTouchEvent(event) ? event.targetTouches[0] : event).pageX - referenceRect.left - this._scrollPosition.left;
const y = (this._isTouchEvent(event) ? event.targetTouches[0] : event).pageY - referenceRect.top - this._scrollPosition.top; Can anyone verify this? |
…nt, in some cases Fixes `CdkDrag` not calculating the pointer position inside the element correctly, if dragging started from inside another element within the draggable. Fixes angular#13107.
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. |
Bug, feature request, or proposal:
When a
cdk-drag
is within acdk-drop
, thecdk-drag
element will jump to an incorrectly offset position when the mouse is first moved, given that the user drags this element using a child. The offset is always the same as the child element's offset from the parentcdk-drag
container (for example, padding of the parent or margin of the child).What is the expected behavior?
The
cdk-drag
element should always stay at the same position relative to the cursor.What is the current behavior?
The
cdk-drag
element jumps towards the bottom right when the child element is offset from its parent.What are the steps to reproduce?
https://stackblitz.com/edit/angular-92bnjh?file=app/cdk-drag-drop-sorting-example.html
Drag using
"FIRST"
,"LAST"
or the movie title to see the incorrect behavior. Dragging by the parent element results in the correct and desired behavior.Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular Material:
7.0.0-beta.0
The text was updated successfully, but these errors were encountered: