mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-03-23 07:37:24 +01:00
feat: synchronize label data model with burg name and position updates
This commit is contained in:
parent
471e865c5e
commit
ca6d01f4be
1 changed files with 7 additions and 0 deletions
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue