mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
Merge branch 'master' of https://github.com/Azgaar/Fantasy-Map-Generator
This commit is contained in:
commit
159c1aa3e3
4 changed files with 35 additions and 10 deletions
|
|
@ -3455,7 +3455,8 @@
|
|||
<button id="namesbaseAdd" data-tip="Add new namesbase" class="icon-plus"></button>
|
||||
<button id="namesbaseDefault" data-tip="Restore default namesbase" class="icon-cancel"></button>
|
||||
<button id="namesbaseDownload" data-tip="Download namesbase to PC" class="icon-download"></button>
|
||||
<button id="namesbaseUpload" data-tip="Upload a namesbase from PC, click to override, ctrl+click to extend" class="icon-upload"></button>
|
||||
<button id="namesbaseUpload" data-tip="Upload a namesbase from PC, replacing the current set" class="icon-upload"></button>
|
||||
<button id="namesbaseUploadExtend" data-tip="Upload a namesbase from PC, extending the current set" class="icon-up-circled2"></button>
|
||||
<button id="namesbaseCA" data-tip="Find or share custom namesbase on Cartography Assets portal" class="icon-drafting-compass"></button>
|
||||
<button id="namesbaseAnalyze" data-tip="Analyze namesbase to get a validity and quality overview" class="icon-flask"></button>
|
||||
<button id="namesbaseSpeak" data-tip="Speak the examples. You can change voice and language in options" class="icon-voice"></button>
|
||||
|
|
@ -4379,6 +4380,12 @@
|
|||
<output id="submapAngleOutput">0</output>°
|
||||
</div>
|
||||
|
||||
<div>Scale</div>
|
||||
<div>
|
||||
<input id="submapScaleInput" type="range" min="-25" max="25" value="0" />
|
||||
<output id="submapScaleOutput">1</output>x
|
||||
</div>
|
||||
|
||||
<div>Mirror</div>
|
||||
<div>
|
||||
<input type="checkbox" class="checkbox" id="submapMirrorH" />
|
||||
|
|
|
|||
|
|
@ -202,10 +202,10 @@ function showMapTooltip(point, e, i, g) {
|
|||
const province = pack.cells.province[i];
|
||||
const prov = province ? pack.provinces[province].fullName + ", " : "";
|
||||
tip(prov + stateName);
|
||||
if (statesEditor?.offsetParent) highlightEditorLine(statesEditor, state);
|
||||
if (diplomacyEditor?.offsetParent) highlightEditorLine(diplomacyEditor, state);
|
||||
if (militaryOverview?.offsetParent) highlightEditorLine(militaryOverview, state);
|
||||
if (provincesEditor?.offsetParent) highlightEditorLine(provincesEditor, province);
|
||||
if (document.getElementById('statesEditor')?.offsetParent) highlightEditorLine(statesEditor, state);
|
||||
if (document.getElementById('diplomacyEditor')?.offsetParent) highlightEditorLine(diplomacyEditor, state);
|
||||
if (document.getElementById('militaryOverview')?.offsetParent) highlightEditorLine(militaryOverview, state);
|
||||
if (document.getElementById('provincesEditor')?.offsetParent) highlightEditorLine(provincesEditor, province);
|
||||
} else if (layerIsOn("toggleCultures") && pack.cells.culture[i]) {
|
||||
const culture = pack.cells.culture[i];
|
||||
tip("Culture: " + pack.cultures[culture].name);
|
||||
|
|
|
|||
|
|
@ -20,14 +20,21 @@ function editNamesbase() {
|
|||
document.getElementById("namesbaseAnalyze").addEventListener("click", analyzeNamesbase);
|
||||
document.getElementById("namesbaseDefault").addEventListener("click", namesbaseRestoreDefault);
|
||||
document.getElementById("namesbaseDownload").addEventListener("click", namesbaseDownload);
|
||||
document.getElementById("namesbaseUpload").addEventListener("click", () => {
|
||||
|
||||
const uploader = document.getElementById("namesbaseToLoad");
|
||||
uploader.dataset.override = event.ctrlKey ? "no" : "yes";
|
||||
document.getElementById("namesbaseUpload").addEventListener("click", () => {
|
||||
uploader.addEventListener("change", function (event) {
|
||||
uploadFile(event.target, d => namesbaseUpload(d, true));
|
||||
}, { once: true });
|
||||
uploader.click();
|
||||
});
|
||||
document.getElementById("namesbaseToLoad").addEventListener("change", function (ev) {
|
||||
uploadFile(this, d => namesbaseUpload(d, ev.target.dataset.override === "yes"));
|
||||
document.getElementById("namesbaseUploadExtend").addEventListener("click", () => {
|
||||
uploader.addEventListener("change", function (event) {
|
||||
uploadFile(event.target, d => namesbaseUpload(d, false));
|
||||
}, { once: true });
|
||||
uploader.click();
|
||||
});
|
||||
|
||||
document.getElementById("namesbaseCA").addEventListener("click", () => {
|
||||
openURL("https://cartographyassets.com/asset-category/specific-assets/azgaars-generator/namebases/");
|
||||
});
|
||||
|
|
|
|||
|
|
@ -10,6 +10,12 @@ window.UISubmap = (function () {
|
|||
output.style.color = getCellsDensityColor(cells);
|
||||
});
|
||||
|
||||
document.getElementById("submapScaleInput").addEventListener("input", function (event) {
|
||||
const exp = Math.pow(1.1, +event.target.value);
|
||||
document.getElementById("submapScaleOutput").value = rn(exp,2);
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
function openSubmapMenu() {
|
||||
$("#submapOptionsDialog").dialog({
|
||||
title: "Create a submap",
|
||||
|
|
@ -32,7 +38,9 @@ window.UISubmap = (function () {
|
|||
resetZoom(0);
|
||||
|
||||
document.getElementById("submapAngleInput").value = 0;
|
||||
document.getElementById("submapAngleOutput").value = "0°";
|
||||
document.getElementById("submapAngleOutput").value = "0";
|
||||
document.getElementById("submapScaleInput").value = 1;
|
||||
document.getElementById("submapScaleOutput").value = 1;
|
||||
document.getElementById("submapShiftX").value = 0;
|
||||
document.getElementById("submapShiftY").value = 0;
|
||||
document.getElementById("submapMirrorH").checked = false;
|
||||
|
|
@ -64,11 +72,13 @@ window.UISubmap = (function () {
|
|||
const angle = (+document.getElementById("submapAngleInput").value / 180) * Math.PI;
|
||||
const shiftX = +document.getElementById("submapShiftX").value;
|
||||
const shiftY = +document.getElementById("submapShiftY").value;
|
||||
const ratio = +document.getElementById("submapScaleInput").value;
|
||||
const mirrorH = document.getElementById("submapMirrorH").checked;
|
||||
const mirrorV = document.getElementById("submapMirrorV").checked;
|
||||
|
||||
const [cx, cy] = [graphWidth / 2, graphHeight / 2];
|
||||
const rot = alfa => (x, y) => [(x - cx) * Math.cos(alfa) - (y - cy) * Math.sin(alfa) + cx, (y - cy) * Math.cos(alfa) + (x - cx) * Math.sin(alfa) + cy];
|
||||
const scale = ratio => (x, y) => [(x-cx) * ratio + cx, (y-cy) * ratio + cy];
|
||||
const shift = (dx, dy) => (x, y) => [x + dx, y + dy];
|
||||
const flipH = (x, y) => [-x + 2 * cx, y];
|
||||
const flipV = (x, y) => [x, -y + 2 * cy];
|
||||
|
|
@ -83,6 +93,7 @@ window.UISubmap = (function () {
|
|||
projection = app(shift(shiftX, shiftY), projection);
|
||||
inverse = app(inverse, shift(-shiftX, -shiftY));
|
||||
}
|
||||
if (ratio) [projection, inverse] = [app(scale(Math.pow(1.1,ratio)), projection), app(inverse, scale(Math.pow(1.1,-ratio)))];
|
||||
if (mirrorH) [projection, inverse] = [app(flipH, projection), app(inverse, flipH)];
|
||||
if (mirrorV) [projection, inverse] = [app(flipV, projection), app(inverse, flipV)];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue