mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-03-24 08:07:23 +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");
|
const id = +elSelected.attr("data-id");
|
||||||
pack.burgs[id].name = burgName.value;
|
pack.burgs[id].name = burgName.value;
|
||||||
elSelected.text(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() {
|
function generateNameRandom() {
|
||||||
|
|
@ -382,6 +385,10 @@ function editBurg(id) {
|
||||||
burg.y = y;
|
burg.y = y;
|
||||||
if (burg.capital) pack.states[newState].center = burg.cell;
|
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();
|
if (d3.event.shiftKey === false) toggleRelocateBurg();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue