Derive edge arrow icons and share the edge line rendering#1983
Draft
kmcginnes wants to merge 2 commits into
Draft
Derive edge arrow icons and share the edge line rendering#1983kmcginnes wants to merge 2 commits into
kmcginnes wants to merge 2 commits into
Conversation
kmcginnes
force-pushed
the
derive-arrow-icons
branch
from
July 21, 2026 22:56
f156e02 to
6bc0a0e
Compare
The 11 hand-drawn Arrow* icons duplicated the arrow-head geometry that arrowShapes.ts already ports verbatim from cytoscape. Replace them with a single ArrowStyleIcon that renders the resolved geometry for any ArrowStyle, so the picker and edge details always match what the canvas draws. - Add ArrowStyleIcon: a short edge line ending in the arrow head, with a shared viewBox so line thickness and zoom are constant and head trailing edges align across styles; line length varies with head depth. - Extract ArrowPrimitiveShape from EdgePreview as the shared primitive renderer for both the preview and the icon. - Rewire the arrow-style picker and EdgeDetail to ArrowStyleIcon; delete the 11 Arrow* icon files and their barrel exports.
The edge details sidebar hand-rolled its own vertical connector (arrow icons stacked around a gradient CSS line), which misaligned with the arrow heads. Extract the edge style preview's proven line+arrowhead machinery into a shared, orientation-aware EdgeLinePreview so both the horizontal style preview and the vertical details connector draw from the same cytoscape geometry. - Add EdgeLinePreview: line + source/target arrow heads + optional centered label, in "horizontal" or "vertical" orientation. Arrow heads are rotated to point along the edge and pinned by their tip at cytoscape's spacing/gap insets, so the line meets each head correctly in either orientation. - Extract ArrowPrimitiveShape as the shared primitive renderer. - EdgePreview now composes EdgeLinePreview (label included) + node placeholders; geometry resolves once instead of per-arrow-plus-label. - EdgeDetail renders EdgeLinePreview vertically, replacing the hand-rolled connector and its styleForLineStyle gradient helper. It gains an aria-label since the arrows are otherwise visual-only. - Rename DEFAULT_EDGE_PREVIEW_ZOOM to EDGE_PREVIEW_SCALE (mirrors the vertex preview's PREVIEW_SCALE) and separate it from the CSS-zoom fit control. - Add tests: render smoke over every arrow pair x orientation, the label overlay in both orientations, and rotatedBbox unit tests.
kmcginnes
force-pushed
the
derive-arrow-icons
branch
from
July 24, 2026 17:14
6bc0a0e to
8fc7405
Compare
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.
Description
Two related changes that make the edge previews draw from cytoscape's own arrow geometry instead of hand-maintained copies.
1 — Derive arrow icons from cytoscape geometry. The 11 hand-drawn
Arrow*SVG icons (ArrowTriangle,ArrowVee,ArrowCircle,ArrowDiamond,ArrowSquare,ArrowTee,ArrowNone,ArrowTriangleTee,ArrowTriangleCross,ArrowTriangleCircle,ArrowTriangleBackCurve) were a second, hand-maintained copy of geometry thatarrowShapes.tsalready derives (a verbatim port of cytoscape's arrow shapes). Replaced all 11 with a singleArrowStyleIconthat renders the resolved geometry for anyArrowStyle, so the picker glyphs are guaranteed to match the canvas. The 11 icon files and their barrel exports are deleted.2 — Share the edge line rendering between the preview and the details panel. The edge details sidebar hand-rolled its own vertical connector (arrow icons stacked around a gradient CSS line), which misaligned with the arrow heads. Extracted the edge style preview's line + arrow-head machinery into a shared, orientation-aware
EdgeLinePreview. It renders the line, source/target arrow heads (rotated to point along the edge and pinned by their tip at cytoscape's spacing/gap insets), and an optional centered label, in"horizontal"(style preview) or"vertical"(details connector) orientation.EdgeDetailnow uses it vertically, dropping the hand-rolled connector and itsstyleForLineStylegradient helper.Supporting:
ArrowPrimitiveShape(the polygon/path/circle renderer) is extracted soEdgePreview,ArrowStyleIcon, andEdgeLinePreviewshare one primitive renderer;EDGE_PREVIEW_SCALEis renamed fromDEFAULT_EDGE_PREVIEW_ZOOMto mirror the vertex preview'sPREVIEW_SCALEand separate the model→px scale from the CSS-zoomfit control.How to read
resolveArrowGeometryEdgeLinePreview+ node placeholdersEdgeLinePreview, oldArrowswitch + gradient helper removedArrowStylevaluesValidation
pnpm checkspasses (types, lint, format);pnpm testpassesArrowStyleIcon.test.tsx(shared viewBox, shaft, per-style head counts, tip-shift math) andEdgeLinePreview.test.tsx(render smoke over every arrow pair × orientation, label overlay in both orientations,rotatedBboxunit tests)Related Issues
Check List
pnpm checkspasses with no errors.pnpm testpasses with no failures.