From 0be5bdc05b49ce28a690645e0afb84dcb373350c Mon Sep 17 00:00:00 2001 From: Mathias Vanden Auweele Date: Wed, 18 Nov 2026 11:00:47 +0000 Subject: [PATCH] Apply the Inherited toggle to expanded boxes in the diagram The Inherited toggle only listed inherited attributes and child elements in the focused type's box. Expanded boxes, which also list their rows, kept showing only their own declarations, so an inherited attribute such as @id from a base type was invisible there. The toggle now applies to the focused box and every expanded box, both for the rows in the box and for the inherited child elements and enumerations drawn around it. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01ECW7omsQVpMFUZecXai17r --- web/src/graph.ts | 5 +++-- web/src/views/diagramPanel.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/web/src/graph.ts b/web/src/graph.ts index 293fe3a..7ce6222 100644 --- a/web/src/graph.ts +++ b/web/src/graph.ts @@ -176,7 +176,7 @@ export function buildNeighborhood(m: Model, o: NeighborhoodOptions): GraphSpec { return true; }; const addType = (id: Id, focus = false) => - take(`c${id}`, () => typeNode(m, id, { focus, attrs: focus || o.expanded.has(id), inherited: focus && o.inherited, open: o.openAttrs.has(id), cap: focus ? o.maxAttrs * 2 : o.maxAttrs }), focus); + take(`c${id}`, () => typeNode(m, id, { focus, attrs: focus || o.expanded.has(id), inherited: o.inherited && (focus || o.expanded.has(id)), open: o.openAttrs.has(id), cap: focus ? o.maxAttrs * 2 : o.maxAttrs }), focus); const edge = (e: EdgeSpec) => { if (!edges.has(e.key)) edges.set(e.key, e); }; @@ -185,7 +185,8 @@ export function buildNeighborhood(m: Model, o: NeighborhoodOptions): GraphSpec { const c = m.comp(tid); const ct = c.complexType; if (!ct) return; - const inh = isFocus && o.inherited; + // Inherited rows follow the toggle for every box that lists its rows: the focus and expanded boxes. + const inh = o.inherited && (isFocus || o.expanded.has(tid)); // Base type. const base = ct.derivation?.base; if (m.isComplex(base) && addType(base)) edge({ key: `g${base}-${tid}`, from: `c${base}`, to: `c${tid}`, kind: ct.derivation!.method === "restriction" ? "restr" : "gen", label: ct.derivation!.method === "restriction" ? "«restriction»" : undefined }); diff --git a/web/src/views/diagramPanel.ts b/web/src/views/diagramPanel.ts index fe6ccf0..92d262a 100644 --- a/web/src/views/diagramPanel.ts +++ b/web/src/views/diagramPanel.ts @@ -161,7 +161,7 @@ export function diagramPanel(ctx: AppCtx, focus: Id, opts: { tall?: boolean } = depthBtn, toggle("Inherited", () => o.inherited, (v) => { o.inherited = v; - }, "List inherited attributes and child elements in this type's box"), + }, "List inherited attributes and child elements in the boxes of this type and of expanded types"), toggle("Used by", () => o.incoming, (v) => { o.incoming = v; ctx.setPrefs({ incoming: v });