mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
refactor(es modules): continue migration
This commit is contained in:
parent
922c6e2431
commit
364f33975f
50 changed files with 180 additions and 85 deletions
|
|
@ -7703,9 +7703,9 @@
|
||||||
<script src="libs/polylabel.min.js"></script>
|
<script src="libs/polylabel.min.js"></script>
|
||||||
<script src="libs/lineclip.min.js"></script>
|
<script src="libs/lineclip.min.js"></script>
|
||||||
<script src="libs/alea.min.js"></script>
|
<script src="libs/alea.min.js"></script>
|
||||||
<script src="modules/fonts.js"></script>
|
<script type="module" src="modules/fonts.js"></script>
|
||||||
<script type="module" src="modules/ui/layers.js"></script>
|
<script type="module" src="modules/ui/layers.js"></script>
|
||||||
<script src="modules/ui/stylePresets.js"></script>
|
<script type="modile" src="modules/ui/stylePresets.js"></script>
|
||||||
<script type="module" src="modules/ui/general.js?v=1.87.00"></script>
|
<script type="module" src="modules/ui/general.js?v=1.87.00"></script>
|
||||||
<script type="module" src="modules/ui/options.js?v=1.87.00"></script>
|
<script type="module" src="modules/ui/options.js?v=1.87.00"></script>
|
||||||
|
|
||||||
|
|
@ -7755,7 +7755,6 @@
|
||||||
<script type="module" src="modules/coa-renderer.js"></script>
|
<script type="module" src="modules/coa-renderer.js"></script>
|
||||||
<script defer src="libs/rgbquant.min.js"></script>
|
<script defer src="libs/rgbquant.min.js"></script>
|
||||||
<script defer src="libs/jquery.ui.touch-punch.min.js"></script>
|
<script defer src="libs/jquery.ui.touch-punch.min.js"></script>
|
||||||
number[][]
|
|
||||||
<script type="module" src="modules/io/save.js"></script>
|
<script type="module" src="modules/io/save.js"></script>
|
||||||
<script type="module" src="modules/io/load.js?v=1.87.00"></script>
|
<script type="module" src="modules/io/load.js?v=1.87.00"></script>
|
||||||
<script type="module" src="modules/io/cloud.js"></script>
|
<script type="module" src="modules/io/cloud.js"></script>
|
||||||
|
|
|
||||||
|
|
@ -150,13 +150,6 @@ function defineSvg(width, height) {
|
||||||
.attr("fill", "#e8f0f6")
|
.attr("fill", "#e8f0f6")
|
||||||
.attr("filter", "url(#splotch)");
|
.attr("filter", "url(#splotch)");
|
||||||
|
|
||||||
// assign events separately as not a viewbox child
|
|
||||||
scaleBar.on("mousemove", () => tip("Click to open Units Editor")).on("click", () => editUnits());
|
|
||||||
|
|
||||||
legend
|
|
||||||
.on("mousemove", () => tip("Drag to change the position. Click to hide the legend"))
|
|
||||||
.on("click", () => clearLegend());
|
|
||||||
|
|
||||||
landmass.append("rect").attr("x", 0).attr("y", 0).attr("width", width).attr("height", height);
|
landmass.append("rect").attr("x", 0).attr("y", 0).attr("width", width).attr("height", height);
|
||||||
|
|
||||||
oceanPattern
|
oceanPattern
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import {restoreDefaultEvents} from "/src/scripts/events";
|
import {restoreDefaultEvents} from "/src/scripts/events";
|
||||||
import {findAll, findCell, getPackPolygon, isLand} from "/src/utils/graphUtils";
|
import {findAll, findCell, getPackPolygon, isLand} from "/src/utils/graphUtils";
|
||||||
import {showMainTip, clearMainTip} from "/src/scripts/tooltips";
|
import {tip, showMainTip, clearMainTip} from "/src/scripts/tooltips";
|
||||||
import {byId} from "/src/utils/shorthands";
|
import {byId} from "/src/utils/shorthands";
|
||||||
|
|
||||||
const $body = insertEditorHtml();
|
const $body = insertEditorHtml();
|
||||||
|
|
@ -59,7 +59,6 @@ function insertEditorHtml() {
|
||||||
<label data-tip="Change brush size" data-shortcut="+ (increase), – (decrease)" class="italic">Brush size:
|
<label data-tip="Change brush size" data-shortcut="+ (increase), – (decrease)" class="italic">Brush size:
|
||||||
<input
|
<input
|
||||||
id="culturesManuallyBrush"
|
id="culturesManuallyBrush"
|
||||||
oninput="tip('Brush size: '+this.value); culturesManuallyBrushNumber.value = this.value"
|
|
||||||
type="range"
|
type="range"
|
||||||
min="5"
|
min="5"
|
||||||
max="99"
|
max="99"
|
||||||
|
|
@ -68,7 +67,6 @@ function insertEditorHtml() {
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
id="culturesManuallyBrushNumber"
|
id="culturesManuallyBrushNumber"
|
||||||
oninput="tip('Brush size: '+this.value); culturesManuallyBrush.value = this.value"
|
|
||||||
type="number"
|
type="number"
|
||||||
min="5"
|
min="5"
|
||||||
max="99"
|
max="99"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import {restoreDefaultEvents} from "/src/scripts/events";
|
import {restoreDefaultEvents} from "/src/scripts/events";
|
||||||
import {findAll, findCell, getPackPolygon, isLand} from "/src/utils/graphUtils";
|
import {findAll, findCell, getPackPolygon, isLand} from "/src/utils/graphUtils";
|
||||||
import {showMainTip, clearMainTip} from "/src/scripts/tooltips";
|
import {tip, showMainTip, clearMainTip} from "/src/scripts/tooltips";
|
||||||
import {byId} from "/src/utils/shorthands";
|
import {byId} from "/src/utils/shorthands";
|
||||||
|
|
||||||
const $body = insertEditorHtml();
|
const $body = insertEditorHtml();
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import {restoreDefaultEvents} from "/src/scripts/events";
|
import {restoreDefaultEvents} from "/src/scripts/events";
|
||||||
import {findAll, findCell, getPackPolygon, isLand} from "/src/utils/graphUtils";
|
import {findAll, findCell, getPackPolygon, isLand} from "/src/utils/graphUtils";
|
||||||
import {byId} from "/src/utils/shorthands";
|
import {byId} from "/src/utils/shorthands";
|
||||||
import {showMainTip, clearMainTip} from "/src/scripts/tooltips";
|
import {tip, showMainTip, clearMainTip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
const $body = insertEditorHtml();
|
const $body = insertEditorHtml();
|
||||||
addListeners();
|
addListeners();
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import {tip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
export function exportToJson(type) {
|
export function exportToJson(type) {
|
||||||
if (customization)
|
if (customization)
|
||||||
return tip("Data cannot be exported when edit mode is active, please exit the mode and retry", false, "error");
|
return tip("Data cannot be exported when edit mode is active, please exit the mode and retry", false, "error");
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import {byId} from "/src/utils/shorthands";
|
import {byId} from "/src/utils/shorthands";
|
||||||
|
import {tip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
appendStyleSheet();
|
appendStyleSheet();
|
||||||
insertHtml();
|
insertHtml();
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import {tip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
// module to prompt PWA installation
|
// module to prompt PWA installation
|
||||||
let installButton = null;
|
let installButton = null;
|
||||||
let deferredPrompt = null;
|
let deferredPrompt = null;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import {rollups} from "../../../utils/functionUtils.js";
|
import {rollups} from "../../../utils/functionUtils.js";
|
||||||
import {isWater} from "/src/utils/graphUtils";
|
import {isWater} from "/src/utils/graphUtils";
|
||||||
|
import {tip} from "/src/scripts/tooltips";
|
||||||
import {byId} from "/src/utils/shorthands";
|
import {byId} from "/src/utils/shorthands";
|
||||||
|
|
||||||
const entitiesMap = {
|
const entitiesMap = {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
"use strict";
|
import {tip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
const fonts = [
|
const fonts = [
|
||||||
{family: "Arial"},
|
{family: "Arial"},
|
||||||
|
|
@ -38,12 +38,14 @@ const fonts = [
|
||||||
{
|
{
|
||||||
family: "Architects Daughter",
|
family: "Architects Daughter",
|
||||||
src: "url(https://fonts.gstatic.com/s/architectsdaughter/v8/RXTgOOQ9AAtaVOHxx0IUBM3t7GjCYufj5TXV5VnA2p8.woff2)",
|
src: "url(https://fonts.gstatic.com/s/architectsdaughter/v8/RXTgOOQ9AAtaVOHxx0IUBM3t7GjCYufj5TXV5VnA2p8.woff2)",
|
||||||
unicodeRange: "U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
unicodeRange:
|
||||||
|
"U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
family: "Bitter",
|
family: "Bitter",
|
||||||
src: "url(https://fonts.gstatic.com/s/bitter/v12/zfs6I-5mjWQ3nxqccMoL2A.woff2)",
|
src: "url(https://fonts.gstatic.com/s/bitter/v12/zfs6I-5mjWQ3nxqccMoL2A.woff2)",
|
||||||
unicodeRange: "U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
unicodeRange:
|
||||||
|
"U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
family: "Caesar Dressing",
|
family: "Caesar Dressing",
|
||||||
|
|
@ -54,12 +56,14 @@ const fonts = [
|
||||||
{
|
{
|
||||||
family: "Cinzel",
|
family: "Cinzel",
|
||||||
src: "url(https://fonts.gstatic.com/s/cinzel/v7/zOdksD_UUTk1LJF9z4tURA.woff2)",
|
src: "url(https://fonts.gstatic.com/s/cinzel/v7/zOdksD_UUTk1LJF9z4tURA.woff2)",
|
||||||
unicodeRange: "U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
unicodeRange:
|
||||||
|
"U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
family: "Dancing Script",
|
family: "Dancing Script",
|
||||||
src: "url(https://fonts.gstatic.com/s/dancingscript/v9/KGBfwabt0ZRLA5W1ywjowUHdOuSHeh0r6jGTOGdAKHA.woff2)",
|
src: "url(https://fonts.gstatic.com/s/dancingscript/v9/KGBfwabt0ZRLA5W1ywjowUHdOuSHeh0r6jGTOGdAKHA.woff2)",
|
||||||
unicodeRange: "U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
unicodeRange:
|
||||||
|
"U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
family: "Faster One",
|
family: "Faster One",
|
||||||
|
|
@ -82,12 +86,14 @@ const fonts = [
|
||||||
{
|
{
|
||||||
family: "Gloria Hallelujah",
|
family: "Gloria Hallelujah",
|
||||||
src: "url(https://fonts.gstatic.com/s/gloriahallelujah/v9/CA1k7SlXcY5kvI81M_R28cNDay8z-hHR7F16xrcXsJw.woff2)",
|
src: "url(https://fonts.gstatic.com/s/gloriahallelujah/v9/CA1k7SlXcY5kvI81M_R28cNDay8z-hHR7F16xrcXsJw.woff2)",
|
||||||
unicodeRange: "U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
unicodeRange:
|
||||||
|
"U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
family: "Great Vibes",
|
family: "Great Vibes",
|
||||||
src: "url(https://fonts.gstatic.com/s/greatvibes/v5/6q1c0ofG6NKsEhAc2eh-3Y4P5ICox8Kq3LLUNMylGO4.woff2)",
|
src: "url(https://fonts.gstatic.com/s/greatvibes/v5/6q1c0ofG6NKsEhAc2eh-3Y4P5ICox8Kq3LLUNMylGO4.woff2)",
|
||||||
unicodeRange: "U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
unicodeRange:
|
||||||
|
"U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
family: "Henny Penny",
|
family: "Henny Penny",
|
||||||
|
|
@ -98,7 +104,8 @@ const fonts = [
|
||||||
{
|
{
|
||||||
family: "IM Fell English",
|
family: "IM Fell English",
|
||||||
src: "url(https://fonts.gstatic.com/s/imfellenglish/v7/xwIisCqGFi8pff-oa9uSVAkYLEKE0CJQa8tfZYc_plY.woff2)",
|
src: "url(https://fonts.gstatic.com/s/imfellenglish/v7/xwIisCqGFi8pff-oa9uSVAkYLEKE0CJQa8tfZYc_plY.woff2)",
|
||||||
unicodeRange: "U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
unicodeRange:
|
||||||
|
"U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
family: "Kelly Slab",
|
family: "Kelly Slab",
|
||||||
|
|
@ -121,7 +128,8 @@ const fonts = [
|
||||||
{
|
{
|
||||||
family: "Kaushan Script",
|
family: "Kaushan Script",
|
||||||
src: "url(https://fonts.gstatic.com/s/kaushanscript/v6/qx1LSqts-NtiKcLw4N03IEd0sm1ffa_JvZxsF_BEwQk.woff2)",
|
src: "url(https://fonts.gstatic.com/s/kaushanscript/v6/qx1LSqts-NtiKcLw4N03IEd0sm1ffa_JvZxsF_BEwQk.woff2)",
|
||||||
unicodeRange: "U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
unicodeRange:
|
||||||
|
"U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
family: "Macondo",
|
family: "Macondo",
|
||||||
|
|
@ -150,7 +158,8 @@ const fonts = [
|
||||||
{
|
{
|
||||||
family: "Montez",
|
family: "Montez",
|
||||||
src: "url(https://fonts.gstatic.com/s/montez/v8/aq8el3-0osHIcFK6bXAPkw.woff2)",
|
src: "url(https://fonts.gstatic.com/s/montez/v8/aq8el3-0osHIcFK6bXAPkw.woff2)",
|
||||||
unicodeRange: "U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
unicodeRange:
|
||||||
|
"U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
family: "Nova Script",
|
family: "Nova Script",
|
||||||
|
|
@ -161,7 +170,8 @@ const fonts = [
|
||||||
{
|
{
|
||||||
family: "Orbitron",
|
family: "Orbitron",
|
||||||
src: "url(https://fonts.gstatic.com/s/orbitron/v9/HmnHiRzvcnQr8CjBje6GQvesZW2xOQ-xsNqO47m55DA.woff2)",
|
src: "url(https://fonts.gstatic.com/s/orbitron/v9/HmnHiRzvcnQr8CjBje6GQvesZW2xOQ-xsNqO47m55DA.woff2)",
|
||||||
unicodeRange: "U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
unicodeRange:
|
||||||
|
"U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
family: "Oregano",
|
family: "Oregano",
|
||||||
|
|
@ -184,12 +194,14 @@ const fonts = [
|
||||||
{
|
{
|
||||||
family: "Satisfy",
|
family: "Satisfy",
|
||||||
src: "url(https://fonts.gstatic.com/s/satisfy/v8/2OzALGYfHwQjkPYWELy-cw.woff2)",
|
src: "url(https://fonts.gstatic.com/s/satisfy/v8/2OzALGYfHwQjkPYWELy-cw.woff2)",
|
||||||
unicodeRange: "U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
unicodeRange:
|
||||||
|
"U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
family: "Shadows Into Light",
|
family: "Shadows Into Light",
|
||||||
src: "url(https://fonts.gstatic.com/s/shadowsintolight/v7/clhLqOv7MXn459PTh0gXYFK2TSYBz0eNcHnp4YqE4Ts.woff2)",
|
src: "url(https://fonts.gstatic.com/s/shadowsintolight/v7/clhLqOv7MXn459PTh0gXYFK2TSYBz0eNcHnp4YqE4Ts.woff2)",
|
||||||
unicodeRange: "U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
unicodeRange:
|
||||||
|
"U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
family: "Tapestry",
|
family: "Tapestry",
|
||||||
|
|
@ -218,7 +230,8 @@ const fonts = [
|
||||||
{
|
{
|
||||||
family: "Yellowtail",
|
family: "Yellowtail",
|
||||||
src: "url(https://fonts.gstatic.com/s/yellowtail/v8/GcIHC9QEwVkrA19LJU1qlPk_vArhqVIZ0nv9q090hN8.woff2)",
|
src: "url(https://fonts.gstatic.com/s/yellowtail/v8/GcIHC9QEwVkrA19LJU1qlPk_vArhqVIZ0nv9q090hN8.woff2)",
|
||||||
unicodeRange: "U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
unicodeRange:
|
||||||
|
"U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215"
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
"use strict";
|
import {tip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Cloud provider implementations (Dropbox only as now)
|
Cloud provider implementations (Dropbox only as now)
|
||||||
|
|
@ -13,7 +13,6 @@ async list(): list available filenames at provider
|
||||||
async getLink(filePath): get shareable link for file
|
async getLink(filePath): get shareable link for file
|
||||||
restore(): restore access tokens from storage if possible
|
restore(): restore access tokens from storage if possible
|
||||||
*/
|
*/
|
||||||
|
|
||||||
window.Cloud = (function () {
|
window.Cloud = (function () {
|
||||||
// helpers to use in providers for token handling
|
// helpers to use in providers for token handling
|
||||||
const lSKey = x => `auth-${x}`;
|
const lSKey = x => `auth-${x}`;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import {getGridPolygon} from "/src/utils/graphUtils";
|
import {getGridPolygon} from "/src/utils/graphUtils";
|
||||||
import {unique} from "/src/utils/arrayUtils";
|
import {unique} from "/src/utils/arrayUtils";
|
||||||
|
import {tip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
// download map as SVG
|
// download map as SVG
|
||||||
async function saveSVG() {
|
async function saveSVG() {
|
||||||
|
|
@ -10,12 +11,8 @@ async function saveSVG() {
|
||||||
link.href = url;
|
link.href = url;
|
||||||
link.click();
|
link.click();
|
||||||
|
|
||||||
tip(
|
const tooltip = `${link.download} is saved. Open "Downloads" screen (CTRL + J) to check. You can image scale in options`;
|
||||||
`${link.download} is saved. Open "Downloads" screen (crtl + J) to check. You can set image scale in options`,
|
tip(tooltip, true, "success", 5000);
|
||||||
true,
|
|
||||||
"success",
|
|
||||||
5000
|
|
||||||
);
|
|
||||||
TIME && console.timeEnd("saveSVG");
|
TIME && console.timeEnd("saveSVG");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import {restoreDefaultEvents} from "/src/scripts/events";
|
import {restoreDefaultEvents} from "/src/scripts/events";
|
||||||
import {calculateVoronoi, findCell} from "/src/utils/graphUtils";
|
import {calculateVoronoi, findCell} from "/src/utils/graphUtils";
|
||||||
import {last} from "/src/utils/arrayUtils";
|
import {last} from "/src/utils/arrayUtils";
|
||||||
|
import {tip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
function quickLoad() {
|
function quickLoad() {
|
||||||
ldb.get("lastMap", blob => {
|
ldb.get("lastMap", blob => {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
"use strict";
|
import {tip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
// functions to save project as .map file
|
// functions to save project as .map file
|
||||||
|
|
||||||
// prepare map data for saving
|
// prepare map data for saving
|
||||||
|
|
@ -122,7 +123,8 @@ function getMapData() {
|
||||||
|
|
||||||
// Download .map file
|
// Download .map file
|
||||||
function dowloadMap() {
|
function dowloadMap() {
|
||||||
if (customization) return tip("Map cannot be saved when edit mode is active, please exit the mode and retry", false, "error");
|
if (customization)
|
||||||
|
return tip("Map cannot be saved when edit mode is active, please exit the mode and retry", false, "error");
|
||||||
closeDialogs("#alert");
|
closeDialogs("#alert");
|
||||||
|
|
||||||
const mapData = getMapData();
|
const mapData = getMapData();
|
||||||
|
|
@ -137,7 +139,8 @@ function dowloadMap() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveToDropbox() {
|
async function saveToDropbox() {
|
||||||
if (customization) return tip("Map cannot be saved when edit mode is active, please exit the mode and retry", false, "error");
|
if (customization)
|
||||||
|
return tip("Map cannot be saved when edit mode is active, please exit the mode and retry", false, "error");
|
||||||
closeDialogs("#alert");
|
closeDialogs("#alert");
|
||||||
const mapData = getMapData();
|
const mapData = getMapData();
|
||||||
const filename = getFileName() + ".map";
|
const filename = getFileName() + ".map";
|
||||||
|
|
@ -151,7 +154,8 @@ async function saveToDropbox() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function quickSave() {
|
function quickSave() {
|
||||||
if (customization) return tip("Map cannot be saved when edit mode is active, please exit the mode and retry", false, "error");
|
if (customization)
|
||||||
|
return tip("Map cannot be saved when edit mode is active, please exit the mode and retry", false, "error");
|
||||||
|
|
||||||
const mapData = getMapData();
|
const mapData = getMapData();
|
||||||
const blob = new Blob([mapData], {type: "text/plain"});
|
const blob = new Blob([mapData], {type: "text/plain"});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import {last} from "/src/utils/arrayUtils";
|
import {last} from "/src/utils/arrayUtils";
|
||||||
import {locked} from "/src/scripts/options/lock";
|
import {locked} from "/src/scripts/options/lock";
|
||||||
|
import {tip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
window.Names = (function () {
|
window.Names = (function () {
|
||||||
let chains = [];
|
let chains = [];
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
"use strict";
|
import {tip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
window.ThreeD = (function () {
|
window.ThreeD = (function () {
|
||||||
const options = {
|
const options = {
|
||||||
|
|
@ -242,7 +242,11 @@ window.ThreeD = (function () {
|
||||||
context2d.fillStyle = color;
|
context2d.fillStyle = color;
|
||||||
context2d.fillText(text, 0, size * quality);
|
context2d.fillText(text, 0, size * quality);
|
||||||
|
|
||||||
return textureToSprite(context2d.canvas.toDataURL(), context2d.canvas.width / quality, context2d.canvas.height / quality);
|
return textureToSprite(
|
||||||
|
context2d.canvas.toDataURL(),
|
||||||
|
context2d.canvas.width / quality,
|
||||||
|
context2d.canvas.height / quality
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function get3dCoords(baseX, baseY) {
|
function get3dCoords(baseX, baseY) {
|
||||||
|
|
@ -297,8 +301,20 @@ window.ThreeD = (function () {
|
||||||
|
|
||||||
const city_icon_material = new THREE.MeshPhongMaterial({color: cityOptions.iconColor});
|
const city_icon_material = new THREE.MeshPhongMaterial({color: cityOptions.iconColor});
|
||||||
const town_icon_material = new THREE.MeshPhongMaterial({color: townOptions.iconColor});
|
const town_icon_material = new THREE.MeshPhongMaterial({color: townOptions.iconColor});
|
||||||
const city_icon_geometry = new THREE.CylinderGeometry(cityOptions.iconSize * 2, cityOptions.iconSize * 2, cityOptions.iconSize, 16, 1);
|
const city_icon_geometry = new THREE.CylinderGeometry(
|
||||||
const town_icon_geometry = new THREE.CylinderGeometry(townOptions.iconSize * 2, townOptions.iconSize * 2, townOptions.iconSize, 16, 1);
|
cityOptions.iconSize * 2,
|
||||||
|
cityOptions.iconSize * 2,
|
||||||
|
cityOptions.iconSize,
|
||||||
|
16,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
const town_icon_geometry = new THREE.CylinderGeometry(
|
||||||
|
townOptions.iconSize * 2,
|
||||||
|
townOptions.iconSize * 2,
|
||||||
|
townOptions.iconSize,
|
||||||
|
16,
|
||||||
|
1
|
||||||
|
);
|
||||||
const line_material = new THREE.LineBasicMaterial({color: cityOptions.iconColor});
|
const line_material = new THREE.LineBasicMaterial({color: cityOptions.iconColor});
|
||||||
|
|
||||||
// burg labels
|
// burg labels
|
||||||
|
|
@ -464,7 +480,10 @@ window.ThreeD = (function () {
|
||||||
|
|
||||||
// scene
|
// scene
|
||||||
scene = new THREE.Scene();
|
scene = new THREE.Scene();
|
||||||
scene.background = new THREE.TextureLoader().load("https://i0.wp.com/azgaar.files.wordpress.com/2019/10/stars-1.png", render);
|
scene.background = new THREE.TextureLoader().load(
|
||||||
|
"https://i0.wp.com/azgaar.files.wordpress.com/2019/10/stars-1.png",
|
||||||
|
render
|
||||||
|
);
|
||||||
|
|
||||||
// Renderer
|
// Renderer
|
||||||
Renderer = new THREE.WebGLRenderer({canvas, antialias: true, preserveDrawingBuffer: true});
|
Renderer = new THREE.WebGLRenderer({canvas, antialias: true, preserveDrawingBuffer: true});
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import {last} from "/src/utils/arrayUtils";
|
import {last} from "/src/utils/arrayUtils";
|
||||||
|
import {tip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
export class Battle {
|
export class Battle {
|
||||||
constructor(attacker, defender) {
|
constructor(attacker, defender) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import {restoreDefaultEvents} from "/src/scripts/events";
|
import {restoreDefaultEvents} from "/src/scripts/events";
|
||||||
import {findAll, findCell, getPackPolygon, isLand} from "/src/utils/graphUtils";
|
import {findAll, findCell, getPackPolygon, isLand} from "/src/utils/graphUtils";
|
||||||
import {showMainTip, clearMainTip} from "/src/scripts/tooltips";
|
import {tip, showMainTip, clearMainTip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
export function editBiomes() {
|
export function editBiomes() {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {findCell} from "/src/utils/graphUtils";
|
import {findCell} from "/src/utils/graphUtils";
|
||||||
import {clearMainTip} from "/src/scripts/tooltips";
|
import {tip, clearMainTip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
export function editBurg(id) {
|
export function editBurg(id) {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import {restoreDefaultEvents} from "/src/scripts/events";
|
import {restoreDefaultEvents} from "/src/scripts/events";
|
||||||
import {findCell} from "/src/utils/graphUtils";
|
import {findCell} from "/src/utils/graphUtils";
|
||||||
import {clearMainTip} from "/src/scripts/tooltips";
|
import {tip, clearMainTip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
export function overviewBurgs() {
|
export function overviewBurgs() {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import {getPackPolygon} from "/src/utils/graphUtils";
|
import {getPackPolygon} from "/src/utils/graphUtils";
|
||||||
|
import {tip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
export function editCoastline(node = d3.event.target) {
|
export function editCoastline(node = d3.event.target) {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import {restoreDefaultEvents} from "/src/scripts/events";
|
import {restoreDefaultEvents} from "/src/scripts/events";
|
||||||
import {findCell} from "/src/utils/graphUtils";
|
import {findCell} from "/src/utils/graphUtils";
|
||||||
import {clearMainTip} from "/src/scripts/tooltips";
|
import {tip, clearMainTip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
export function editDiplomacy() {
|
export function editDiplomacy() {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import {restoreDefaultEvents} from "/src/scripts/events";
|
import {restoreDefaultEvents} from "/src/scripts/events";
|
||||||
import {findCell} from "/src/utils/graphUtils";
|
import {findCell} from "/src/utils/graphUtils";
|
||||||
import {byId} from "/src/utils/shorthands";
|
import {byId} from "/src/utils/shorthands";
|
||||||
|
import {tip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
// clear elSelected variable
|
// clear elSelected variable
|
||||||
export function unselect() {
|
export function unselect() {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import {clearMainTip} from "/src/scripts/tooltips";
|
import {clearMainTip} from "/src/scripts/tooltips";
|
||||||
|
import {tip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
export function editEmblem(type, id, el) {
|
export function editEmblem(type, id, el) {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import {restoreDefaultEvents} from "/src/scripts/events";
|
import {restoreDefaultEvents} from "/src/scripts/events";
|
||||||
import {findGridCell, findGridAll, findCell, getPackPolygon, getGridPolygon} from "/src/utils/graphUtils";
|
import {findGridCell, findGridAll, findCell, getPackPolygon, getGridPolygon} from "/src/utils/graphUtils";
|
||||||
import {last, createTypedArray} from "/src/utils/arrayUtils";
|
import {last, createTypedArray} from "/src/utils/arrayUtils";
|
||||||
import {showMainTip, clearMainTip} from "/src/scripts/tooltips";
|
import {tip, showMainTip, clearMainTip} from "/src/scripts/tooltips";
|
||||||
import {byId} from "/src/utils/shorthands";
|
import {byId} from "/src/utils/shorthands";
|
||||||
|
|
||||||
export function editHeightmap(options) {
|
export function editHeightmap(options) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {findGridCell, getGridPolygon} from "/src/utils/graphUtils";
|
import {findGridCell, getGridPolygon} from "/src/utils/graphUtils";
|
||||||
import {clearMainTip} from "/src/scripts/tooltips";
|
import {tip, clearMainTip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
export function editIce() {
|
export function editIce() {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {findCell} from "/src/utils/graphUtils";
|
import {findCell} from "/src/utils/graphUtils";
|
||||||
import {showMainTip} from "/src/scripts/tooltips";
|
import {tip, showMainTip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
export function editLabel() {
|
export function editLabel() {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import {getPackPolygon} from "/src/utils/graphUtils";
|
import {getPackPolygon} from "/src/utils/graphUtils";
|
||||||
|
import {tip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
export function editLake() {
|
export function editLake() {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import {invokeActiveZooming} from "../activeZooming";
|
||||||
import {getGridPolygon} from "/src/utils/graphUtils";
|
import {getGridPolygon} from "/src/utils/graphUtils";
|
||||||
import {last} from "/src/utils/arrayUtils";
|
import {last} from "/src/utils/arrayUtils";
|
||||||
import {stored, store} from "/src/utils/shorthands";
|
import {stored, store} from "/src/utils/shorthands";
|
||||||
|
import {tip} from "/src/scripts/tooltips";
|
||||||
import {byId} from "/src/utils/shorthands";
|
import {byId} from "/src/utils/shorthands";
|
||||||
|
|
||||||
let presets = {};
|
let presets = {};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
"use strict";
|
import {tip} from "/src/scripts/tooltips";
|
||||||
function overviewMilitary() {
|
|
||||||
|
export function overviewMilitary() {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
closeDialogs("#militaryOverview, .stable");
|
closeDialogs("#militaryOverview, .stable");
|
||||||
if (!layerIsOn("toggleStates")) toggleStates();
|
if (!layerIsOn("toggleStates")) toggleStates();
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import {unique} from "/src/utils/arrayUtils";
|
import {unique} from "/src/utils/arrayUtils";
|
||||||
|
import {tip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
export function editNamesbase() {
|
export function editNamesbase() {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use strict";
|
import {tip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
function editNotes(id, name) {
|
export function editNotes(id, name) {
|
||||||
// elements
|
// elements
|
||||||
const notesLegend = document.getElementById("notesLegend");
|
const notesLegend = document.getElementById("notesLegend");
|
||||||
const notesName = document.getElementById("notesName");
|
const notesName = document.getElementById("notesName");
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import {applyOption} from "./general";
|
import {applyOption} from "./general";
|
||||||
import {last} from "/src/utils/arrayUtils";
|
import {last} from "/src/utils/arrayUtils";
|
||||||
import {lock, locked} from "/src/scripts/options/lock";
|
import {lock, locked} from "/src/scripts/options/lock";
|
||||||
import {clearMainTip} from "/src/scripts/tooltips";
|
import {tip, clearMainTip} from "/src/scripts/tooltips";
|
||||||
import {byId, stored} from "/src/utils/shorthands";
|
import {byId, stored} from "/src/utils/shorthands";
|
||||||
|
|
||||||
$("#optionsContainer").draggable({handle: ".drag-trigger", snap: "svg", snapMode: "both"});
|
$("#optionsContainer").draggable({handle: ".drag-trigger", snap: "svg", snapMode: "both"});
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import {restoreDefaultEvents} from "/src/scripts/events";
|
import {restoreDefaultEvents} from "/src/scripts/events";
|
||||||
import {findAll, findCell, getPackPolygon, isLand} from "/src/utils/graphUtils";
|
import {findAll, findCell, getPackPolygon, isLand} from "/src/utils/graphUtils";
|
||||||
import {unique} from "/src/utils/arrayUtils";
|
import {unique} from "/src/utils/arrayUtils";
|
||||||
import {showMainTip, clearMainTip} from "/src/scripts/tooltips";
|
import {tip, showMainTip, clearMainTip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
export function editProvinces() {
|
export function editProvinces() {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import {restoreDefaultEvents} from "/src/scripts/events";
|
import {restoreDefaultEvents} from "/src/scripts/events";
|
||||||
import {findCell} from "/src/utils/graphUtils";
|
import {findCell} from "/src/utils/graphUtils";
|
||||||
import {last} from "/src/utils/arrayUtils";
|
import {last} from "/src/utils/arrayUtils";
|
||||||
import {clearMainTip} from "/src/scripts/tooltips";
|
import {tip, clearMainTip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
export function editRegiment(selector) {
|
export function editRegiment(selector) {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import {findCell} from "/src/utils/graphUtils";
|
import {findCell} from "/src/utils/graphUtils";
|
||||||
import {last} from "/src/utils/arrayUtils";
|
import {last} from "/src/utils/arrayUtils";
|
||||||
import {clearMainTip} from "/src/scripts/tooltips";
|
import {tip, clearMainTip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
export function overviewRegiments(state) {
|
export function overviewRegiments(state) {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import {restoreDefaultEvents} from "/src/scripts/events";
|
import {restoreDefaultEvents} from "/src/scripts/events";
|
||||||
import {findCell} from "/src/utils/graphUtils";
|
import {findCell} from "/src/utils/graphUtils";
|
||||||
import {showMainTip, clearMainTip} from "/src/scripts/tooltips";
|
import {tip, showMainTip, clearMainTip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
export function editReliefIcon() {
|
export function editReliefIcon() {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import {restoreDefaultEvents} from "/src/scripts/events";
|
import {restoreDefaultEvents} from "/src/scripts/events";
|
||||||
import {getPackPolygon, findCell} from "/src/utils/graphUtils";
|
import {getPackPolygon, findCell} from "/src/utils/graphUtils";
|
||||||
import {last} from "/src/utils/arrayUtils";
|
import {last} from "/src/utils/arrayUtils";
|
||||||
import {clearMainTip} from "/src/scripts/tooltips";
|
import {tip, clearMainTip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
export function createRiver() {
|
export function createRiver() {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {findCell, getPackPolygon} from "/src/utils/graphUtils";
|
import {findCell, getPackPolygon} from "/src/utils/graphUtils";
|
||||||
import {clearMainTip} from "/src/scripts/tooltips";
|
import {tip, clearMainTip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
export function editRiver(id) {
|
export function editRiver(id) {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import {showMainTip, clearMainTip} from "/src/scripts/tooltips";
|
import {tip, showMainTip, clearMainTip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
export function editRoute(onClick) {
|
export function editRoute(onClick) {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
// UI module to control the style
|
import {tip} from "/src/scripts/tooltips";
|
||||||
"use strict";
|
|
||||||
|
|
||||||
// add available filters to lists
|
// add available filters to lists
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
"use strict";
|
import {tip} from "/src/scripts/tooltips";
|
||||||
// UI module to control the style presets
|
|
||||||
|
|
||||||
const systemPresets = [
|
const systemPresets = [
|
||||||
"default",
|
"default",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use strict";
|
import {tip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
function showBurgTemperatureGraph(id) {
|
export function showBurgTemperatureGraph(id) {
|
||||||
const b = pack.burgs[id];
|
const b = pack.burgs[id];
|
||||||
const lat = mapCoordinates.latN - (b.y / graphHeight) * mapCoordinates.latT;
|
const lat = mapCoordinates.latN - (b.y / graphHeight) * mapCoordinates.latT;
|
||||||
const burgTemp = grid.cells.temp[pack.cells.g[b.cell]];
|
const burgTemp = grid.cells.temp[pack.cells.g[b.cell]];
|
||||||
|
|
@ -48,7 +48,10 @@ function showBurgTemperatureGraph(id) {
|
||||||
// Standard deviation for average temperature for the year from [0, 1] to [min, max]
|
// Standard deviation for average temperature for the year from [0, 1] to [min, max]
|
||||||
const yearSig = lstOut[0] * 62.9466411977018 + 0.28613807855649165;
|
const yearSig = lstOut[0] * 62.9466411977018 + 0.28613807855649165;
|
||||||
// Standard deviation for the difference between the minimum and maximum temperatures for the year
|
// Standard deviation for the difference between the minimum and maximum temperatures for the year
|
||||||
const yearDelTmpSig = lstOut[1] * 13.541688670361175 + 0.1414213562373084 > yearSig ? yearSig : lstOut[1] * 13.541688670361175 + 0.1414213562373084;
|
const yearDelTmpSig =
|
||||||
|
lstOut[1] * 13.541688670361175 + 0.1414213562373084 > yearSig
|
||||||
|
? yearSig
|
||||||
|
: lstOut[1] * 13.541688670361175 + 0.1414213562373084;
|
||||||
// Expected value for the difference between the minimum and maximum temperatures for the year
|
// Expected value for the difference between the minimum and maximum temperatures for the year
|
||||||
const yearDelTmpMu = lstOut[2] * 15.266666666666667 + 0.6416666666666663;
|
const yearDelTmpMu = lstOut[2] * 15.266666666666667 + 0.6416666666666663;
|
||||||
|
|
||||||
|
|
@ -67,7 +70,20 @@ function showBurgTemperatureGraph(id) {
|
||||||
const year = new Date().getFullYear(); // use current year
|
const year = new Date().getFullYear(); // use current year
|
||||||
const startDate = new Date(year, 0, 1);
|
const startDate = new Date(year, 0, 1);
|
||||||
const endDate = new Date(year, 11, 31);
|
const endDate = new Date(year, 11, 31);
|
||||||
const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
const months = [
|
||||||
|
"January",
|
||||||
|
"February",
|
||||||
|
"March",
|
||||||
|
"April",
|
||||||
|
"May",
|
||||||
|
"June",
|
||||||
|
"July",
|
||||||
|
"August",
|
||||||
|
"September",
|
||||||
|
"October",
|
||||||
|
"November",
|
||||||
|
"December"
|
||||||
|
];
|
||||||
|
|
||||||
const xscale = d3.scaleTime().domain([startDate, endDate]).range([0, chartWidth]);
|
const xscale = d3.scaleTime().domain([startDate, endDate]).range([0, chartWidth]);
|
||||||
const yscale = d3.scaleLinear().domain([minT, maxT]).range([chartHeight, 0]);
|
const yscale = d3.scaleLinear().domain([minT, maxT]).range([chartHeight, 0]);
|
||||||
|
|
@ -91,7 +107,11 @@ function showBurgTemperatureGraph(id) {
|
||||||
});
|
});
|
||||||
|
|
||||||
drawGraph();
|
drawGraph();
|
||||||
$("#alert").dialog({title: "Annual temperature in " + b.name, width: "auto", position: {my: "center", at: "center", of: "svg"}});
|
$("#alert").dialog({
|
||||||
|
title: "Annual temperature in " + b.name,
|
||||||
|
width: "auto",
|
||||||
|
position: {my: "center", at: "center", of: "svg"}
|
||||||
|
});
|
||||||
|
|
||||||
function drawGraph() {
|
function drawGraph() {
|
||||||
alertMessage.innerHTML = "";
|
alertMessage.innerHTML = "";
|
||||||
|
|
@ -109,11 +129,26 @@ function showBurgTemperatureGraph(id) {
|
||||||
const legendX = n => (chartWidth * n) / 4;
|
const legendX = n => (chartWidth * n) / 4;
|
||||||
const legendTextX = n => legendX(n) + 10;
|
const legendTextX = n => legendX(n) + 10;
|
||||||
legend.append("circle").attr("cx", legendX(1)).attr("cy", legendY).attr("r", 4).style("fill", "red");
|
legend.append("circle").attr("cx", legendX(1)).attr("cy", legendY).attr("r", 4).style("fill", "red");
|
||||||
legend.append("text").attr("x", legendTextX(1)).attr("y", legendY).attr("alignment-baseline", "central").text("Day temperature");
|
legend
|
||||||
|
.append("text")
|
||||||
|
.attr("x", legendTextX(1))
|
||||||
|
.attr("y", legendY)
|
||||||
|
.attr("alignment-baseline", "central")
|
||||||
|
.text("Day temperature");
|
||||||
legend.append("circle").attr("cx", legendX(2)).attr("cy", legendY).attr("r", 4).style("fill", "orange");
|
legend.append("circle").attr("cx", legendX(2)).attr("cy", legendY).attr("r", 4).style("fill", "orange");
|
||||||
legend.append("text").attr("x", legendTextX(2)).attr("y", legendY).attr("alignment-baseline", "central").text("Mean temperature");
|
legend
|
||||||
|
.append("text")
|
||||||
|
.attr("x", legendTextX(2))
|
||||||
|
.attr("y", legendY)
|
||||||
|
.attr("alignment-baseline", "central")
|
||||||
|
.text("Mean temperature");
|
||||||
legend.append("circle").attr("cx", legendX(3)).attr("cy", legendY).attr("r", 4).style("fill", "blue");
|
legend.append("circle").attr("cx", legendX(3)).attr("cy", legendY).attr("r", 4).style("fill", "blue");
|
||||||
legend.append("text").attr("x", legendTextX(3)).attr("y", legendY).attr("alignment-baseline", "central").text("Night temperature");
|
legend
|
||||||
|
.append("text")
|
||||||
|
.attr("x", legendTextX(3))
|
||||||
|
.attr("y", legendY)
|
||||||
|
.attr("alignment-baseline", "central")
|
||||||
|
.text("Night temperature");
|
||||||
|
|
||||||
const xGrid = d3.axisBottom(xscale).ticks().tickSize(-chartHeight);
|
const xGrid = d3.axisBottom(xscale).ticks().tickSize(-chartHeight);
|
||||||
const yGrid = d3.axisLeft(yscale).ticks(5).tickSize(-chartWidth);
|
const yGrid = d3.axisLeft(yscale).ticks(5).tickSize(-chartWidth);
|
||||||
|
|
@ -146,9 +181,24 @@ function showBurgTemperatureGraph(id) {
|
||||||
axis.select("path.domain").attr("d", `M0.5,0.5 H${chartWidth + 0.5}`);
|
axis.select("path.domain").attr("d", `M0.5,0.5 H${chartWidth + 0.5}`);
|
||||||
|
|
||||||
const curves = chart.append("g").attr("fill", "none").style("stroke-width", 2.5);
|
const curves = chart.append("g").attr("fill", "none").style("stroke-width", 2.5);
|
||||||
curves.append("path").attr("d", getCurve(tempMean)).attr("data-type", "daily").attr("stroke", "orange").on("mousemove", printVal);
|
curves
|
||||||
curves.append("path").attr("d", getCurve(tempMin)).attr("data-type", "night").attr("stroke", "blue").on("mousemove", printVal);
|
.append("path")
|
||||||
curves.append("path").attr("d", getCurve(tempMax)).attr("data-type", "day").attr("stroke", "red").on("mousemove", printVal);
|
.attr("d", getCurve(tempMean))
|
||||||
|
.attr("data-type", "daily")
|
||||||
|
.attr("stroke", "orange")
|
||||||
|
.on("mousemove", printVal);
|
||||||
|
curves
|
||||||
|
.append("path")
|
||||||
|
.attr("d", getCurve(tempMin))
|
||||||
|
.attr("data-type", "night")
|
||||||
|
.attr("stroke", "blue")
|
||||||
|
.on("mousemove", printVal);
|
||||||
|
curves
|
||||||
|
.append("path")
|
||||||
|
.attr("d", getCurve(tempMax))
|
||||||
|
.attr("data-type", "day")
|
||||||
|
.attr("stroke", "red")
|
||||||
|
.on("mousemove", printVal);
|
||||||
|
|
||||||
function printVal() {
|
function printVal() {
|
||||||
const [x, y] = d3.mouse(this);
|
const [x, y] = d3.mouse(this);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import {restoreDefaultEvents} from "/src/scripts/events";
|
import {restoreDefaultEvents} from "/src/scripts/events";
|
||||||
import {findCell} from "/src/utils/graphUtils";
|
import {findCell} from "/src/utils/graphUtils";
|
||||||
import {last} from "/src/utils/arrayUtils";
|
import {last} from "/src/utils/arrayUtils";
|
||||||
import {clearMainTip} from "/src/scripts/tooltips";
|
import {tip, clearMainTip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
// module to control the Tools options (click to edit, to re-geenerate, tp add)
|
// module to control the Tools options (click to edit, to re-geenerate, tp add)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import {restoreDefaultEvents} from "/src/scripts/events";
|
import {restoreDefaultEvents} from "/src/scripts/events";
|
||||||
import {findCell} from "/src/utils/graphUtils";
|
import {findCell} from "/src/utils/graphUtils";
|
||||||
|
import {tip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
export function editUnits() {
|
export function editUnits() {
|
||||||
closeDialogs("#unitsEditor, .stable");
|
closeDialogs("#unitsEditor, .stable");
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
function editWorld() {
|
import {tip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
|
export function editWorld() {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
$("#worldConfigurator").dialog({
|
$("#worldConfigurator").dialog({
|
||||||
title: "Configure World",
|
title: "Configure World",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import {restoreDefaultEvents} from "/src/scripts/events";
|
import {restoreDefaultEvents} from "/src/scripts/events";
|
||||||
import {findAll, findCell, getPackPolygon} from "/src/utils/graphUtils";
|
import {findAll, findCell, getPackPolygon} from "/src/utils/graphUtils";
|
||||||
import {unique} from "/src/utils/arrayUtils";
|
import {unique} from "/src/utils/arrayUtils";
|
||||||
import {showMainTip, clearMainTip} from "/src/scripts/tooltips";
|
import {tip, showMainTip, clearMainTip} from "/src/scripts/tooltips";
|
||||||
|
|
||||||
export function editZones() {
|
export function editZones() {
|
||||||
closeDialogs();
|
closeDialogs();
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,8 @@ import {Rulers, Ruler, drawScaleBar} from "./modules/measurers";
|
||||||
import {byId} from "./utils/shorthands";
|
import {byId} from "./utils/shorthands";
|
||||||
import {addGlobalListeners} from "./scripts/listeners";
|
import {addGlobalListeners} from "./scripts/listeners";
|
||||||
import {restoreDefaultEvents} from "./scripts/events";
|
import {restoreDefaultEvents} from "./scripts/events";
|
||||||
import {clearMainTip} from "./scripts/tooltips";
|
import {clearMainTip, tip} from "./scripts/tooltips";
|
||||||
|
import {clearLegend} from "./modules/legend";
|
||||||
import "./components";
|
import "./components";
|
||||||
|
|
||||||
addGlobalListeners();
|
addGlobalListeners();
|
||||||
|
|
@ -61,6 +62,10 @@ svgWidth = graphWidth;
|
||||||
svgHeight = graphHeight;
|
svgHeight = graphHeight;
|
||||||
|
|
||||||
defineSvg(graphWidth, graphHeight);
|
defineSvg(graphWidth, graphHeight);
|
||||||
|
scaleBar.on("mousemove", () => tip("Click to open Units Editor")).on("click", () => editUnits());
|
||||||
|
legend
|
||||||
|
.on("mousemove", () => tip("Drag to change the position. Click to hide the legend"))
|
||||||
|
.on("click", () => clearLegend());
|
||||||
|
|
||||||
document.on("DOMContentLoaded", async () => {
|
document.on("DOMContentLoaded", async () => {
|
||||||
if (!location.hostname) {
|
if (!location.hostname) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import {dragLegendBox} from "../modules/legend";
|
import {dragLegendBox} from "../modules/legend";
|
||||||
import {findCell, findGridCell} from "../utils/graphUtils";
|
import {findCell, findGridCell} from "../utils/graphUtils";
|
||||||
import {showMainTip} from "./tooltips";
|
import {tip, showMainTip} from "./tooltips";
|
||||||
|
|
||||||
export function restoreDefaultEvents() {
|
export function restoreDefaultEvents() {
|
||||||
Zoom.setZoomBehavior();
|
Zoom.setZoomBehavior();
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import {store} from "../../utils/shorthands";
|
import {store} from "../../utils/shorthands";
|
||||||
|
import {tip} from "../tooltips";
|
||||||
|
|
||||||
export function assignLockBehavior() {
|
export function assignLockBehavior() {
|
||||||
const $lockable = document.querySelectorAll("[data-locked]");
|
const $lockable = document.querySelectorAll("[data-locked]");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue