Run "Fit window size" on node click? #182
scott-beaudry
started this conversation in
General
Replies: 1 comment
-
there is option window.markmap.Markmap.create('#markmap', {"autoFit": true}, root); Full stand-alone demo (with Click to open<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Solar System</title>
<script src="https://cdn.jsdelivr.net/npm/d3@7"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="https://cdn.jsdelivr.net/npm/markmap-view"></script>
</head>
<body>
<svg id="markmap" style="width: 100%; height: 800px;"></svg>
<script>
document.addEventListener('DOMContentLoaded', function() {
const markdownContent = `
# Solar System
- **Sun**
- **Planets**
- **Mercury**
- **Venus**
- **Earth**
- Moon
- **Mars**
- Phobos
- Deimos
- **Jupiter**
- Io
- Europa
- Ganymede
- Callisto
- **Saturn**
- Mimas
- Enceladus
- Tethys
- Dione
- Rhea
- Titan
- Hyperion
- Iapetus
- Phoebe
- **Uranus**
- Miranda
- Ariel
- Umbriel
- Titania
- Oberon
- **Neptune**
- Triton
- Proteus
- Nereid
- Larissa
- Galatea
- Despina
- Thalassa
- Naiad`;
const transformer = new window.markmap.Transformer();
const { root } = transformer.transform(markdownContent);
window.markmap.Markmap.create('#markmap', {"initialExpandLevel":1, "autoFit": true}, root);
});
</script>
</body>
</html> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is it possible to have the mindmap execute the "Fit window size" function every time a node is clicked? This would prevent child nodes displaying off screen necessitating navigating with the mouse to move them into view.
Beta Was this translation helpful? Give feedback.
All reactions