FE-1512: Place arc weight labels on the Adaptive Bezier curve - #9354
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
365bab8 to
6edbf79
Compare
PR SummaryLow Risk Overview In Reviewed by Cursor Bugbot for commit a5ad4f4. Bugbot is set up for automated code reviews on this repo. Configure here. |
The Adaptive Bezier renderer put weight labels at the straight-line midpoint between the arc's endpoints, despite a comment claiming the bezier midpoint. Long arcs sweep far from that line, leaving the label floating in empty space. The label now uses the cubic bezier point at t = 0.5: (P0 + 3*CP1 + 3*CP2 + P3) / 8.
6edbf79 to
a5ad4f4
Compare
🌟 What is the purpose of this PR?
With the Arcs rendering setting on Adaptive Bezier (the default), arc weight labels were drawn at the straight-line midpoint between the arc's endpoints, despite the code's comment claiming the bezier midpoint. Long arcs sweep far from that line, so the "× n" label floated in empty space with no visible connection to its arc. The label now sits on the curve.
Before — the "× 2" floats at the straight-line midpoint, in empty space:
After — the same label sits on its Infection → Infected curve (same net, same framing):
🔗 Related links
🚫 Blocked by
claude/fe-1510-canvas-single-initial-render; only the last commit belongs to this PR until that merges.🔍 What does this change?
getCustomArcPathinarc.tsxcomputes the label position as the cubic bezier point at t = 0.5 —(P0 + 3·CP1 + 3·CP2 + P3) / 8— from the same control points that define the path. The Square and Bezier renderings already got this right via React Flow's path helpers and are untouched.Pre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
The visual-settings page describes the rendering styles, not label placement.
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
🛡 What tests cover this?
getPointAtLengthsampling; it was ~100px off for long arcs before).❓ How to test this?
yarn workspace @hashintel/petrinaut dev, open a net with a weight > 1 arc (e.g.Petrinaut → Handle Spike With Sir).🤖 Generated with Claude Code