Skip to content

Conduit colors and legend - #22

Open
DaanVanVugt wants to merge 8 commits into
multiscale:mainfrom
DaanVanVugt:feat/conduit-colors
Open

DaanVanVugt wants to merge 8 commits into
multiscale:mainfrom
DaanVanVugt:feat/conduit-colors

Conversation

@DaanVanVugt

@DaanVanVugt DaanVanVugt commented Jun 22, 2026 •

Copy link
Copy Markdown

After #21

image

Conduits now respond to hover: each path carries an SVG <title> with
"sender.port -> receiver.port" (component ports already had titles), and a
.conduit:hover rule restyles the hovered path (blue, thicker) so it stands
out. ConduitRoute keeps a reference to its Conduit to build the label.
- .component:hover restyles the hovered component box (matching the conduit
  hover), so components read as interactive.
- Port hover titles now use the full reference (component.port) instead of the
  bare port name, distinct from a conduit's "a.x -> b.y" label.
- Components with more than one instance (multiplicity / vector port) show
  their size in the box label, e.g. "worker[5]" (no space before the bracket,
  matching libmuscle's name[index] instance naming); the box is sized to fit.
- Port hover titles show just the port name again, not the full
  component.port reference.
- Remove the "Model: <name>" title from the model background so hovering the
  model area shows no annotation.
When check_timelines is False the timeline consistency check is skipped, so
models whose timelines don't validate (e.g. time-scale bridges / accumulators)
can still be drawn approximately instead of raising ConduitTimelineError. The
timeline tree is built regardless; only the verification is skipped.
Each conduit is now a group of a thin visible line plus a wide transparent
"hit" path (stroke-width 10, pointer-events: stroke) that carries the title.
Hovering anywhere near the conduit highlights the line and shows the label,
instead of needing to land on the 2px line exactly.

With the wide hit target and the .conduit-group:hover rule in place, the
direct .conduit:hover rule is redundant and is removed. The hover highlight
(stroke colour + width), shared by components and conduits, is now defined
once via the --highlight-stroke / --highlight-width CSS custom properties.
:root matches the document root element, which is outside the shadow
tree when the SVG is inlined inside a Panel/Bokeh ReactiveHTML
component. The custom properties were then undefined and the hover
stroke fell back to none (the box appeared to lose its border / turn
white). Defining them on the svg element keeps them inside the tree so
they inherit to every element and resolve in any embedding context.
Adds a draw_port_icons setting (default True) and a CLI flag
--port-icons/--no-port-icons. When disabled, disable_port_icons()
also collapses the spacing the icons reserved: port_size 7->0 and
port_margin 10->conduit_margin (4), so conduits attach directly to
component edges. The reusable port symbols are dropped from <defs>
when icons are off.
Each conduit is stroked by its port basename (pf_active_out, pf_active_scatter,
… all fold to pf_active), using matplotlib's tab20 qualitative palette (tab10
saturated colours first, then their lighter companions; generated HSL hues
beyond 20). A multi-column legend below the model maps each basename to its
colour. Colouring is toggleable via the --color-conduits/--no-color-conduits
flag (settings.color_conduits); when off, conduits are black and no legend is
drawn. Also moves the transparent hover hit-target on top of the line so the
tooltip and highlight trigger when hovering the line itself.
@DaanVanVugt DaanVanVugt changed the title Feat/conduit colors Conduit colors and legend Jun 24, 2026
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.

1 participant