forked from MapComplete/MapComplete
Use OSM-settings to keep track of the chosen license; change tree marker to circle (fix #24)
This commit is contained in:
parent
b2704d0ab8
commit
b1775d8184
15 changed files with 83 additions and 57 deletions
30
index.ts
30
index.ts
|
@ -67,6 +67,7 @@ const leftMessage = new UIEventSource<() => UIElement>(undefined);
|
|||
|
||||
const selectedElement = new UIEventSource<any>(undefined);
|
||||
|
||||
const preferedPictureLicense = new UIEventSource<string>(undefined);
|
||||
|
||||
const locationControl = new UIEventSource<{ lat: number, lon: number, zoom: number }>({
|
||||
zoom: questSetToRender.startzoom,
|
||||
|
@ -101,6 +102,21 @@ const bm = new Basemap("leafletDiv", locationControl, new VariableUiElement(
|
|||
));
|
||||
|
||||
|
||||
// ------------- Tie together user settings and UI -----------
|
||||
|
||||
|
||||
const picturesPrefName = "mapcomplete-pictures-license";
|
||||
preferedPictureLicense.addCallback((license) => {
|
||||
osmConnection.SetPreference(picturesPrefName, license);
|
||||
});
|
||||
|
||||
osmConnection.preferences.addCallback((prefs) => {
|
||||
if (prefs[picturesPrefName] !== undefined) {
|
||||
preferedPictureLicense.setData(prefs[picturesPrefName]);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// ------------- Setup the layers -------------------------------
|
||||
|
||||
const addButtons: {
|
||||
|
@ -122,7 +138,8 @@ for (const layer of questSetToRender.layers) {
|
|||
layer.elementsToShow,
|
||||
layer.questions,
|
||||
changes,
|
||||
osmConnection.userDetails
|
||||
osmConnection.userDetails,
|
||||
preferedPictureLicense
|
||||
)
|
||||
};
|
||||
|
||||
|
@ -145,12 +162,6 @@ const layerUpdater = new LayerUpdater(bm, questSetToRender.startzoom, flayers);
|
|||
// ------------------ Setup various UI elements ------------
|
||||
|
||||
|
||||
/*
|
||||
const addButton = new AddButton(bm, changes, addButtons);
|
||||
addButton.AttachTo("bottomRight");
|
||||
addButton.Update();*/
|
||||
|
||||
|
||||
new StrayClickHandler(bm, selectedElement, leftMessage, () => {
|
||||
return new SimpleAddUI(bm.Location,
|
||||
bm.LastClickLocation,
|
||||
|
@ -178,13 +189,12 @@ selectedElement.addCallback((data) => {
|
|||
layer.elementsToShow,
|
||||
layer.questions,
|
||||
changes,
|
||||
osmConnection.userDetails
|
||||
osmConnection.userDetails,
|
||||
preferedPictureLicense
|
||||
));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue