remove getBurgLabel from labels.ts

This commit is contained in:
StempunkDev 2026-03-27 20:59:10 +01:00
parent baeab354b6
commit 5d90b663c4
2 changed files with 8 additions and 14 deletions

View file

@ -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();
}