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

Option to position *cdkDragPreview under the cursor #18176

Closed
JohnKis opened this issue Jan 15, 2020 · 4 comments
Closed

Option to position *cdkDragPreview under the cursor #18176

JohnKis opened this issue Jan 15, 2020 · 4 comments
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix

Comments

@JohnKis
Copy link

JohnKis commented Jan 15, 2020

Feature Description

When using custom preview templates with *cdkDragPreview, the preview is always positioned next to the cursor. This behaviour is different to using the default preview where the preview is positioned relative the pickup location.

I had a look in the code and removing the if shorthand at https://github.com/angular/components/blob/master/src/cdk/drag-drop/drag-ref.ts#L753 solves this. Checking the _getPointerPositionInElement method I couldn't find any reason why it wouldn't work with custom preview templates.

Use Case

This would be improve UX when using a custom preview template that has similar dimensions to the root element.

@JohnKis JohnKis added the feature This issue represents a new feature or feature request rather than a bug or bug fix label Jan 15, 2020
@crisbeto
Copy link
Member

The reason why it was made this way is because we can't know ahead of time the size of the custom preview until it's actually in the DOM.

@JohnKis
Copy link
Author

JohnKis commented Jan 15, 2020

@crisbeto - Fair enough. I guess it makes more sense in cases where the preview size is known to be the same as the draggable element's. I opened a related feature request: #18177.

It could be an option that's disabled by default.

@crisbeto
Copy link
Member

crisbeto commented Feb 1, 2020

Closing since it should be handled by #18177.

@crisbeto crisbeto closed this as completed Feb 1, 2020
@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 Mar 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix
Projects
None yet
Development

No branches or pull requests

2 participants