Skip to content

FE-1512: Place arc weight labels on the Adaptive Bezier curve - #9354

Merged
kube merged 1 commit into
claude/fe-1510-canvas-single-initial-renderfrom
claude/fe-1512-adaptive-bezier-label-midpoint
Aug 27, 2026
Merged

kube merged 1 commit into
claude/fe-1510-canvas-single-initial-renderfrom
claude/fe-1512-adaptive-bezier-label-midpoint

Conversation

@kube

@kube kube commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🌟 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:

image

After — the same label sits on its Infection → Infected curve (same net, same framing):

image

🔗 Related links

🚫 Blocked by

🔍 What does this change?

  • getCustomArcPath in arc.tsx computes 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:

  • modifies an npm-publishable library and I have added a changeset file(s)

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change

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:

  • do not affect the execution graph

🛡 What tests cover this?

  • None directly — the function is private to the arc component. Verified in the running app: for every weighted arc, the label's translate now lies on the rendered path (measured 0.7px off via getPointAtLength sampling; it was ~100px off for long arcs before).

❓ How to test this?

  1. yarn workspace @hashintel/petrinaut dev, open a net with a weight > 1 arc (e.g. Petrinaut → Handle Spike With Sir).
  2. Viewport settings → Arcs rendering → Adaptive Bezier (default).
  3. Drag the connected nodes far apart vertically: the "× 2" label stays on the curve instead of drifting into empty space.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview Aug 27, 2026 12:05pm
petrinaut Ready Ready Preview Aug 27, 2026 12:05pm
petrinaut-docs Ready Ready Preview Aug 27, 2026 12:05pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview Aug 27, 2026 12:05pm

Request Review

@cursor

cursor Bot commented Aug 26, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Visual-only label positioning in one private path helper; no auth, data, or simulation logic changes.

Overview
Fixes Adaptive Bezier arc rendering so weight labels (e.g. × 2) align with the visible curve instead of the straight line between endpoints.

In getCustomArcPath, label coordinates now use the cubic Bézier midpoint at t = 0.5(P0 + 3·CP1 + 3·CP2 + P3) / 8 — using the same control points as the path. The unused dy term is dropped. Smoothstep and standard Bezier modes are unchanged (React Flow already returns correct label positions). A patch changeset documents the @hashintel/petrinaut release.

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.
@kube
kube force-pushed the claude/fe-1512-adaptive-bezier-label-midpoint branch from 6edbf79 to a5ad4f4 Compare August 27, 2026 11:54
@kube
kube added this pull request to the merge queue Aug 27, 2026
Merged via the queue into main with commit 4d9ea2d Aug 27, 2026
55 checks passed
@kube
kube deleted the claude/fe-1512-adaptive-bezier-label-midpoint branch August 27, 2026 12:50
@hash-release hash-release Bot mentioned this pull request Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

2 participants