feat: add tooltips to prepared scenarios

Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
Matej Focko 2022-05-17 14:39:09 +02:00
parent 9da7013eb0
commit f779c349c3
Signed by: mfocko
GPG key ID: 7C47D46246790496
2 changed files with 18 additions and 2 deletions

View file

@ -102,12 +102,15 @@
<div <div
class="btn-group-vertical" class="btn-group-vertical"
role="group" role="group"
aria-label="Basic outlined example" aria-label="Prepared scenarios"
> >
<button <button
type="button" type="button"
class="btn btn-outline-primary" class="btn btn-outline-primary"
onclick="prepareSingleRotationAfterDelete()" onclick="prepareSingleRotationAfterDelete()"
data-bs-toggle="tooltip"
data-bs-placement="right"
title="This scenario shows a single rotation being performed after a deletion of key 2 from the prepared tree."
> >
Single rotation after delete Single rotation after delete
</button> </button>
@ -115,6 +118,9 @@
type="button" type="button"
class="btn btn-outline-primary" class="btn btn-outline-primary"
onclick="prepareDoubleRotationAfterDelete()" onclick="prepareDoubleRotationAfterDelete()"
data-bs-toggle="tooltip"
data-bs-placement="right"
title="This scenario shows a double rotation being performed after a deletion of key 1 from the prepared tree."
> >
Double rotation after delete Double rotation after delete
</button> </button>
@ -122,6 +128,9 @@
type="button" type="button"
class="btn btn-outline-primary" class="btn btn-outline-primary"
onclick="prepareDemotionOfBothNodesDuringDelete()" onclick="prepareDemotionOfBothNodesDuringDelete()"
data-bs-toggle="tooltip"
data-bs-placement="right"
title="This scenario shows a demotion of both parent and sibling of the current node after a deletion of key 2 from the prepared tree."
> >
Demotion of both parent and sibling during deletion Demotion of both parent and sibling during deletion
</button> </button>
@ -144,11 +153,11 @@
<script src="ravl.js"></script> <script src="ravl.js"></script>
<script src="recorder.js"></script> <script src="recorder.js"></script>
<script src="visualization.js"></script>
<script <script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/js/bootstrap.bundle.min.js" src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2" integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2"
crossorigin="anonymous" crossorigin="anonymous"
></script> ></script>
<script src="visualization.js"></script>
</body> </body>

View file

@ -91,6 +91,13 @@ function prepareDemotionOfBothNodesDuringDelete() {
} }
// #endregion prepared scenarios // #endregion prepared scenarios
const tooltipTriggerList = document.querySelectorAll(
'[data-bs-toggle="tooltip"]'
);
const tooltipList = [...tooltipTriggerList].map(
(tooltipTriggerEl) => new bootstrap.Tooltip(tooltipTriggerEl)
);
function render() { function render() {
recorder.render(); recorder.render();
setTimeout(render); setTimeout(render);