Fix rendering of multianswers, other small bug fixes

This commit is contained in:
Pieter Vander Vennet 2021-03-13 17:25:44 +01:00
parent 46254434db
commit ad08a55517
13 changed files with 68 additions and 62 deletions

View file

@ -1,5 +1,4 @@
import {UIEventSource} from "../UIEventSource";
import {UIElement} from "../../UI/UIElement";
import FeatureSource from "../FeatureSource/FeatureSource";
/**
@ -18,9 +17,7 @@ export default class SelectedFeatureHandler {
this._featureSource = featureSource;
const self = this;
hash.addCallback(h => {
console.log("SelectedFeatureHandler: hash is now ", h)
if (h === undefined || h === "") {
console.log("Deselecting...")
selectedFeature.setData(undefined);
}else{
self.selectFeature();
@ -30,7 +27,10 @@ export default class SelectedFeatureHandler {
featureSource.features.addCallback(_ => self.selectFeature());
selectedFeature.addCallback(feature => {
hash.setData(feature?.properties?.id ?? "");
const h = feature?.properties?.id;
if(h !== undefined){
hash.setData(h)
}
})
this.selectFeature();
@ -51,7 +51,6 @@ export default class SelectedFeatureHandler {
if(hash === undefined || hash === "" || hash === "#"){
return;
}
console.log("Selecting a feature from the hash...")
for (const feature of features) {
const id = feature.feature?.properties?.id;
if(id === hash){

View file

@ -125,7 +125,7 @@ export default class MetaTagging {
tags["_isOpen:oldvalue"] = tags.opening_hours
window.setTimeout(
() => {
console.log("Updating the _isOpen tag for ", tags.id);
console.log("Updating the _isOpen tag for ", tags.id, ", it's timer expired after", timeout);
updateTags();
},
timeout

View file

@ -43,16 +43,14 @@ export default class Hash {
window.onhashchange = () => {
let newValue = window.location.hash.substr(1);
console.log("The hash is now:", newValue)
if (newValue === "") {
newValue = undefined;
}
hash.setData(newValue)
}
window.addEventListener('popstate', e => {
window.addEventListener('popstate', _ => {
let newValue = window.location.hash.substr(1);
console.log("Popstate: the hash is now:", newValue)
if (newValue === "") {
newValue = undefined;
}