Skip to content

Commit

Permalink
Update featureinfo.js
Browse files Browse the repository at this point in the history
  • Loading branch information
jokd committed Dec 2, 2024
1 parent 7c26491 commit a6145cc
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/featureinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ const Featureinfo = function Featureinfo(options = {}) {
component.dispatch('changeselection', item);
}
};

Check failure on line 153 in src/featureinfo.js

View workflow job for this annotation

GitHub Actions / lint

Trailing spaces not allowed
const dispatchItemAdded = function dispatchItemAdded(item) {
// Make sure it actually is a SelectedItem. At least Search can call render() without creating proper selectedItems when
// search result is remote.
if (item instanceof SelectedItem) {
component.dispatch('itemadded', item);
}
};

const dispatchToggleFeatureEvent = function dispatchToggleFeatureEvent(currentItem) {
const toggleFeatureinfo = new CustomEvent('toggleFeatureinfo', {
Expand Down Expand Up @@ -337,7 +345,6 @@ const Featureinfo = function Featureinfo(options = {}) {
} else {
contentDiv.innerHTML = item.content;
}
component.dispatch('itemadded', item);
});
popup.setVisibility(true);
initCarousel('#o-identify-carousel');
Expand Down Expand Up @@ -410,7 +417,6 @@ const Featureinfo = function Featureinfo(options = {}) {
} else {
contentDiv.innerHTML = item.content;
}
component.dispatch('itemadded', item);
});
sidebar.setVisibility(true);
const firstFeature = items[0].feature;
Expand All @@ -434,7 +440,6 @@ const Featureinfo = function Featureinfo(options = {}) {
} else if (items.length > 1) {
selectionManager.addItems(items);
}
items.forEach((item) => component.dispatch('itemadded', item));
break;
}
default:
Expand All @@ -447,6 +452,10 @@ const Featureinfo = function Featureinfo(options = {}) {
for (let i = 0; i < modalLinks.length; i += 1) {
addLinkListener(modalLinks[i]);
}

Check failure on line 455 in src/featureinfo.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected tab character

Check failure on line 455 in src/featureinfo.js

View workflow job for this annotation

GitHub Actions / lint

Trailing spaces not allowed
// Dispatch itemadded event for every item added
items.forEach((item) => dispatchItemAdded(item));

Check failure on line 458 in src/featureinfo.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected tab character

Check failure on line 458 in src/featureinfo.js

View workflow job for this annotation

GitHub Actions / lint

Trailing spaces not allowed
// Don't send event for infowindow. Infowindow will send an event that triggers sending the event later.
if (target === 'overlay' || target === 'sidebar') {
dispatchToggleFeatureEvent(items[0]);
Expand Down

0 comments on commit a6145cc

Please sign in to comment.