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

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

Conversation

@danielvanza

Copy link
Copy Markdown
Contributor

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.
@kmcginnes

Copy link
Copy Markdown
Collaborator

Hi @danielvanza, thanks for the contribution, and welcome. Per-type font size fits the existing style cascade cleanly, and routing it through the app-default to user layers rather than special-casing it was the right instinct.

Fair warning that it's taking me longer than I'd like to get back to reviewing community PRs, so this may sit for a bit. I see you have a few open now, and I will work through them.

@kmcginnes kmcginnes mentioned this pull request Sep 22, 2026
3 of 4 tasks
@danielvanza

Copy link
Copy Markdown
Contributor Author

Hi @kmcginnes, following up on these contributions when you have review bandwidth. I have updated #1931 and #2239 against current main and cleared their merge conflicts; static checks and the complete local test suites pass (3,354 and 3,345 tests respectively, with the test suite’s expected en-US locale). #1930, #2200, and #2201 are also still mergeable and have no requested changes. GitHub CI checks have not appeared on these community PRs. Could you approve/start the workflows if approval is required, and review them when convenient? Happy to address any further feedback.

This branch has not been deployed

No deployments
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.

3 participants