Skip to content

Commit

Permalink
Merge pull request #32 from origo-map/disableOnClose
Browse files Browse the repository at this point in the history
Option to disable control on close
  • Loading branch information
jokd authored Oct 18, 2023
2 parents 0d0d2ae + 0e6fc29 commit 23f4d5c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/multiselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const Multiselect = function Multiselect(options = {}) {
function toggleMultiselection() {
const detail = {
name: 'multiselection',
disableOnClose: true,
active: !isActive
};
viewer.dispatch('toggleClickInteraction', detail);
Expand Down Expand Up @@ -737,7 +738,8 @@ const Multiselect = function Multiselect(options = {}) {
// Featureinfo in two steps. Concat serverside and clientside when serverside is finished
const pixel = evt.pixel;
const coordinate = evt.coordinate;
const layers = viewer.getQueryableLayers(true);
const queryableLayers = viewer.getQueryableLayers(true);
const layers = queryableLayers.filter((layer) => !shouldSkipLayer(layer));
const clientResult = Origo.getFeatureInfo.getFeaturesAtPixel({
coordinate,
map,
Expand Down Expand Up @@ -820,7 +822,8 @@ const Multiselect = function Multiselect(options = {}) {
// Featurinfo in two steps. Concat serverside and clientside when serverside is finished
const pixel = evt.pixel;
const coordinate = evt.coordinate;
const layers = viewer.getQueryableLayers(true);
const queryableLayers = viewer.getQueryableLayers(true);
const layers = queryableLayers.filter((layer) => !shouldSkipLayer(layer));
const clientResult = Origo.getFeatureInfo.getFeaturesAtPixel({
coordinate,
map,
Expand Down Expand Up @@ -1140,6 +1143,8 @@ const Multiselect = function Multiselect(options = {}) {
viewer.on('toggleClickInteraction', (detail) => {
if (detail.name === 'multiselection' && detail.active) {
enableInteraction();
} else if (detail.name === 'multiselection' && detail.active === false && detail.disableOnClose !== true) {
// DO NOTHING!
} else {
disableInteraction();
}
Expand Down

0 comments on commit 23f4d5c

Please sign in to comment.