mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-18 18:11:24 +01:00
0.556b
Countries Editor hotfix
This commit is contained in:
parent
5b008d8e13
commit
ad9583e115
2 changed files with 25 additions and 31 deletions
|
|
@ -21,8 +21,8 @@
|
||||||
<script src="libs/polylabel.js"></script>
|
<script src="libs/polylabel.js"></script>
|
||||||
<script src="libs/quantize.js" defer></script>
|
<script src="libs/quantize.js" defer></script>
|
||||||
<script src="libs/d3-hexbin.v0.2.min.js" defer></script>
|
<script src="libs/d3-hexbin.v0.2.min.js" defer></script>
|
||||||
<link rel="stylesheet" type="text/css" href="index.css?version=0.555b"/>
|
<link rel="stylesheet" type="text/css" href="index.css?version=0.556b"/>
|
||||||
<link rel="stylesheet" type="text/css" href="icons.css?version=0.555b"/>
|
<link rel="stylesheet" type="text/css" href="icons.css?version=0.556b"/>
|
||||||
<link rel="stylesheet" type="text/css" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"/>
|
<link rel="stylesheet" type="text/css" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"/>
|
||||||
</head>
|
</head>
|
||||||
<body class="fullscreen">
|
<body class="fullscreen">
|
||||||
|
|
@ -753,5 +753,5 @@
|
||||||
Type: <span id="feature">no</span>
|
Type: <span id="feature">no</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript" src="script.js?version=0.555b"></script>
|
<script type="text/javascript" src="script.js?version=0.556b"></script>
|
||||||
</body>
|
</body>
|
||||||
38
script.js
38
script.js
|
|
@ -551,9 +551,9 @@ function fantasyMap() {
|
||||||
if (mapTemplate === "Random") {
|
if (mapTemplate === "Random") {
|
||||||
var rnd = Math.random();
|
var rnd = Math.random();
|
||||||
if (rnd > 0.9) {mapTemplate = "Volcano";}
|
if (rnd > 0.9) {mapTemplate = "Volcano";}
|
||||||
if (rnd > 0.8 && rnd <= 0.9) {mapTemplate = "High Island";}
|
if (rnd > 0.7 && rnd <= 0.9) {mapTemplate = "High Island";}
|
||||||
if (rnd > 0.6 && rnd <= 0.8) {mapTemplate = "Low Island";}
|
if (rnd > 0.5 && rnd <= 0.7) {mapTemplate = "Low Island";}
|
||||||
if (rnd > 0.35 && rnd <= 0.6) {mapTemplate = "Continents";}
|
if (rnd > 0.35 && rnd <= 0.5) {mapTemplate = "Continents";}
|
||||||
if (rnd > 0.01 && rnd <= 0.35) {mapTemplate = "Archipelago";}
|
if (rnd > 0.01 && rnd <= 0.35) {mapTemplate = "Archipelago";}
|
||||||
if (rnd <= 0.01) {mapTemplate = "Atoll";}
|
if (rnd <= 0.01) {mapTemplate = "Atoll";}
|
||||||
}
|
}
|
||||||
|
|
@ -1615,8 +1615,7 @@ function fantasyMap() {
|
||||||
$("#riverNew").click();
|
$("#riverNew").click();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elSelected.call(d3.drag().on("drag", null)).classed("draggable", false);
|
unselect();
|
||||||
rivers.select(".riverPoints").remove();
|
|
||||||
}
|
}
|
||||||
elSelected = d3.select(this);
|
elSelected = d3.select(this);
|
||||||
elSelected.call(d3.drag().on("start", riverDrag)).classed("draggable", true);
|
elSelected.call(d3.drag().on("start", riverDrag)).classed("draggable", true);
|
||||||
|
|
@ -1633,14 +1632,19 @@ function fantasyMap() {
|
||||||
title: "Edit River",
|
title: "Edit River",
|
||||||
minHeight: 30, width: "auto", maxWidth: 275, resizable: false,
|
minHeight: 30, width: "auto", maxWidth: 275, resizable: false,
|
||||||
position: {my: "center top", at: "top", of: this}
|
position: {my: "center top", at: "top", of: this}
|
||||||
}).on("dialogclose", function(event) {
|
}).on("dialogclose", function() {unselect();});
|
||||||
|
}
|
||||||
|
|
||||||
|
function unselect() {
|
||||||
if (elSelected) {
|
if (elSelected) {
|
||||||
elSelected.call(d3.drag().on("drag", null)).classed("draggable", false);
|
elSelected.call(d3.drag().on("drag", null)).classed("draggable", false);
|
||||||
rivers.select(".riverPoints").remove();
|
rivers.select(".riverPoints").remove();
|
||||||
$(".pressed").removeClass('pressed');
|
$(".pressed").removeClass('pressed');
|
||||||
viewbox.style("cursor", "default");
|
viewbox.style("cursor", "default");
|
||||||
|
elSelected = null;
|
||||||
|
if ($("#riverEditor").is(":visible")) {$("#riverEditor").dialog("close");}
|
||||||
|
if ($("#labelEditor").is(":visible")) {$("#labelEditor").dialog("close");}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function addRiverPoint(point) {
|
function addRiverPoint(point) {
|
||||||
|
|
@ -3185,9 +3189,7 @@ function fantasyMap() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function editLabel() {
|
function editLabel() {
|
||||||
if (elSelected) {
|
if (elSelected) {unselect();}
|
||||||
elSelected.call(d3.drag().on("drag", null)).classed("draggable", false);
|
|
||||||
}
|
|
||||||
elSelected = d3.select(this);
|
elSelected = d3.select(this);
|
||||||
elSelected.call(d3.drag().on("drag", dragged).on("end", dragended)).classed("draggable", true);
|
elSelected.call(d3.drag().on("drag", dragged).on("end", dragended)).classed("draggable", true);
|
||||||
var group = d3.select(this.parentNode);
|
var group = d3.select(this.parentNode);
|
||||||
|
|
@ -3210,7 +3212,7 @@ function fantasyMap() {
|
||||||
title: "Edit Label: " + editText.value,
|
title: "Edit Label: " + editText.value,
|
||||||
minHeight: 30, width: "auto", maxWidth: 275, resizable: false,
|
minHeight: 30, width: "auto", maxWidth: 275, resizable: false,
|
||||||
position: {my: "center top", at: "bottom", of: this}
|
position: {my: "center top", at: "bottom", of: this}
|
||||||
});
|
}).on("dialogclose", function() {unselect();});
|
||||||
fetchAdditionalFonts();
|
fetchAdditionalFonts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3833,12 +3835,12 @@ function fantasyMap() {
|
||||||
|
|
||||||
// Hotkeys
|
// Hotkeys
|
||||||
d3.select("body").on("keydown", function() {
|
d3.select("body").on("keydown", function() {
|
||||||
//if ($(".ui-dialog").is(":visible")) {return;}
|
$("input").on("keydown", function(e) {e.stopPropagation();}); // cancel on input
|
||||||
switch(d3.event.keyCode) {
|
switch(d3.event.keyCode) {
|
||||||
case 16: // Shift - hold to continue adding elements on click
|
case 16: // Shift - hold to continue adding elements on click
|
||||||
shift = true;
|
shift = true;
|
||||||
break;
|
break;
|
||||||
case 78: // "N" for new map
|
case 113: // "F2" for new map
|
||||||
$("#randomMap").click();
|
$("#randomMap").click();
|
||||||
break;
|
break;
|
||||||
case 32: // Space to log focused cell data
|
case 32: // Space to log focused cell data
|
||||||
|
|
@ -5135,15 +5137,7 @@ function fantasyMap() {
|
||||||
title: "Countries Editor",
|
title: "Countries Editor",
|
||||||
minHeight: "auto", width: "auto",
|
minHeight: "auto", width: "auto",
|
||||||
position: {my: "right top", at: "right-10 top+10", of: "svg"}
|
position: {my: "right top", at: "right-10 top+10", of: "svg"}
|
||||||
}).on("dialogclose", function(e) {
|
}).on("dialogclose", function() {$("#countriesManuallyCancel").click();});
|
||||||
customization = 0;
|
|
||||||
if (grid.style("display") === "inline") {toggleGrid.click();}
|
|
||||||
if (labels.style("display") === "none") {toggleLabels.click();}
|
|
||||||
$("#countriesBottom").children().show();
|
|
||||||
$("#countriesManuallyButtons, #countriesRegenerateButtons").hide();
|
|
||||||
$(".selected").removeClass("selected");
|
|
||||||
customization = 0;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
// restore customization Editor version
|
// restore customization Editor version
|
||||||
if (customization === 3) {
|
if (customization === 3) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue