Technosorcery / sd2snes-lttp-rando-tracker

Legend of Zelda: A Link to the Past randomizer tracker that works via SD2SNES serial connection
MIT License
11 stars 4 forks source link

Show location tool tips on hover #425

Closed jhelwig closed 4 years ago

jhelwig commented 4 years ago

https://lttp-tracker.firebaseapp.com/ shows the location name, and a handy reminder about what item is required to access the location when you hover the mouse over it. We should do that, too.

jhelwig commented 4 years ago

The firebase version does this as part of the highlight/unhighlight for locations & dungeons.

https://github.com/stochaztic/lttp-tracker/blob/67050baca17d2bdec78ac278eaa2cb1ad3025aeb/public/script/main.js#L166-L186

// Highlights a chest location and shows the name as caption
function highlight(x){
    document.getElementById(x).style.backgroundImage = "url(/images/highlighted.png)";
    document.getElementById("caption").innerHTML = chests[x].name;
}

function unhighlight(x){
    document.getElementById(x).style.backgroundImage = "url(/images/poi.png)";
    document.getElementById("caption").innerHTML = " ";
}

// Highlights a chest location and shows the name as caption (but for dungeons)
function highlightDungeon(x){
    document.getElementById("dungeon"+x).style.backgroundImage = "url(/images/highlighted.png)";
    document.getElementById("caption").innerHTML = dungeons[x].name;
}

function unhighlightDungeon(x){
    document.getElementById("dungeon"+x).style.backgroundImage = "url(/images/poi.png)";
    document.getElementById("caption").innerHTML = " ";
}

This doesn't really seem like a Vue-like way of doing it, though. The highlighting/unhighlighting feels like it should be applying/removing a class, instead of editing properties directly. Also, setting the caption seems like it should be modifying some data that a caption component could be looking at.

jhelwig commented 4 years ago

We'll want to pull in the names from lttp-tracker's script/chests.js into logic/poi_locations.yaml as the hoverText.

Eg:

    name: "King's Tomb <img src='/images/boots.png' class='mini'> + <img src='/images/glove2.png' class='mini'>/<img src='/images/mirror.png' class='mini'>",

https://github.com/Technosorcery/sd2snes-lttp-rando-tracker/blob/4373b9b571b2df8e3d37b2006cbb48b69d7fdf07/logic/poi_locations.yaml#L2-L3

jhelwig commented 4 years ago

432 got most of this. Still need to update all the hoverText in the YAML files at some point.

jtappa commented 4 years ago

is this "done" now? should we close the issue?

jhelwig commented 4 years ago

Yup! It's done.