diff --git a/public/modules/ui/burg-editor.js b/public/modules/ui/burg-editor.js index 3cdfa3fd..d75ca9ad 100644 --- a/public/modules/ui/burg-editor.js +++ b/public/modules/ui/burg-editor.js @@ -15,7 +15,7 @@ function editBurg(id) { title: "Edit Burg", resizable: false, close: closeBurgEditor, - position: {my: "left top", at: "left+10 top+10", of: "svg", collision: "fit"} + position: { my: "left top", at: "left+10 top+10", of: "svg", collision: "fit" } }); if (modules.editBurg) return; @@ -51,7 +51,7 @@ function editBurg(id) { function updateGroupsList() { byId("burgGroup").options.length = 0; // remove all options - for (const {name} of options.burgs.groups) { + for (const { name } of options.burgs.groups) { byId("burgGroup").options.add(new Option(name, name)); } } @@ -119,8 +119,8 @@ function editBurg(id) { pack.burgs[id].name = burgName.value; elSelected.text(burgName.value); // Sync to Labels data model - const labelData = Labels.getBurgLabel(id); - if (labelData) Labels.updateLabel(labelData.i, {text: burgName.value}); + const labelData = Labels.get(id); + if (labelData) Labels.updateLabel(labelData.i, { text: burgName.value }); } function generateNameRandom() { @@ -202,7 +202,7 @@ function editBurg(id) { } function toggleCapital(burgId) { - const {burgs, states} = pack; + const { burgs, states } = pack; if (burgs[burgId].capital) return tip("To change capital please assign a capital status to another burg of this state", false, "error"); @@ -302,7 +302,7 @@ function editBurg(id) { prompt( "Provide custom URL to the burg map. It can be a link to a generator or just an image. Leave empty to use the default map preview", - {default: Burgs.getPreview(burg).link, required: false}, + { default: Burgs.getPreview(burg).link, required: false }, link => { if (link) burg.link = link; else delete burg.link; @@ -386,8 +386,8 @@ function editBurg(id) { if (burg.capital) pack.states[newState].center = burg.cell; // Sync position to Labels data model - const labelData = Labels.getBurgLabel(id); - if (labelData) Labels.updateLabel(labelData.i, {x, y}); + const labelData = Labels.get(id); + if (labelData) Labels.updateLabel(labelData.i, { x, y }); if (d3.event.shiftKey === false) toggleRelocateBurg(); } diff --git a/src/modules/labels.ts b/src/modules/labels.ts index 20268ea3..e8abd262 100644 --- a/src/modules/labels.ts +++ b/src/modules/labels.ts @@ -66,12 +66,6 @@ class LabelsModule { ); } - getBurgLabel(burgId: number): BurgLabelData | undefined { - return pack.labels.find((l) => l.type === "burg" && l.burgId === burgId) as - | BurgLabelData - | undefined; - } - addStateLabel(data: Omit): StateLabelData { const label: StateLabelData = { i: this.getNextId(),