Use getProperties instead of undocumented var

This commit is contained in:
Chandler Swift 2024-02-02 03:25:22 -06:00
parent 2242863fdd
commit d96415b1c5
Signed by: chandlerswift
GPG key ID: A851D929D52FB93F
2 changed files with 5 additions and 5 deletions

View file

@ -38,23 +38,23 @@ for (let [state, url] of Object.entries(allStates)) {
return new Style({ return new Style({
image: new Icon({ image: new Icon({
anchor: [0.5, 1], anchor: [0.5, 1],
src: feature.values_.views[0].hasVideo ? pinVideo : pin, src: feature.getProperties().views[0].hasVideo ? pinVideo : pin,
}), }),
}); });
}, },
}); });
vectorLayer.customPopup = function(feature) { vectorLayer.customPopup = function(feature) {
const view = feature.values_.views[0]; const view = feature.getProperties().views[0];
if (view.hasVideo) { if (view.hasVideo) {
return `<p>${feature.values_.name}</p><video style="max-width: 80vw; max-height: 80vh;" id="popupVideo" autoplay controls></video>`; return `<p>${feature.getProperties().name}</p><video style="max-width: 80vw; max-height: 80vh;" id="popupVideo" autoplay controls></video>`;
} else { } else {
return `<img style="max-width: 80vw; max-height: 80vh;" src="${view.src}">`; return `<img style="max-width: 80vw; max-height: 80vh;" src="${view.src}">`;
} }
}; };
vectorLayer.customPopupCallback = function(feature) { vectorLayer.customPopupCallback = function(feature) {
const view = feature.values_.views[0]; const view = feature.getProperties().views[0];
if (view.hasVideo) { if (view.hasVideo) {
const video = document.getElementById('popupVideo'); const video = document.getElementById('popupVideo');

View file

@ -141,7 +141,7 @@ map.on('click', function (evt) {
} }
} else { } else {
// exclude geometry -- https://stackoverflow.com/a/208106 // exclude geometry -- https://stackoverflow.com/a/208106
const {geometry: _, ...featureData} = feature.values_; const {geometry: _, ...featureData} = feature.getProperties();
content.innerHTML = objectToTable(featureData); content.innerHTML = objectToTable(featureData);
} }