Conversation
Code ReviewThanks for adding intersection navigation to the Go To feature - this is a meaningful accessibility enhancement for multiline plots. The geometric intersection algorithm is correct and well-documented. Below are issues that should be addressed before merging. Bugs1. Non-unique React key props (GoToExtrema.tsx) The key built from 2.
3. The current group index is always added to the Design / Fragility4. String parsing for display logic (GoToExtrema.tsx ~L348-358) Display labels are constructed in 5. Semantic mismatch: intersections in The existing interface, type field ( Performance6. O(n x m^2) intersection scan on every dialog open (line.ts ~L633)
7. Intersection grouping by rounded x may be imprecise (line.ts ~L709-713) Rounding to 2 decimal places can merge nearby but distinct intersections, or separate intersections that are genuinely close. A tolerance-based deduplication (comparing Missing TestsThe PR checklist marks "I have added appropriate unit tests" as unchecked. The new algorithmic logic (
Minor
|
PR Review: feat: go to intersectionGreat feature addition! The intersection detection for multiline plots is a meaningful accessibility improvement. Below is a detailed review covering architecture, correctness, and test quality. Architecture Concerns1. Presentation logic in model types (Medium)The new display?: {
coords?: string; // e.g., "x=1.50, y=2.50"
otherLines?: string; // e.g., "Line A, Line B"
};Per MVVC architecture, formatting strings for display belongs in the ViewModel or View layer, not in model types. The model should expose raw data (numbers, indices), and let higher layers format it. Consider removing Similarly, the Correctness Issues2. Distance calculation uses only x-axis distance (Bug)When choosing the nearest point index to an intersection, only the x-distance is compared: // src/model/line.ts
const distToStart = Math.abs(intersection.x - seg1Start.x);
const distToEnd = Math.abs(intersection.x - seg1End.x);
const nearestPointIndex = distToStart <= distToEnd ? segIndex : segIndex + 1;This is incorrect for nearly vertical line segments where x-coordinates of both endpoints are very similar but y-coordinates differ significantly. Use Euclidean distance instead: const distToStart = Math.hypot(intersection.x - seg1Start.x, intersection.y - seg1Start.y);
const distToEnd = Math.hypot(intersection.x - seg1End.x, intersection.y - seg1End.y);3.
|
| Severity | Count | Notes |
|---|---|---|
| Bug | 2 | Euclidean distance (#2), undefined in string (#6) |
| Architecture | 1 | Presentation logic in model types (#1) |
| Minor | 3 | fill for naming (#3), epsilon scale (#4), cache leak (#5) |
| Test | 2 | Unused variable (#7), conditional assertion (#8) |
The core intersection algorithm (getSegmentIntersection) is mathematically correct and the feature concept is solid. Addressing the distance calculation bug and the architecture concern around display fields would put this in good shape for merge.
Code Review — Follow-upThanks for addressing the issues from the previous review — the Euclidean distance fix, caching, epsilon-based deduplication, the Bugs1.
|
| Severity | # | Issue |
|---|---|---|
| Bug | 2 | fill displays raw color (#1), inconsistent fallback format (#2) |
| Minor | 4 | Cache not cleared (#3), misleading comment (#4), absolute epsilon (#5), display field gap (#6) |
| Test | 1 | Undocumented data dependency (#7) |
The algorithm and overall structure are sound. The two bugs around line naming (items 1 & 2) are the most user-visible — a screen reader user hearing "Intersection with #1f77b4" gets no meaningful information. Everything else is minor polish.
|
I tested the feature, It found the intersaction points (same x & y value) but the issue is we dont have that exact point as svg element in the image. So goto doesn't exactly land at the intersection point as specified in the options (it lands at the closest available svg point). I think we may have to re-think a bit of how we have to design this. We can discuss further in tomorrow's call. |
|
The navigation model is discrete (index-based: this.col = N), so it can only land on actual data points. Geometric intersections occur between data points and there's no mechanism to represent or navigate to an intermediate position. We can have two possible solutions:
|
|
Code Review - PR 563 (feat: go to intersection) Great feature addition! Adding intersection navigation to multiline plots is a meaningful accessibility improvement. Here are my observations. BUGS AND CORRECTNESS ISSUES
DESIGN AND ARCHITECTURE CONCERNS
MINOR ISSUES
WHAT IS DONE WELL
|
|
🎉 This PR is included in version 3.55.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Pull Request
Description
Implemented intersections in the go to feature, accessible with the g key. In a multiline plot, the g key in addition to the extremas, now lists all the points where the currently selected line intersects another line.
Related Issues
Changes Made
Screenshots (if applicable)
Checklist
ManualTestingProcess.md, and all tests related to this pull request pass.Additional Notes