angular / angular/components

feat(drag-and-drop): Allow more flexibility for position of *DragPreview directive relative to mouse position

Đang mở
#27,749 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
area: cdk/drag-drop feature
Ngôn ngữ chính
TypeScript
Star
25k
Fork
6.8k
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
91

Mô tả

### 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 I use the drag preview directive `*cdkDragPreview` for my horizontal list, the dragged item position is wrong

Possibly related #16171

### Reproduction

[StackBlitz link](https://stackblitz.com/edit/components-issue-1y4nnz?file=src%2Fapp%2Fexample-component.html,src%2Fapp%2Fexample-component.ts,src%2Fapp%2Fexample-component.css)

### Expected Behavior

`*cdkDragPreview` dragging position should be the same as the dragging position is without using `cdkDragPreview`

### Actual Behavior

The dragging position always started from the pointer edge, giving a undesired behavior

### Environment

- Angular: v16
- CDK/Material: v16
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): All

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với các tệp StackBlitz được liên kết src/app/example-component.html, src/app/example-component.ts và src/app/example-component.css để tái hiện hành vi của danh sách ngang với *cdkDragPreview. Sau đó, lần theo điểm vào của Angular CDK drag-preview và so sánh độ lệch của con trỏ với thao tác kéo không có bản xem trước. Hoàn tất khi bản xem trước giữ nguyên vị trí mong đợi của mục so với con trỏ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
angular, typescript
Lĩnh vực
frontend
Loại issue
Tính năng
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.