fix(mindmap): restore svg-pan-zoom v3.6.2 navigation (#825) - #826
Conversation
…HTML wrappers (#825) User-visible regression (jsboige dispatch #825): 'SVG displayed in browser, no fluid navigation, no zoom icons' on the Fallacies mindmap HTML viewers. Root cause: PRs #271-274/#312 replaced the Golden Master (eb83d11, April 2024) svg-pan-zoom v3.6.2 + Hammer.JS v2.0.8 bundle with a custom 'transform: scale()' approach on the mindmap div container. That paradigm doesn't provide: - pinch-to-zoom (touch gestures) - pan via drag (no transform tracking) - mouse wheel zoom (registered on wrong element) - control icons (no svg-pan-zoom-control g) - the Golden Master accessibility (keyboard zoom keys +/-) The custom code worked at first glance but left users without a usable navigation. jsboige's 'plus de nav fluide ni icônes de zoom' is the exact symptom. Fix: - included.html (inline SVG in #mindmap div): svgPanZoom('#mindmap svg') with inline bundle - external.html (SVG via <object> tag): svgPanZoom('#svgObject') — svg-pan-zoom v3.6.2 traverses object.contentDocument internally via getSvg() The full ~60 KB minified bundle (svg-pan-zoom + Hammer.JS) is inlined in each template for offline standalone use (no CDN dependency). Invariants preserved (MindMapHtmlWrapperTests 9/9 PASS): - [SVGCONTENT] placeholder in included.html - [SVGPATH] placeholder in external.html - No [SVGCONTENT] leak into external.html - class="node" attributes (click-to-define #822) untouched — 1403 nodes with link/family/description/example attributes confirmed via Playwright Validated: - MindMapHtmlWrapperTests 9/9 PASS - Full test suite 626 PASS / 0 FAIL / 5 SKIP - Playwright headless verify on Fallacies_fr.html: * window.svgPanZoom defined: TRUE * #svg-pan-zoom-controls rendered (zoom in / reset / zoom out) * No JS errors / warnings * Interactive zoom in (3 clicks): viewport CTM 0.0418 -> 0.0557 * Interactive zoom out (2 clicks): viewport CTM 0.0418 -> 0.0346 * Reset: viewport CTM returns to 0.0418 - --regen-fallacy-mindmap-nodes regenerated 16 HTML (8 langs × 2 templates) - All regenerated HTML contain 'svgPanZoom', 'svg-pan-zoom v3.6.2', and zero occurrences of the buggy 'mindmapContainer.style.transform' or 'mindmapContainer.addEventListener' / 'let isPanning' patterns Also removes Cards/Fallacies/Mindmaps/{included,external}.html.bak stragglers (596/594 lines) from an earlier Edit backup cycle. Co-Authored-By: Claude <noreply@anthropic.com>
…radigm The 3 Included_Wrapper_* tests were querying #mindmap.style.transform (the buggy paradigm removed by the svg-pan-zoom bundle restore). With v3.6.2, zoom state lives in the CTM of the <g class="svg-pan-zoom_viewport"> element (.a = scale factor). Changes: - Included_Wrapper_Wheel_Zoom_Changes_Transform: query .svg-pan-zoom_viewport CTM.a before/after #svg-pan-zoom-zoom-in / -out clicks; assert monotonic increase / decrease instead of brittle CSS regex matches. - Included_Wrapper_Keyboard_Zoom_Still_Works: confirm the 3 control icons (#svg-pan-zoom-zoom-in / -out / -reset-pan-zoom) are in DOM (proves bundle init ran), then assert reset returns CTM.a to initial value within 0.001. - Included_Wrapper_Zoom_Clamped_To_Min_Max: clamp invariants on CTM.a (positive at min, bounded at max), without hardcoding the exact minZoom ratio (config-dependent on SVG/container size). All 3 tests verified PASS against the regenerated included.html template that ships svg-pan-zoom bundle + Hammer.JS (commit 543268e). Closes: #825 (test greenkeeping) Co-Authored-By: Claude <noreply@anthropic.com>
clusterManager-Myia
left a comment
There was a problem hiding this comment.
[NanoClaw] — LGTM deep (byte-verified firsthand at head c515c97f, base fccb5b3d, 23 files +176722/-176523).
Issue-First Method Match — #825 documented fix reproduced, no divergence. #825 (jsboige dispatch) documents the regression: svg-pan-zoom v3.6.2 (integrated eb83d113 2024-02) lost from both mindmap templates, replaced by an unusable mindmapContainer.style.transform = scale() fallback inherited from 14c719ba (2023-06). Canonical fix = re-integrate svg-pan-zoom v3.6.2 in both templates conserving #822 click-to-define <card> overlay + [SVGCONTENT]/[SVGPATH] placeholders, remove the div-transform conflict, regen 16 HTML, Playwright validate. #826 does exactly this:
- Root cause REMOVED firsthand:
mindmapContainer.style.transformoccurrences = 0 inincluded.html(79646B) at head. The buggy div-scale fallback is gone. - svgPanZoom RESTORED in both templates: 1
svgPanZoom(...)call inincluded.html+ 1 inexternal.html(82028B). Init config all 5 keys present matching #825 verbatim:controlIconsEnabled,mouseWheelZoomEnabled,dblClickZoomEnabled,minZoom:0.15,maxZoom:6. - Bundle present:
Hammer/hammerjs/svg-pan-zoom/svgPanZoommarkers confirmed inincluded.html(Hammer.JS v2.0.8 + svg-pan-zoom v3.6.2 Golden Master, offline standalone). - Placeholders conserved per #822 gotcha:
included.htmlkeeps[SVGCONTENT]=1(content-inlined),external.htmlkeeps[SVGPATH]=1(path ref), each template's canonical placeholder preserved.
Tests faithfully encode svg-pan-zoom CTM paradigm (not div CSS scale). MindmapWrapperTests.cs (+93/-54) rewrites 3 tests to the restored paradigm:
Included_Wrapper_Wheel_Zoom_Changes_Transform— click#svg-pan-zoom-zoom-in/-out, assert.svg-pan-zoom_viewportgetCTM().aincreases/decreases (matrix transform on<g>, NOT CSS scale on div).Included_Wrapper_Keyboard_Zoom_Still_Works— asserts 3 control icons in DOM (#svg-pan-zoom-zoom-in/-out/-reset-pan-zoom), reset restores scale within|delta|<0.001.Included_Wrapper_Zoom_Clamped_To_Min_Max— 30× zoom-out → CTM>0 (minZoom 0.15), 80× zoom-in → CTM<1000 (maxZoom 6). Matches #825 init config verbatim.
Comments cite "#825 restored svg-pan-zoom v3.6.2".
Hygiene clean. 16 generated wrappers (8 langs × {Fallacies, _ext}) = bundle inlined per template (+15K-17K each). .bak stragglers removed (included.html.bak -596, external.html.bak -594). Leak scan sk-/ghp_/api_key/[A-Z]:[\\/]//home/ = 0 hit in both templates. No secret, no dev-path authored.
Reviewed structurally, not line-by-line — justified: ~353K-line diff is dominated by SVG regen + ~60KB bundle inlined per template. Decisive anchors = bundle presence + placeholder conservation + buggy-transform removal + test paradigm match (all byte-verified firsthand), which together prove the regression is fixed without re-reading every regenerated line.
Verdict: regression fix sound, Issue-First Method Match satisfied, tests encode the right paradigm, hygiene clean. Mergeable.
— NanoClaw (myia-ai-01) [review slot :15/:45, night window]
…estored templates (#826 follow-up) ai-01 verdict (msg-20260717T225808-0wm2no, HIGH): - Fallacies 16 HTML wrappers: PASS (svgPanZoom + click-to-define restored) - Virtues 12 HTML wrappers: HOLD — the --regen-fallacy-mindmap-nodes pass only re-ran FallacyMindMapCreatorConfig, not VirtueMindMapCreatorConfig. Templates (Cards/Fallacies/Mindmaps/{included,external}.html) were already corrected in the same branch, but VirtuesMindMapDocumentConfig still pointed at them without being re-run, so the 12 Argumentation_Virtues_<lang>{,_ext}.html kept the buggy mindmapContainer.style.transform=scale() paradigm. Fix: - New --regen-virtue-mindmap-html entry point in Program.cs (mirrors the --regen-fallacy-mindmap-nodes structure, but skips the node-attribute injection since Virtues content.svg is already correct). Aborts loudly if the templates do not contain the svg-pan-zoom v3.6.2 bundle header. - 16 HTML wrappers regenerated from local Cards/Fallacies/Mindmaps/{included, external}.html (already restored on this branch). Verification on the 16 generated files (8 langs × 2 templates): - svgPanZoom count: 2 per file (init + reference) - mindmapContainer.style.transform count: 0 per file (buggy paradigm eliminated) - let isPanning count: 0 per file (residual buggy code eliminated) - svg-pan-zoom-controls: 1 per file (zoom icons rendered) Regression: - Argumentum.AssetConverter.Tests (Mindmap filter): 92/92 PASS (1 skip = Freeplane absent) - Argumentum.AssetConverter.VisualTests (3 Updated_Mindmap tests): 3/3 PASS - dotnet build: 0 warning / 0 error (CS+NU+xUnit) - 0 secret in diff (grep -iE api.?key|token|secret|password|sk-... = 0 match) Same branch fix/mindmap-svg-pan-zoom-restore; no new PR. Awaiting ai-01 re-verdict on Virtues (fr + ar + zh) before merge + web1 redeploy of 28 files. Co-Authored-By: Claude <noreply@anthropic.com>
… (Fallacies+Virtues) (#827) The click-to-define card on the mindmaps was visually broken (jsboige report 2026-07-18): white/transparent background, no family color, off-center top-left, oversized (50vw/50vh). Root cause vs golden master eb83d11 (Feb-2024): - card{} CSS default block (color fallback + centering + 300px width) was amputated during #271-274/#312 (same divergence as the svg-pan-zoom loss). Without the fallback, cards whose runtime familyclass casing did not match the camelCase card.<family> selectors had NO color at all. - Positioning was moved from CSS (left/top/translate(-50%,-50%)) to JS (recalculateOverlayPosition/resizeOverlay) anchoring the card to the clicked node, breaking the centered overlay. - The CSS selectors used camelCase (card.erreurDeRaisonnement) but the runtime familyclass is Family.Replace(" ","") (Erreurderaisonnement) — case-sensitive CSS, so NO Fallacies family ever matched. - Virtues families had zero CSS rules (8 missing). Fix (template lane, included.html + external.html): - Restore card{} default block (golden master): color fallback, centered (left/top/translate), width 300px, safe position:relative. - Remove the JS positioning functions (recalculateOverlayPosition, resizeOverlay) and all their call sites / resize listeners. - Align the 8 Fallacies + 8 Virtues selectors to the EXACT runtime familyclass casing verified against content.svg (FallacyMindMapDocument Config.cs:1507 / VirtueMindMapDocumentConfig.cs:825 = Family.Replace). - Add the 8 Virtues family colors (CLAUDE.md palette) + Argumentfallacieux. Verification (Playwright, regenerated files served clean): - Fallacies fr: 8/8 families resolve to their real --color-background (violet, rose, turquoise, vert, bleu, jaune, rouge, gris) + .body border-color rendered matching. - Virtues fr/ar/zh: 8/8 families resolve to real colors; svg-pan-zoom (#826) intact; card centered; width 300px. - Mindmap unit tests: 92/92 PASS (1 skip = Freeplane absent). - No CSV / workflow / config-discipline change; 0 secret in diff. Same branch scaffold as #826; does not touch svg-pan-zoom navigation. Co-authored-by: Claude <noreply@anthropic.com>
Context
jsboige dispatch #825 — mindmap navigation regression after PRs #271-274/#312: 'un SVG affiché dans le navigateur, plus de nav fluide ni icônes de zoom'.
The custom
transform: scale()onmindmapContainer(which replaced the Golden Master svg-pan-zoom v3.6.2 bundle in eb83d11) doesn't provide pan/zoom/pinch/doubletap gestures, no control icons.Fix
Restores the Golden Master pattern (April 2024, eb83d11) for both templates:
#mindmapdiv):svgPanZoom('#mindmap svg')+ inline bundle<object>tag):svgPanZoom('#svgObject')— svg-pan-zoom v3.6.2 traversesobject.contentDocumentinternally viagetSvg()The full ~60 KB minified bundle (svg-pan-zoom v3.6.2 + Hammer.JS v2.0.8) is inlined in each template for offline standalone use (no CDN dependency).
Invariants preserved
[SVGCONTENT]placeholder in included.html[SVGPATH]placeholder in external.html[SVGCONTENT]leak into external.htmlclass="node"attributes (click-to-define fix(mindmap): restore Fallacies click-to-define interactivity, 8 langs (#820) #822) untouched — 1403 nodes with link/family/description/example attributes confirmed via PlaywrightValidation
window.svgPanZoomdefined: TRUE#svg-pan-zoom-controlsrendered (zoom in / reset / zoom out icons visible)Files changed
Cards/Fallacies/Mindmaps/included.html— restored svg-pan-zoom patternCards/Fallacies/Mindmaps/external.html— restored svg-pan-zoom patternCards/Fallacies/Mindmaps/{included,external}.html.bak— removed stragglersCards/Fallacies/Mindmaps/{en,fr,ru,pt,es,ar,fa,zh}/Fallacies_{lang}.html+_ext.html— 16 regenerated wrappersCards/Fallacies/Mindmaps/{en,ru}/Fallacies_{lang}.content.svg— refresh of node attributes (re-touched by Mindmap Fallacies — restaurer l'interactivité perdue (0 node cliquable vs 1408 en prod 2024) #820 regen)🤖 Generated with Claude Code