From 929d85a33551ffc5ac2d30c69937d536dbc6e72a Mon Sep 17 00:00:00 2001 From: Azgaar Date: Thu, 12 May 2022 23:54:19 +0300 Subject: [PATCH] slightly optimize onZoom --- modules/burgs-and-states.js | 13 ------------- modules/ui/burg-editor.js | 2 +- modules/ui/coastline-editor.js | 5 +---- modules/ui/labels-editor.js | 1 + modules/ui/lakes-editor.js | 5 +---- 5 files changed, 4 insertions(+), 22 deletions(-) diff --git a/modules/burgs-and-states.js b/modules/burgs-and-states.js index 1c8426e3..cccd8230 100644 --- a/modules/burgs-and-states.js +++ b/modules/burgs-and-states.js @@ -792,19 +792,6 @@ window.BurgsAndStates = (function () { .sort((a, b) => a.start - b.start); }; - const wars = {War: 6, Conflict: 2, Campaign: 4, Invasion: 2, Rebellion: 2, Conquest: 2, Intervention: 1, Expedition: 1, Crusade: 1}; - const generateCampaign = state => { - const neighbors = state.neighbors.length ? state.neighbors : [0]; - return neighbors - .map(i => { - const name = i && P(0.8) ? pack.states[i].name : Names.getCultureShort(state.culture); - const start = gauss(options.year - 100, 150, 1, options.year - 6); - const end = start + gauss(4, 5, 1, options.year - start - 1); - return {name: getAdjective(name) + " " + rw(wars), start, end}; - }) - .sort((a, b) => a.start - b.start); - }; - // generate historical conflicts of each state const generateCampaigns = function () { pack.states.forEach(s => { diff --git a/modules/ui/burg-editor.js b/modules/ui/burg-editor.js index 3d6e6418..e7714ec3 100644 --- a/modules/ui/burg-editor.js +++ b/modules/ui/burg-editor.js @@ -383,7 +383,7 @@ function editBurg(id) { $(this).dialog("close"); } } - } + }); } function changeName() { diff --git a/modules/ui/coastline-editor.js b/modules/ui/coastline-editor.js index 62e694d8..c77947d3 100644 --- a/modules/ui/coastline-editor.js +++ b/modules/ui/coastline-editor.js @@ -203,10 +203,7 @@ function editCoastline(node = d3.event.target) { $(this).dialog("close"); } } - groupEl.remove(); - document.getElementById('coastlineGroup').selectedOptions[0].remove(); - document.getElementById('coastlineGroup').value = 'sea_island'; - }; + }); confirmationDialog({title: 'Remove coastline group', message, confirm: 'Remove', onConfirm}); } diff --git a/modules/ui/labels-editor.js b/modules/ui/labels-editor.js index 33a0ab3b..069303c2 100644 --- a/modules/ui/labels-editor.js +++ b/modules/ui/labels-editor.js @@ -401,3 +401,4 @@ function editLabel() { unselect(); } } +} \ No newline at end of file diff --git a/modules/ui/lakes-editor.js b/modules/ui/lakes-editor.js index 8fb2e720..55b2db0d 100644 --- a/modules/ui/lakes-editor.js +++ b/modules/ui/lakes-editor.js @@ -235,10 +235,7 @@ function editLake() { $(this).dialog("close"); } } - groupEl.remove(); - document.getElementById('lakeGroup').selectedOptions[0].remove(); - document.getElementById('lakeGroup').value = 'freshwater'; - }; + }); confirmationDialog({title: 'Remove lake group', message, confirm: 'Remove', onConfirm}); }