DragService: allow a custom cursor for component drags

オープン 初心者向け
#455 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
77/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
frontend

調査の方向性

組み込みのコンポーネントドラッグ経路から始めます。src/services/drag/DragService.ts と packages/graph/src/services/drag/DragService.ts では、issue によると grabbing が直接指定されています。これらの経路を既存の startDrag({…}, {cursor}) オプションと比較します。標準のコンポーネントドラッグでアクティブなカーソルを選択でき、デフォルトで grabbing を使用し、終了またはキャンセル後にカーソルの自動選択に戻るようになれば完了です。

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

説明

Use case

A canvas component represents a draggable handle for an orthogonal edge segment. A vertical segment moves horizontally, so it should show ew-resize throughout the gesture. The corresponding cursor for a horizontal segment is ns-resize.

Reproduction

  1. Use a custom GraphComponent with isDraggable() returning true, a hover cursor of ew-resize, and the standard handleDragStart / handleDrag callbacks.
  2. Hover the handle, press it, then move far enough for the component drag to begin.
  3. The cursor switches to grabbing for the active drag.

Expected behavior

Allow the component that initiates a standard component drag to opt into its own active drag cursor. Keep grabbing as the default. The active cursor may differ from the hover cursor. After the drag ends or is cancelled, return to automatic cursor selection.

startDrag({…}, {cursor}) already supports a cursor for custom operations. The built-in component path supplies "grabbing" directly in main and v2.

主要言語
TypeScript
スター
145
フォーク
12
平均マージ
1日 14時間
マージ済み PR(30日)
43

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

gravity-ui/graph のほかの issue

gravity-ui/graph の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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