feat: synchronize label data model with burg name and position updates

This commit is contained in:
StempunkDev 2026-02-16 19:59:29 +01:00
parent 471e865c5e
commit ca6d01f4be

View file

@ -118,6 +118,9 @@ function editBurg(id) {
const id = +elSelected.attr("data-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});
}
function generateNameRandom() {
@ -382,6 +385,10 @@ function editBurg(id) {
burg.y = y;
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});
if (d3.event.shiftKey === false) toggleRelocateBurg();
}