Add Pathfinder module to intro
This commit is contained in:
+53
@@ -10,6 +10,10 @@
|
||||
<link rel="stylesheet" href="dist/reset.css">
|
||||
<link rel="stylesheet" href="dist/reveal.css">
|
||||
<link rel="stylesheet" href="dist/theme/night.css">
|
||||
|
||||
<link rel="stylesheet" href="module/pathfinder/typo.css">
|
||||
<link rel="stylesheet" href="module/pathfinder/main.css">
|
||||
<link rel="stylesheet" href="module/pathfinder/grid.css">
|
||||
|
||||
<!-- Theme used for syntax highlighted code -->
|
||||
<link rel="stylesheet" href="plugin/highlight/monokai.css">
|
||||
@@ -34,6 +38,24 @@
|
||||
color: #222;
|
||||
text-shadow: 0px 0px 5px green, 0px 0px 2px white, 2px 2px 1px white;
|
||||
}
|
||||
.reveal .hidden {
|
||||
display: none
|
||||
}
|
||||
.reveal .pathfinder-rerun {
|
||||
z-index: 1000;
|
||||
position: fixed;
|
||||
bottom: 10px;
|
||||
left: 11px;
|
||||
background-color: rgba(200, 200, 200, 0.3);
|
||||
border-radius: 10px;
|
||||
padding: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.reveal .pathfinder-rerun.disabled {
|
||||
background-color: rgba(139, 106, 106, 0.3);
|
||||
color: rgba(39, 27, 27, 0.3);
|
||||
cursor: not-allowed;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
@@ -108,6 +130,37 @@
|
||||
plugins: [RevealMarkdown, RevealHighlight, RevealNotes]
|
||||
});
|
||||
</script>
|
||||
<script src="module/pathfinder/main.js" async></script>
|
||||
<script src="module/pathfinder/select.js" async></script>
|
||||
<script>
|
||||
const pathfinders = {}
|
||||
Reveal.on( 'slidetransitionend', event => {
|
||||
const slide = event.currentSlide
|
||||
const slideId = event.indexh + ';' + event.indexv
|
||||
if (slide && slide.classList.contains("pathfinder-page") && !(slideId in pathfinders)) {
|
||||
pathfinders[slideId] = startPathfinder(slide)
|
||||
}
|
||||
});
|
||||
async function startPathfinder(slide) {
|
||||
const p = spawnPathfinder(slide)
|
||||
const rerun = slide.getElementsByClassName("pathfinder-rerun")[0]
|
||||
if (rerun) {
|
||||
rerun.onclick = async () => {
|
||||
if (!rerun.classList.contains("disabled")) {
|
||||
rerun.classList.add("disabled");
|
||||
await p.RunMaze()
|
||||
await p.Run();
|
||||
rerun.classList.remove("disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
await p.RunMaze()
|
||||
Reveal.layout()
|
||||
rerun.classList.add("disabled");
|
||||
await p.Run()
|
||||
rerun.classList.remove("disabled");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user