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 });