Conduit colors and legend - #22
Open
DaanVanVugt wants to merge 8 commits into
Open
DaanVanVugt wants to merge 8 commits into
DaanVanVugt wants to merge 8 commits into
Conversation
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.
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.
After #21