Skip to content

Commit

Permalink
geosolutions-it#8397: Fix - 3D mode remains enabled on other map (geo…
Browse files Browse the repository at this point in the history
dsuren1 authored Aug 23, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 74650f6 commit dd617cc
Showing 2 changed files with 62 additions and 2 deletions.
59 changes: 59 additions & 0 deletions web/client/epics/__tests__/queryparam-test.js
Original file line number Diff line number Diff line change
@@ -666,6 +666,65 @@ describe('queryparam epics', () => {
}
}, state);
});
it('do not switch map type to cesium if cesium viewer options are present only in map state', (done) => {
const state = {
maptype: {
mapType: 'openlayers'
},
router: {
location: {
search: "?center=-74.2,40.7&zoom=16.5"
}
},
map: {
present: {
viewerOptions: {
heading: '0.1',
pitch: '-0.7',
roll: '6.2'
}
}
}
};
const NUMBER_OF_ACTIONS = 1;
testEpic(addTimeoutEpic(readQueryParamsOnMapEpic, 10), NUMBER_OF_ACTIONS, [
onLocationChanged({}),
initMap(true)
], (actions) => {
expect(actions.length).toBe(NUMBER_OF_ACTIONS);
try {
expect(actions[0].type).toBe(TEST_TIMEOUT);
done();
} catch (e) {
done(e);
}
}, state);
});
it('retain map type if cesium viewer options is not present query params', (done) => {
const state = {
maptype: {
mapType: 'cesium'
},
router: {
location: {
search: "?center=-74.2,40.7&zoom=16.5"
}
}
};
const NUMBER_OF_ACTIONS = 1;
testEpic(addTimeoutEpic(readQueryParamsOnMapEpic, 10), NUMBER_OF_ACTIONS, [
onLocationChanged({}),
initMap(true)
], (actions) => {
expect(actions.length).toBe(NUMBER_OF_ACTIONS);
try {
expect(actions[0].type).toBe(TEST_TIMEOUT);
done();
} catch (e) {
done(e);
}
}, state);
});
it('do nothing if cesium viewer options are not found', (done) => {
const state = {
maptype: {
5 changes: 3 additions & 2 deletions web/client/epics/queryparams.js
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@ import {setControlProperty, TOGGLE_CONTROL} from '../actions/controls';

import {getLonLatFromPoint} from '../utils/CoordinatesUtils';
import {hideMapinfoMarker, purgeMapInfoResults, toggleMapInfoState} from "../actions/mapInfo";
import {mapSelector} from '../selectors/map';
import {clickPointSelector, isMapInfoOpen, mapInfoEnabledSelector} from '../selectors/mapInfo';
import {shareSelector} from "../selectors/controls";
import {LAYER_LOAD} from "../actions/layers";
@@ -63,7 +62,9 @@ export const readQueryParamsOnMapEpic = (action$, store) => {
action$.ofType(INIT_MAP)
.take(1)
.switchMap(() => {
const cesiumViewerOptions = getCesiumViewerOptions(parameters, mapSelector(store.getState()));
// On map initialization, query params containing cesium viewer options
// is used to determine cesium map type
const cesiumViewerOptions = getCesiumViewerOptions(parameters);
if (cesiumViewerOptions) {
skipProcessing = true;
return Rx.Observable.of(changeMapType('cesium'));

0 comments on commit dd617cc

Please sign in to comment.