mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 12:01:23 +01:00
Merge branch 'master' into 3d-view-upgrade
This commit is contained in:
commit
3804c6522c
13 changed files with 274 additions and 43 deletions
|
|
@ -214,7 +214,6 @@ function editDiplomacy() {
|
|||
function selectRelation(subjectId, objectId, currentRelation) {
|
||||
const states = pack.states;
|
||||
const subject = states[subjectId];
|
||||
const object = states[objectId];
|
||||
|
||||
const relationsSelector = Object.entries(relations)
|
||||
.map(
|
||||
|
|
|
|||
|
|
@ -1176,7 +1176,7 @@ function refreshAllEditors() {
|
|||
// dynamically loaded editors
|
||||
async function editStates() {
|
||||
if (customization) return;
|
||||
const Editor = await import("../dynamic/editors/states-editor.js?v=1.89.05");
|
||||
const Editor = await import("../dynamic/editors/states-editor.js?v=1.89.35");
|
||||
Editor.open();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ function overviewMarkers() {
|
|||
const markersGenerationConfig = document.getElementById("markersGenerationConfig");
|
||||
const markersRemoveAll = document.getElementById("markersRemoveAll");
|
||||
const markersExport = document.getElementById("markersExport");
|
||||
const markerTypeInput = document.getElementById("addedMarkerType");
|
||||
const markerTypeSelector = document.getElementById("markerTypeSelector");
|
||||
|
||||
addLines();
|
||||
|
||||
|
|
@ -33,9 +35,26 @@ function overviewMarkers() {
|
|||
listen(markersAddFromOverview, "click", toggleAddMarker),
|
||||
listen(markersGenerationConfig, "click", configMarkersGeneration),
|
||||
listen(markersRemoveAll, "click", triggerRemoveAll),
|
||||
listen(markersExport, "click", exportMarkers)
|
||||
listen(markersExport, "click", exportMarkers),
|
||||
listen(markerTypeSelector, "click", toggleMarkerTypeMenu)
|
||||
];
|
||||
|
||||
const types = [{type: "empty", icon: "❓"}, ...Markers.getConfig()];
|
||||
types.forEach(({icon, type}) => {
|
||||
const option = document.createElement("button");
|
||||
option.textContent = `${icon} ${type}`;
|
||||
markerTypeSelectMenu.appendChild(option);
|
||||
|
||||
listeners.push(
|
||||
listen(option, "click", () => {
|
||||
markerTypeSelector.textContent = icon;
|
||||
markerTypeInput.value = type;
|
||||
changeMarkerType();
|
||||
toggleMarkerTypeMenu();
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
function handleLineClick(ev) {
|
||||
const el = ev.target;
|
||||
const i = +el.parentNode.dataset.i;
|
||||
|
|
@ -139,11 +158,21 @@ function overviewMarkers() {
|
|||
});
|
||||
}
|
||||
|
||||
function toggleMarkerTypeMenu() {
|
||||
document.getElementById("markerTypeSelectMenu").classList.toggle("visible");
|
||||
}
|
||||
|
||||
function toggleAddMarker() {
|
||||
markersAddFromOverview.classList.toggle("pressed");
|
||||
addMarker.click();
|
||||
}
|
||||
|
||||
function changeMarkerType() {
|
||||
if (!markersAddFromOverview.classList.contains("pressed")) {
|
||||
toggleAddMarker();
|
||||
}
|
||||
}
|
||||
|
||||
function removeMarker(i) {
|
||||
notes = notes.filter(note => note.id !== `marker${i}`);
|
||||
pack.markers = pack.markers.filter(marker => marker.i !== i);
|
||||
|
|
|
|||
|
|
@ -828,9 +828,17 @@ function addMarkerOnClick() {
|
|||
// Find the currently selected marker to use as a base
|
||||
const isMarkerSelected = markers.length && elSelected?.node()?.parentElement?.id === "markers";
|
||||
const selectedMarker = isMarkerSelected ? markers.find(marker => marker.i === +elSelected.attr("id").slice(6)) : null;
|
||||
const baseMarker = selectedMarker || {icon: "❓"};
|
||||
|
||||
const selectedType = document.getElementById("addedMarkerType").value;
|
||||
const selectedConfig = Markers.getConfig().find(({type}) => type === selectedType);
|
||||
|
||||
const baseMarker = selectedMarker || selectedConfig || {icon: "❓"};
|
||||
const marker = Markers.add({...baseMarker, x, y, cell});
|
||||
|
||||
if (selectedConfig && selectedConfig.add) {
|
||||
selectedConfig.add("marker"+marker.i, cell);
|
||||
}
|
||||
|
||||
const markersElement = document.getElementById("markers");
|
||||
const rescale = +markersElement.getAttribute("rescale");
|
||||
markersElement.insertAdjacentHTML("beforeend", drawMarker(marker, rescale));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue