Merge remote-tracking branch 'upstream/master' into dev-submap

This commit is contained in:
Mészáros Gergely 2021-09-11 01:12:33 +02:00
commit 1d1cd0bb71
15 changed files with 594 additions and 607 deletions

View file

@ -32,15 +32,20 @@ function tip(tip = "Tip is undefined", main, type, time) {
else if (type === "warn") tooltip.style.background = "linear-gradient(0.1turn, #ffffff00, #be5d08cc, #ffffff00)";
else if (type === "success") tooltip.style.background = "linear-gradient(0.1turn, #ffffff00, #127912cc, #ffffff00)";
if (main) tooltip.dataset.main = tip; // set main tip
if (time) setTimeout(() => (tooltip.dataset.main = ""), time); // clear main in some time
if (main) {
tooltip.dataset.main = tip;
tooltip.dataset.color = tooltip.style.background;
}
if (time) setTimeout(() => clearMainTip(), time);
}
function showMainTip() {
tooltip.style.background = tooltip.dataset.color;
tooltip.innerHTML = tooltip.dataset.main;
}
function clearMainTip() {
tooltip.dataset.color = "";
tooltip.dataset.main = "";
tooltip.innerHTML = "";
}

View file

@ -8,7 +8,7 @@ function editHeightmap() {
<p>You can <i>keep</i> the data, but you won't be able to change the coastline.</p>
<p>Try <i>risk</i> mode to change the coastline and keep the data. The data will be restored as much as possible, but it can cause unpredictable errors.</p>
<p>Please <span class="pseudoLink" onclick=dowloadMap(); editHeightmap();>save the map</span> before editing the heightmap!</p>
<p>Check out ${link("https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Heightmap-customization", "wiki")} for guidance.</p>`;
<p style="margin-bottom: 0">Check out ${link("https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Heightmap-customization", "wiki")} for guidance.</p>`;
$("#alert").dialog({
resizable: false,

View file

@ -663,7 +663,7 @@ function showSavePane() {
$("#saveMapData").dialog({
title: "Save map",
resizable: false,
width: "27em",
width: "25em",
position: {my: "center", at: "center", of: "svg"},
buttons: {
Close: function () {
@ -699,7 +699,7 @@ async function showLoadPane() {
$("#loadMapData").dialog({
title: "Load map",
resizable: false,
width: "22em",
width: "24em",
position: {my: "center", at: "center", of: "svg"},
buttons: {
Close: function () {
@ -708,17 +708,23 @@ async function showLoadPane() {
}
});
const dpx = document.getElementById("loadFromDropbox");
const dpf = dpx.querySelector("select");
const loadFromDropboxButtons = document.getElementById("loadFromDropboxButtons");
const fileSelect = document.getElementById("loadFromDropboxSelect");
const files = await Cloud.providers.dropbox.list();
dpx.style.display = files? "block" : "none";
if (!files) return;
while(dpf.firstChild) dpf.removeChild(dpf.firstChild);
files.forEach(f => {
const opt = document.createElement('option');
opt.innerText = f.name;
opt.value = f.path;
dpf.appendChild(opt);
if (!files) {
loadFromDropboxButtons.style.display = "none";
fileSelect.innerHTML = `<option value="" disabled selected>Save files to Dropbox first</option>`;
return;
}
loadFromDropboxButtons.style.display = "block";
fileSelect.innerHTML = "";
files.forEach(file => {
const opt = document.createElement("option");
opt.innerText = file.name;
opt.value = file.path;
fileSelect.appendChild(opt);
});
}

File diff suppressed because one or more lines are too long

View file

@ -475,7 +475,7 @@ function addLabelOnClick() {
const id = getNextId("label");
let group = labels.select("#addedLabels");
if (!group.size()) group = labels.append("g").attr("id", "addedLabels").attr("fill", "#3e3e4b").attr("opacity", 1).attr("stroke", "#3a3a3a").attr("stroke-width", 0).attr("font-family", "Almendra SC").attr("data-font", "Almendra+SC").attr("font-size", 18).attr("data-size", 18).attr("filter", null);
if (!group.size()) group = labels.append("g").attr("id", "addedLabels").attr("fill", "#3e3e4b").attr("opacity", 1).attr("stroke", "#3a3a3a").attr("stroke-width", 0).attr("font-family", "Almendra SC").attr("font-size", 18).attr("data-size", 18).attr("filter", null);
const example = group.append("text").attr("x", 0).attr("x", 0).text(name);
const width = example.node().getBBox().width;