mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
refactor(markers): cleanup
This commit is contained in:
parent
e542574324
commit
c398bc64d6
5 changed files with 18 additions and 16 deletions
|
|
@ -36,21 +36,23 @@ function overviewMarkers() {
|
|||
listen(markersGenerationConfig, "click", configMarkersGeneration),
|
||||
listen(markersRemoveAll, "click", triggerRemoveAll),
|
||||
listen(markersExport, "click", exportMarkers),
|
||||
listen(markerTypeSelector, "click", toggleMarkerTypeMenu),
|
||||
//listen(markerTypeInput, "change", changeMarkerType),
|
||||
listen(markerTypeSelector, "click", toggleMarkerTypeMenu)
|
||||
];
|
||||
|
||||
[{type: "empty", icon: "❓"}, ...Markers.getConfig()].forEach(markerConfig => {
|
||||
const types = [{type: "empty", icon: "❓"}, ...Markers.getConfig()];
|
||||
types.forEach(({icon, type}) => {
|
||||
const option = document.createElement("button");
|
||||
option.textContent = `${markerConfig.icon} ${markerConfig.type}`;
|
||||
option.textContent = `${icon} ${type}`;
|
||||
markerTypeSelectMenu.appendChild(option);
|
||||
console.log(option.textContent);
|
||||
listeners.push(listen(option, "click", () => {
|
||||
markerTypeSelector.textContent = markerConfig.icon;
|
||||
markerTypeInput.value = markerConfig.type;
|
||||
changeMarkerType();
|
||||
toggleMarkerTypeMenu();
|
||||
}));
|
||||
|
||||
listeners.push(
|
||||
listen(option, "click", () => {
|
||||
markerTypeSelector.textContent = icon;
|
||||
markerTypeInput.value = type;
|
||||
changeMarkerType();
|
||||
toggleMarkerTypeMenu();
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
function handleLineClick(ev) {
|
||||
|
|
@ -156,11 +158,10 @@ function overviewMarkers() {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
function toggleMarkerTypeMenu() {
|
||||
document.getElementById("markerTypeSelectMenu").classList.toggle("visible");
|
||||
}
|
||||
|
||||
|
||||
function toggleAddMarker() {
|
||||
markersAddFromOverview.classList.toggle("pressed");
|
||||
addMarker.click();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue