Skip to content

Label-dependent node size instead of fixed placeholder dimensions #35

Description

@TobiasKlanert

Context

toElkGraph assigns fixed dimensions of
160×64 to all nodes (Service, Network, Volume). This is a deliberate placeholder from Phase 2 so that ELK can
layout the nodes at all—ELK needs width/height in advance, but does not know the eventual text size.

Problem

Actual node labels vary greatly in length (db vs.
payment-gateway-service). With a fixed width, long names are either
truncated, or the box is unnecessarily large for short names. As a result, the layout appears
less clean than it could be.

Context

Only once the actual font size, padding, and node design are determined can the size be
meaningfully derived from the label. Before that, any number would be a guess.

Possible Approach

  • After defining the node typography, determine the text width for each label
    (e.g., using Canvas measureText or measured character width) and use that to
    calculate width plus padding; height is determined by font size and
    padding.
  • Keep the dimension calculation as a separate, testable function that toElkGraph
    calls for each node—this preserves the mapper’s underlying structure.
  • Define a minimum and, if necessary, a maximum width so that very short names do not
    appear tiny and very long names do not overflow the graph.
  • Check whether network/volume nodes should have a different base size than service nodes
    (different types may be visually distinguished).

Acceptance Criteria

  • Node width adjusts based on the label text (no longer a hard limit of 160).
  • Short and long names are displayed without being truncated or having excessive white space.
  • The sizing logic is isolated as a pure function and unit-tested.

Dependency

Blocked by Phase 3 (node typography and design must be finalized first).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions