Skip to content

Add per-type label font size to node and edge styling#1930

Open
danielvanza wants to merge 2 commits into
aws:mainfrom
danielvanza:add-per-type-font-size
Open

Add per-type label font size to node and edge styling#1930
danielvanza wants to merge 2 commits into
aws:mainfrom
danielvanza:add-per-type-font-size

Conversation

@danielvanza

Copy link
Copy Markdown

Summary

  • Font size was a hardcoded global constant (7px, with a 6px minimum-zoomed size) applied only through the generic node/edge Cytoscape selectors, so every vertex/edge type rendered labels at the same size.
  • Adds fontSize and minZoomedFontSize to the vertex/edge style cascade (VertexVisualStyle/EdgeVisualStyle), with the existing 7/6 values as app defaults, so the fields resolve through the existing app-default → shared → user cascade.
  • Emits font-size/min-zoomed-font-size from the per-type Cytoscape selectors, and exposes the two values as inputs in the node and edge style dialogs.
  • The fields flow through the existing styling import/export as additive optional fields — no STYLING_EXPORT_VERSION bump needed.
  • Also drops the node badge's fixed maxWidth truncation, since it assumed the old fixed font size and would clip short labels once a larger custom size is set.

Test plan

  • pnpm checks (types, lint, format)
  • pnpm test — all green except one pre-existing, unrelated flaky test on main (safeSessionStorage.test.ts, confirmed failing on a clean checkout of main as well)
  • New/updated unit tests: style cascade defaults + overrides, per-type Cytoscape selector emission (vertex and edge), styling import/export round-trip, badge truncation behavior
  • Manual verification: opening a node/edge Customize dialog shows the new font-size inputs; changing them resizes that type's labels; Reset restores 7/6; export/import round-trips the values

Font size was a hardcoded global constant applied only through the generic
node/edge Cytoscape selectors, so every type rendered labels at the same
size. Add fontSize and minZoomedFontSize to the vertex/edge style cascade
(with the existing 7/6 defaults), emit them from the per-type selectors,
and expose them as inputs in the node and edge style dialogs. The fields
flow through the existing styling import/export as additive optional
fields, no export version bump needed.

Also drop the node badge's fixed maxWidth truncation, which assumed the
old fixed font size and would clip short labels once a larger custom size
is set.
useGraphStyles.test.tsx asserted font-size/min-zoomed-font-size only for
vertex selectors; add the same coverage on the edge side. Add a small
useNodeBadges test asserting the label badge no longer carries the fixed
maxWidth that used to clip labels at the old, non-configurable font size.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants