Open
Conversation
- useVertexEditing フックで頂点ハンドルの管理・ドラッグを実装 - ライン/ポリゴン選択時に頂点ハンドル(白丸)を表示 - ドラッグ中はリアルタイムでフィーチャ形状をプレビュー - mouseup 時に座標をコミット(undo 履歴に乗る) - 頂点クリック時は選択解除しないよう justDraggedRef で制御 - dragMapAtOffset ヘルパーを追加、E2Eシナリオ1件追加 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthrough確認済みのラインおよびポリゴンフィーチャに対して、頂点をドラッグして位置を変更する機能を実装しました。新しいカスタムフックと補助関数、E2Eテスト、およびMapViewコンポーネントの統合が含まれます。 Changes
Sequence Diagram(s)sequenceDiagram
participant User as ユーザー
participant MapView as MapView
participant Hook as useVertexEditing<br/>(Hook)
participant Map as MapLibreGL<br/>Map
participant Source as Vertex Source<br/>(GeoJSON)
User->>MapView: フィーチャーを選択
MapView->>Hook: selectedFeatureIdが変更される
Hook->>Hook: getVertexHandles()で頂点を計算
Hook->>Source: 頂点ハンドルのGeometryを更新
Source->>Map: 頂点ハンドルをレンダリング
User->>Map: 頂点ハンドルにマウスダウン
activate Map
Map->>Hook: mousedownイベント
Hook->>Hook: ドラッグ状態をキャプチャ<br/>map.dragPan.disable()
deactivate Map
User->>Map: 頂点をドラッグ(mousemove)
activate Map
loop ドラッグ中
Map->>Hook: mousemoveイベント
Hook->>Hook: applyVertexMove()で<br/>フィーチャー座標を更新
Hook->>Source: 更新済みフィーチャーを<br/>メインSourceに反映
end
deactivate Map
User->>Map: マウスを放す(mouseup)
activate Map
Map->>Hook: mouseupイベント
Hook->>Hook: ドラッグ状態をクリア<br/>map.dragPan.enable()
Hook->>MapView: onCommit(updatedFeature)
MapView->>MapView: updateFeatureVertex()で<br/>フィーチャーを確定
deactivate Map
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~28 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
e2e/features/vertex-editing.feature (1)
17-19: 頂点座標の変更を検証するアサーションの追加を検討してください。現在のシナリオでは、ドラッグ後にフィーチャ数とジオメトリタイプのみを検証しています。頂点編集が実際に適用されたことを証明するには、座標が変更されたことを検証するアサーションがあると、より堅牢なテストになります。
例: ドラッグ前後の GeoJSON 座標を比較するステップを追加する。
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@e2e/features/vertex-editing.feature` around lines 17 - 19, Add an assertion that verifies the vertex coordinates actually changed by capturing the GeoJSON coordinates before the step "もし 地図の中央から右に 60px の位置の頂点を右に 40px ドラッグする" and comparing them to the coordinates after that step; update the scenario to store the pre-drag coordinates (e.g., via a "given" or helper step that fetches GeoJSON) and then add a "then" step that asserts the first feature's LineString coordinates differ from the saved pre-drag coordinates (or that a specific vertex moved by ~40px in map units), referencing the existing scenario steps to locate where to insert the new pre- and post-drag checks.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@e2e/features/vertex-editing.feature`:
- Around line 17-19: Add an assertion that verifies the vertex coordinates
actually changed by capturing the GeoJSON coordinates before the step "もし
地図の中央から右に 60px の位置の頂点を右に 40px ドラッグする" and comparing them to the coordinates
after that step; update the scenario to store the pre-drag coordinates (e.g.,
via a "given" or helper step that fetches GeoJSON) and then add a "then" step
that asserts the first feature's LineString coordinates differ from the saved
pre-drag coordinates (or that a specific vertex moved by ~40px in map units),
referencing the existing scenario steps to locate where to insert the new pre-
and post-drag checks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
useVertexEditingフックでライン/ポリゴンの頂点ハンドル管理を実装mouseup時にsetFeaturesでコミット(undo 履歴対象)justDraggedRefで頂点クリック直後の選択解除を防止dragMapAtOffsetE2E ヘルパーを追加Test plan
npm test)vertex-editing.feature(1シナリオ) 含む40シナリオすべてパス (npm run test:e2e)Closes #42
Summary by CodeRabbit
リリースノート
New Features
Tests