mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-04-07 16:06:05 +02:00
remove getBurgLabel from labels.ts
This commit is contained in:
parent
baeab354b6
commit
5d90b663c4
2 changed files with 8 additions and 14 deletions
|
|
@ -15,7 +15,7 @@ function editBurg(id) {
|
||||||
title: "Edit Burg",
|
title: "Edit Burg",
|
||||||
resizable: false,
|
resizable: false,
|
||||||
close: closeBurgEditor,
|
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;
|
if (modules.editBurg) return;
|
||||||
|
|
@ -51,7 +51,7 @@ function editBurg(id) {
|
||||||
|
|
||||||
function updateGroupsList() {
|
function updateGroupsList() {
|
||||||
byId("burgGroup").options.length = 0; // remove all options
|
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));
|
byId("burgGroup").options.add(new Option(name, name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -119,8 +119,8 @@ function editBurg(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
|
// Sync to Labels data model
|
||||||
const labelData = Labels.getBurgLabel(id);
|
const labelData = Labels.get(id);
|
||||||
if (labelData) Labels.updateLabel(labelData.i, {text: burgName.value});
|
if (labelData) Labels.updateLabel(labelData.i, { text: burgName.value });
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateNameRandom() {
|
function generateNameRandom() {
|
||||||
|
|
@ -202,7 +202,7 @@ function editBurg(id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleCapital(burgId) {
|
function toggleCapital(burgId) {
|
||||||
const {burgs, states} = pack;
|
const { burgs, states } = pack;
|
||||||
|
|
||||||
if (burgs[burgId].capital)
|
if (burgs[burgId].capital)
|
||||||
return tip("To change capital please assign a capital status to another burg of this state", false, "error");
|
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(
|
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",
|
"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 => {
|
link => {
|
||||||
if (link) burg.link = link;
|
if (link) burg.link = link;
|
||||||
else delete burg.link;
|
else delete burg.link;
|
||||||
|
|
@ -386,8 +386,8 @@ function editBurg(id) {
|
||||||
if (burg.capital) pack.states[newState].center = burg.cell;
|
if (burg.capital) pack.states[newState].center = burg.cell;
|
||||||
|
|
||||||
// Sync position to Labels data model
|
// Sync position to Labels data model
|
||||||
const labelData = Labels.getBurgLabel(id);
|
const labelData = Labels.get(id);
|
||||||
if (labelData) Labels.updateLabel(labelData.i, {x, y});
|
if (labelData) Labels.updateLabel(labelData.i, { x, y });
|
||||||
|
|
||||||
if (d3.event.shiftKey === false) toggleRelocateBurg();
|
if (d3.event.shiftKey === false) toggleRelocateBurg();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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, "i" | "type">): StateLabelData {
|
addStateLabel(data: Omit<StateLabelData, "i" | "type">): StateLabelData {
|
||||||
const label: StateLabelData = {
|
const label: StateLabelData = {
|
||||||
i: this.getNextId(),
|
i: this.getNextId(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue