Skip to content
Snippets Groups Projects
Commit 23f08c1e authored by Miłosz Grocholewski's avatar Miłosz Grocholewski
Browse files

refactor(vector-map): move vector layer type name string to constant

parent 9d863898
No related branches found
No related tags found
13 merge requests!325refactor(vector-map): modify redux to store element of multiple models,!323fix(vector-map): set zoom timeout for correct refresh of styles,!322feat(vector-map): disable elements background color when data overlays are visible,!321feat(vector-map): add text for filled compartments in a semantic view,!317Resolve MIN-74 "Feat/ implementing a semantic view",!316fix(vector-map): avoid clearing submap connections on clear bioentities data,!314feat(vector-map): add spinner when diagram is loading,!313feat(vector-map): scale element dashed border,!312Resolve MIN-77 "Feat/ rendering optimization",!310refactor(vector-map): rendering modifications after element rendering,!309Resolve MIN-71 "Feat/ overlays",!305feat(vector-map): handle user action using only frontend data,!304feature(vector-map): implement context menu
Pipeline #97842 passed
import { Color, ShapeRelAbs, ShapeRelAbsBezierPoint } from '@/types/models';
export const VECTOR_MAP_LAYER_TYPE = 'vectorMapLayer';
export const WHITE_COLOR: Color = {
alpha: 255,
rgb: 16777215,
......
......@@ -10,6 +10,7 @@ import VectorSource from 'ol/source/Vector';
import { Feature } from 'ol';
import { FEATURE_TYPE } from '@/constants/features';
import { modelElementsFixture } from '@/models/fixtures/modelElementsFixture';
import { VECTOR_MAP_LAYER_TYPE } from '@/components/Map/MapViewer/MapViewerVector/MapViewerVector.constants';
import * as rightClickHandleAlias from './rightClickHandleAlias';
import * as clickHandleReaction from '../clickHandleReaction';
......@@ -45,7 +46,7 @@ describe('onMapRightClick', () => {
vectorLayer = new VectorLayer({
source: vectorSource,
});
vectorLayer.set('type', 'vectorMapLayer');
vectorLayer.set('type', VECTOR_MAP_LAYER_TYPE);
jest.clearAllMocks();
});
......
......@@ -12,6 +12,7 @@ import { openContextMenu } from '@/redux/contextMenu/contextMenu.slice';
import { ModelElement } from '@/types/models';
import { rightClickHandleAlias } from '@/components/Map/MapViewer/MapViewerVector/listeners/mouseClick/mouseRightClick/rightClickHandleAlias';
import { clickHandleReaction } from '@/components/Map/MapViewer/MapViewerVector/listeners/mouseClick/clickHandleReaction';
import { VECTOR_MAP_LAYER_TYPE } from '@/components/Map/MapViewer/MapViewerVector/MapViewerVector.constants';
/* prettier-ignore */
export const onMapRightClick =
......@@ -25,7 +26,7 @@ export const onMapRightClick =
let foundFeature: Feature | undefined;
mapInstance.getAllLayers().forEach(layer => {
if(layer.isVisible() && layer instanceof VectorLayer) {
if (layer.get('type') === 'vectorMapLayer') {
if (layer.get('type') === VECTOR_MAP_LAYER_TYPE) {
const source = layer.getSource();
if (source instanceof VectorSource) {
foundFeature = source.getClosestFeatureToCoordinate(coordinate, (feature) => {
......
......@@ -28,6 +28,7 @@ import CompartmentPathway from '@/components/Map/MapViewer/MapViewerVector/utils
import Reaction from '@/components/Map/MapViewer/MapViewerVector/utils/shapes/reaction/Reaction';
import { newReactionsDataSelector } from '@/redux/newReactions/newReactions.selectors';
import { getNewReactions } from '@/redux/newReactions/newReactions.thunks';
import { VECTOR_MAP_LAYER_TYPE } from '@/components/Map/MapViewer/MapViewerVector/MapViewerVector.constants';
export const useOlMapReactionsLayer = ({
mapInstance,
......@@ -186,7 +187,7 @@ export const useOlMapReactionsLayer = ({
const vectorLayer = new VectorLayer({
source: vectorSource,
});
vectorLayer.set('type', 'vectorMapLayer');
vectorLayer.set('type', VECTOR_MAP_LAYER_TYPE);
return vectorLayer;
}, [vectorSource]);
};
......@@ -7,8 +7,3 @@ export const newReactionsDataSelector = createSelector(
newReactionsSelector,
reactions => reactions.data || [],
);
// export const newReactionsReactionByIdSelector = createSelector(
// newReactionsDataSelector,
// reactions => reactions.find(reaction => reaction.id === id) || [],
// );
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment