angular / angular/components

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

オープン
#27,749 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
area: cdk/drag-drop feature
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

### 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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

リンクされている StackBlitz ファイル src/app/example-component.html、src/app/example-component.ts、src/app/example-component.css から始めて、*cdkDragPreview を使った横方向リストの動作を再現します。次に Angular CDK drag-preview のエントリポイントを追跡し、プレビューなしでドラッグした場合とポインターのオフセットを比較します。プレビューがポインターに対するアイテムの期待される位置を維持すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
frontend
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。