refactor(markers): cleanup

This commit is contained in:
Azgaar 2023-08-05 13:38:30 +04:00
parent e542574324
commit c398bc64d6
5 changed files with 18 additions and 16 deletions

View file

@ -2368,6 +2368,7 @@ svg.button {
#markerTypeSelectMenu {
display: none;
}
#markerTypeSelectMenu.visible {
display: block;
position: absolute;
@ -2379,12 +2380,14 @@ svg.button {
left: 0;
background: white;
}
#markerTypeSelectMenu > button {
display: block;
width: 100%;
border: 1px solid #ddd;
margin-bottom: 1px;
}
#markerTypeSelectMenu > button:hover {
background: #ccc;
}

View file

@ -18,7 +18,6 @@ const openDatabase = () => {
request.onerror = event => {
console.error("indexedDB request error");
console.log(event);
reject();
};

View file

@ -165,7 +165,7 @@ async function initiateAutosave() {
const mapData = getMapData();
const blob = new Blob([mapData], {type: "text/plain"});
await ldb.set("lastMap", blob);
console.log("Autosaved at", new Date().toLocaleTimeString());
INFO && console.log("Autosaved at", new Date().toLocaleTimeString());
lastSavedAt = Date.now();
}

View file

@ -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();

View file

@ -36,7 +36,6 @@ const version = "1.89.38"; // generator version, update each time
<li>Data Charts screen</li>
<li>Сultures and religions can have multiple parents in hierarchy tree</li>
<li>Heightmap selection screen</li>
<li>Randomly generated marker type selection and placement</li>
</ul>
<p>Join our <a href="${discord}" target="_blank">Discord server</a> and <a href="${reddit}" target="_blank">Reddit community</a> to ask questions, share maps, discuss the Generator and Worlbuilding, report bugs and propose new features.</p>