Add feature to the featureInfoBox so that geometry is available there as well

This commit is contained in:
Pieter Vander Vennet 2020-07-22 01:07:32 +02:00
parent 1373bd106e
commit 8268c0d054
7 changed files with 39 additions and 18 deletions

View file

@ -118,7 +118,8 @@ const secondsTillChangesAreSaved = new UIEventSource<number>(0);
// This message is shown full screen on mobile devices
const fullScreenMessage = new UIEventSource<UIElement>(undefined);
const selectedElement = new UIEventSource<any>(undefined);
// The latest element that was selected - used to generate the right UI at the right place
const selectedElement = new UIEventSource<{feature: any}>(undefined);
const locationControl = new UIEventSource<{ lat: number, lon: number, zoom: number }>({
@ -179,9 +180,10 @@ let minZoom = 0;
for (const layer of layoutToUse.layers) {
const generateInfo = (tagsES) => {
const generateInfo = (tagsES, feature) => {
return new FeatureInfoBox(
feature,
tagsES,
layer.title,
layer.elementsToShow,
@ -229,7 +231,8 @@ new StrayClickHandler(bm, selectedElement, fullScreenMessage, () => {
/**
* Show the questions and information for the selected element on the fullScreen
*/
selectedElement.addCallback((data) => {
selectedElement.addCallback((feature) => {
const data = feature.feature.properties;
// Which is the applicable set?
for (const layer of layoutToUse.layers) {
@ -238,6 +241,7 @@ selectedElement.addCallback((data) => {
// This layer is the layer that gives the questions
const featureBox = new FeatureInfoBox(
feature.feature,
allElements.getElement(data.id),
layer.title,
layer.elementsToShow,