Skip to content

Commit

Permalink
Merge pull request #655 from eea/CLMS-2806-Use-Swipe-Widget-navigate-…
Browse files Browse the repository at this point in the history
…to-other-section-and-come-back

CLMS-2806 (Bug): Fixed bug
  • Loading branch information
Urkorue committed Nov 20, 2023
2 parents f45d4bf + bbd5bd3 commit 1686fcd
Showing 1 changed file with 48 additions and 44 deletions.
92 changes: 48 additions & 44 deletions src/components/MapViewer/SwipeWidget.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ class SwipeWidget extends React.Component {
this.map.layers.on('change', () => {
if (this.hasSwipe) {
this.map.layers.removeAll();
if (this.swipe.leadingLayers.items[0]) {
if (this.swipe.leadingLayers && this.swipe.leadingLayers.items[0]) {
this.map.layers.add(this.swipe.leadingLayers.items[0]);
}
if (this.swipe.trailingLayers.items[0]) {
if (this.swipe.trailingLayers && this.swipe.trailingLayers.items[0]) {
this.map.layers.add(this.swipe.trailingLayers.items[0]);
}
}
Expand Down Expand Up @@ -162,49 +162,53 @@ class SwipeWidget extends React.Component {
layerId = this.layers['pa_filter'].id;
}
}
if (
this.swipe.leadingLayers &&
this.swipe.leadingLayers.items[0] &&
this.swipe.leadingLayers.items[0].id === layerId
) {
selectLeadingLayer.options.add(
new Option(
this.getLayerTitle(this.layers[layer]),
layerId,
true,
true,
),
);
} else {
selectLeadingLayer.options.add(
new Option(
this.getLayerTitle(this.layers[layer]),
layerId,
false,
),
);
if (selectLeadingLayer) {
if (
this.swipe.leadingLayers &&
this.swipe.leadingLayers.items[0] &&
this.swipe.leadingLayers.items[0].id === layerId
) {
selectLeadingLayer.options.add(
new Option(
this.getLayerTitle(this.layers[layer]),
layerId,
true,
true,
),
);
} else {
selectLeadingLayer.options.add(
new Option(
this.getLayerTitle(this.layers[layer]),
layerId,
false,
),
);
}
}
if (
this.swipe.trailingLayers &&
this.swipe.trailingLayers.items[0] &&
this.swipe.trailingLayers.items[0].id === layerId
) {
selectTrailingLayer.options.add(
new Option(
this.getLayerTitle(this.layers[layer]),
layerId,
true,
true,
),
);
} else {
selectTrailingLayer.options.add(
new Option(
this.getLayerTitle(this.layers[layer]),
layerId,
false,
),
);
if (selectTrailingLayer) {
if (
this.swipe.trailingLayers &&
this.swipe.trailingLayers.items[0] &&
this.swipe.trailingLayers.items[0].id === layerId
) {
selectTrailingLayer.options.add(
new Option(
this.getLayerTitle(this.layers[layer]),
layerId,
true,
true,
),
);
} else {
selectTrailingLayer.options.add(
new Option(
this.getLayerTitle(this.layers[layer]),
layerId,
false,
),
);
}
}
}
});
Expand Down

0 comments on commit 1686fcd

Please sign in to comment.