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

View file

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

View file

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

View file

@ -36,21 +36,23 @@ function overviewMarkers() {
listen(markersGenerationConfig, "click", configMarkersGeneration), listen(markersGenerationConfig, "click", configMarkersGeneration),
listen(markersRemoveAll, "click", triggerRemoveAll), listen(markersRemoveAll, "click", triggerRemoveAll),
listen(markersExport, "click", exportMarkers), listen(markersExport, "click", exportMarkers),
listen(markerTypeSelector, "click", toggleMarkerTypeMenu), listen(markerTypeSelector, "click", toggleMarkerTypeMenu)
//listen(markerTypeInput, "change", changeMarkerType),
]; ];
[{type: "empty", icon: "❓"}, ...Markers.getConfig()].forEach(markerConfig => { const types = [{type: "empty", icon: "❓"}, ...Markers.getConfig()];
types.forEach(({icon, type}) => {
const option = document.createElement("button"); const option = document.createElement("button");
option.textContent = `${markerConfig.icon} ${markerConfig.type}`; option.textContent = `${icon} ${type}`;
markerTypeSelectMenu.appendChild(option); markerTypeSelectMenu.appendChild(option);
console.log(option.textContent);
listeners.push(listen(option, "click", () => { listeners.push(
markerTypeSelector.textContent = markerConfig.icon; listen(option, "click", () => {
markerTypeInput.value = markerConfig.type; markerTypeSelector.textContent = icon;
changeMarkerType(); markerTypeInput.value = type;
toggleMarkerTypeMenu(); changeMarkerType();
})); toggleMarkerTypeMenu();
})
);
}); });
function handleLineClick(ev) { function handleLineClick(ev) {
@ -156,11 +158,10 @@ function overviewMarkers() {
}); });
} }
function toggleMarkerTypeMenu() { function toggleMarkerTypeMenu() {
document.getElementById("markerTypeSelectMenu").classList.toggle("visible"); document.getElementById("markerTypeSelectMenu").classList.toggle("visible");
} }
function toggleAddMarker() { function toggleAddMarker() {
markersAddFromOverview.classList.toggle("pressed"); markersAddFromOverview.classList.toggle("pressed");
addMarker.click(); addMarker.click();

View file

@ -36,7 +36,6 @@ const version = "1.89.38"; // generator version, update each time
<li>Data Charts screen</li> <li>Data Charts screen</li>
<li>Сultures and religions can have multiple parents in hierarchy tree</li> <li>Сultures and religions can have multiple parents in hierarchy tree</li>
<li>Heightmap selection screen</li> <li>Heightmap selection screen</li>
<li>Randomly generated marker type selection and placement</li>
</ul> </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> <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>