Skip to content
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

bug(CdkDrag): Set free drag position doesn't take scale into consideration on first drag event #29737

Closed
1 task
raducostea opened this issue Sep 15, 2024 · 1 comment · Fixed by #29739
Closed
1 task
Assignees
Labels
area: cdk/drag-drop P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@raducostea
Copy link

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When using a parent scaled component and cdkDragFreeDragPosition with cdkDragScale, on first drag the element jumps and then the draging works correctly.

Reproduction here
https://stackblitz.com/edit/stackblitz-starters-9kq1ej?file=src%2Fmain.ts

My guess is that passive transform in drag ref does not update to take scale into consideration
https://github.com/angular/components/blob/main/src/cdk/drag-drop/drag-ref.ts#L594

Reproduction

StackBlitz link:
https://stackblitz.com/edit/stackblitz-starters-9kq1ej?file=src%2Fmain.ts

Steps to reproduce:

  1. Add scale transform to parent component
  2. Add cdkDrag, cdkDragFreeDragPosition (required) and cdkDragScale to draggable element

Expected Behavior

On drag when using scale, the element should not jump

Actual Behavior

When using a parent scaled component and cdkDragFreeDragPosition with cdkDragScale, on first drag the element jumps and then the draging works correctly.

Environment

  • Angular: 18.2
  • CDK/Material: 18.2
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): macOS
@raducostea raducostea added the needs triage This issue needs to be triaged by the team label Sep 15, 2024
@crisbeto crisbeto self-assigned this Sep 16, 2024
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent area: cdk/drag-drop and removed needs triage This issue needs to be triaged by the team labels Sep 16, 2024
crisbeto added a commit to crisbeto/material2 that referenced this issue Sep 16, 2024
Fixes that the scale was only being synced when the user drags, but we need it also when setting the free drag position.

Fixes angular#29737.
crisbeto added a commit that referenced this issue Sep 17, 2024
…#29739)

Fixes that the scale was only being synced when the user drags, but we need it also when setting the free drag position.

Fixes #29737.
crisbeto added a commit that referenced this issue Sep 17, 2024
…#29739)

Fixes that the scale was only being synced when the user drags, but we need it also when setting the free drag position.

Fixes #29737.

(cherry picked from commit 4cd2152)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Oct 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: cdk/drag-drop P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants