Tooltip arrow is not centered on the highlighted element and `arrowSize` does not control its rendered size

オープン
#354 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
react-native, typescript
領域
mobile

調査の方向性

まず、[email protected] におけるツールチップの矢印の配置と三角形の描画を特定し、次に、強調表示された要素のレイアウトと arrowSize がどのように使われているかを追跡します。完了の条件は、矢印が強調表示された要素の中央に配置され、設定された arrowSize を使用し、画面端付近でも画面内に完全に収まることです。

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

説明

In [email protected], the tooltip arrow is positioned at a fixed margin from either the left or right tooltip edge:

arrow.right = tooltip.right + margin;

// or

arrow.left = tooltip.left + margin;

The side is selected based on which half of the screen contains the highlighted element. However, the arrow position does not use the element's actual horizontal center. This causes the arrow to appear near a tooltip corner instead of pointing at the highlighted element, especially for wide targets such as cards, banners, and navigation areas.

The arrowSize prop is also used in the positioning calculations, but the rendered triangle keeps the hardcoded ARROW_SIZE value as its borderWidth. Therefore, a custom arrowSize can produce a mismatch between the calculated and rendered arrow sizes.

Expected behavior:

  • The arrow should point at the horizontal center of the highlighted element.
  • The rendered triangle should use the value provided through arrowSize.
  • The arrow should remain inside the screen when the highlighted element is close to an edge.

Potential solution:

arrow.borderWidth = arrowSize;

arrow.left = Math.max(
  0,
  Math.min(
    center.x - arrowSize,
    newMeasuredLayout.width - arrowSize * 2,
  ),
);

The existing arrow.left and arrow.right assignments based on the tooltip edge would be removed. center.x - arrowSize aligns the middle of the triangle with the middle of the highlighted element, while the bounds keep the complete arrow visible on screen.

主要言語
TypeScript
スター
2.4k
フォーク
425
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

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

mohebifar/react-native-copilot のほかの issue

mohebifar/react-native-copilot の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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