mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
v1.4.33
This commit is contained in:
parent
7fa056fe98
commit
361b66a186
4 changed files with 15 additions and 3 deletions
|
|
@ -3212,11 +3212,12 @@
|
||||||
<input id="notesName" data-tip="Type to change object name" autocorrect="off" spellcheck="false" style="width: 17em">
|
<input id="notesName" data-tip="Type to change object name" autocorrect="off" spellcheck="false" style="width: 17em">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span>Legend:</span><br>
|
<span>Note:</span><br>
|
||||||
<textarea id="notesText" rows="7" data-tip="Type object description" placeholder="Type object description"></textarea>
|
<textarea id="notesText" rows="7" data-tip="Type object description" placeholder="Type object description"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button id="notesFocus" data-tip="Focus on selected object" class="icon-target"></button>
|
<button id="notesFocus" data-tip="Focus on selected object" class="icon-target"></button>
|
||||||
|
<button id="notesPin" data-tip="Toggle notes box dispay: hide or do not hide the box on mouse move" class="icon-pin"></button>
|
||||||
<button id="notesDownload" data-tip="Download notes to PC" class="icon-download"></button>
|
<button id="notesDownload" data-tip="Download notes to PC" class="icon-download"></button>
|
||||||
<button id="notesUpload" data-tip="Upload notes from PC" class="icon-upload"></button>
|
<button id="notesUpload" data-tip="Upload notes from PC" class="icon-upload"></button>
|
||||||
<button id="notesRemove" data-tip="Remove this note" class="icon-trash fastDelete"></button>
|
<button id="notesRemove" data-tip="Remove this note" class="icon-trash fastDelete"></button>
|
||||||
|
|
|
||||||
2
main.js
2
main.js
|
|
@ -117,7 +117,7 @@ let scale = 1, viewX = 0, viewY = 0;
|
||||||
const zoom = d3.zoom().scaleExtent([1, 20]).on("zoom", zoomed);
|
const zoom = d3.zoom().scaleExtent([1, 20]).on("zoom", zoomed);
|
||||||
|
|
||||||
// default options
|
// default options
|
||||||
let options = {}; // options object
|
let options = {pinNotes:false}; // options object
|
||||||
let mapCoordinates = {}; // map coordinates on globe
|
let mapCoordinates = {}; // map coordinates on globe
|
||||||
options.winds = [225, 45, 225, 315, 135, 315]; // default wind directions
|
options.winds = [225, 45, 225, 315, 135, 315]; // default wind directions
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ function moved() {
|
||||||
|
|
||||||
// show note box on hover (if any)
|
// show note box on hover (if any)
|
||||||
function showNotes(e, i) {
|
function showNotes(e, i) {
|
||||||
|
if (notesEditor.offsetParent) return;
|
||||||
let id = e.target.id || e.target.parentNode.id || e.target.parentNode.parentNode.id;
|
let id = e.target.id || e.target.parentNode.id || e.target.parentNode.parentNode.id;
|
||||||
if (e.target.parentNode.parentNode.id === "burgLabels") id = "burg" + e.target.dataset.id; else
|
if (e.target.parentNode.parentNode.id === "burgLabels") id = "burg" + e.target.dataset.id; else
|
||||||
if (e.target.parentNode.parentNode.id === "burgIcons") id = "burg" + e.target.dataset.id;
|
if (e.target.parentNode.parentNode.id === "burgIcons") id = "burg" + e.target.dataset.id;
|
||||||
|
|
@ -70,7 +71,7 @@ function showNotes(e, i) {
|
||||||
document.getElementById("notes").style.display = "block";
|
document.getElementById("notes").style.display = "block";
|
||||||
document.getElementById("notesHeader").innerHTML = note.name;
|
document.getElementById("notesHeader").innerHTML = note.name;
|
||||||
document.getElementById("notesBody").innerHTML = note.legend;
|
document.getElementById("notesBody").innerHTML = note.legend;
|
||||||
} else {
|
} else if (!options.pinNotes) {
|
||||||
document.getElementById("notes").style.display = "none";
|
document.getElementById("notes").style.display = "none";
|
||||||
document.getElementById("notesHeader").innerHTML = "";
|
document.getElementById("notesHeader").innerHTML = "";
|
||||||
document.getElementById("notesBody").innerHTML = "";
|
document.getElementById("notesBody").innerHTML = "";
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ function editNotes(id, name) {
|
||||||
select.value = id;
|
select.value = id;
|
||||||
notesName.value = note.name;
|
notesName.value = note.name;
|
||||||
notesText.value = note.legend;
|
notesText.value = note.legend;
|
||||||
|
showNote(note);
|
||||||
} else {
|
} else {
|
||||||
const value = "There are no added notes. Click on element (e.g. label) and add a free text note";
|
const value = "There are no added notes. Click on element (e.g. label) and add a free text note";
|
||||||
document.getElementById("notesText").value = value;
|
document.getElementById("notesText").value = value;
|
||||||
|
|
@ -37,12 +38,19 @@ function editNotes(id, name) {
|
||||||
document.getElementById("notesSelect").addEventListener("change", changeObject);
|
document.getElementById("notesSelect").addEventListener("change", changeObject);
|
||||||
document.getElementById("notesName").addEventListener("input", changeName);
|
document.getElementById("notesName").addEventListener("input", changeName);
|
||||||
document.getElementById("notesText").addEventListener("input", changeText);
|
document.getElementById("notesText").addEventListener("input", changeText);
|
||||||
|
document.getElementById("notesPin").addEventListener("click", () => options.pinNotes = !options.pinNotes);
|
||||||
document.getElementById("notesFocus").addEventListener("click", validateHighlightElement);
|
document.getElementById("notesFocus").addEventListener("click", validateHighlightElement);
|
||||||
document.getElementById("notesDownload").addEventListener("click", downloadLegends);
|
document.getElementById("notesDownload").addEventListener("click", downloadLegends);
|
||||||
document.getElementById("notesUpload").addEventListener("click", () => legendsToLoad.click());
|
document.getElementById("notesUpload").addEventListener("click", () => legendsToLoad.click());
|
||||||
document.getElementById("legendsToLoad").addEventListener("change", function() {uploadFile(this, uploadLegends)});
|
document.getElementById("legendsToLoad").addEventListener("change", function() {uploadFile(this, uploadLegends)});
|
||||||
document.getElementById("notesRemove").addEventListener("click", triggerNotesRemove);
|
document.getElementById("notesRemove").addEventListener("click", triggerNotesRemove);
|
||||||
|
|
||||||
|
function showNote(note) {
|
||||||
|
document.getElementById("notes").style.display = "block";
|
||||||
|
document.getElementById("notesHeader").innerHTML = note.name;
|
||||||
|
document.getElementById("notesBody").innerHTML = note.legend;
|
||||||
|
}
|
||||||
|
|
||||||
function changeObject() {
|
function changeObject() {
|
||||||
const note = notes.find(note => note.id === this.value);
|
const note = notes.find(note => note.id === this.value);
|
||||||
if (!note) return;
|
if (!note) return;
|
||||||
|
|
@ -55,6 +63,7 @@ function editNotes(id, name) {
|
||||||
const note = notes.find(note => note.id === id);
|
const note = notes.find(note => note.id === id);
|
||||||
if (!note) return;
|
if (!note) return;
|
||||||
note.name = this.value;
|
note.name = this.value;
|
||||||
|
showNote(note);
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeText() {
|
function changeText() {
|
||||||
|
|
@ -62,6 +71,7 @@ function editNotes(id, name) {
|
||||||
const note = notes.find(note => note.id === id);
|
const note = notes.find(note => note.id === id);
|
||||||
if (!note) return;
|
if (!note) return;
|
||||||
note.legend = this.value;
|
note.legend = this.value;
|
||||||
|
showNote(note);
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateHighlightElement() {
|
function validateHighlightElement() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue