From f60db09f8d68f7d45abc07a94d8ce65ee51d8026 Mon Sep 17 00:00:00 2001 From: Mark Crossfield Date: Wed, 2 Nov 2022 20:25:47 +0000 Subject: [PATCH] Rerender diagram after overview navigation This resolves an issue where the diagram is rendered as the user navigates in the overview, then selects a slide, and finds the text is not visible. The diagram was being rendered while the slide was tiny in the overview, and this meant the sizes were screwed up. By destroying and showing the diagram again when the overview is hidden (hence the slide is the proper size), the diagram renders properly. --- assets/js/mermaid/reveal-js-mermaid-plugin.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/assets/js/mermaid/reveal-js-mermaid-plugin.js b/assets/js/mermaid/reveal-js-mermaid-plugin.js index 34c6c99..5d8c20f 100644 --- a/assets/js/mermaid/reveal-js-mermaid-plugin.js +++ b/assets/js/mermaid/reveal-js-mermaid-plugin.js @@ -90,4 +90,10 @@ } }); + Reveal.addEventListener('overviewhidden', function (event) { + if (event.currentSlide) { + destroyDiagram(event.currentSlide); + showDiagram(event.currentSlide); + } + }); }());