Skip to content
Snippets Groups Projects
Commit 65b82709 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '275-color-of-line-created-in-plugin-is-ignored' into 'development'

Resolve "color of line created in plugin is ignored"

Closes #275

See merge request !214
parents 64531073 a84b148b
No related branches found
No related tags found
2 merge requests!223reset the pin numbers before search results are fetch (so the results will be...,!214Resolve "color of line created in plugin is ignored"
Pipeline #93318 passed
......@@ -14,6 +14,7 @@ import Stroke from 'ol/style/Stroke';
import Style from 'ol/style/Style';
import { useMemo } from 'react';
import { useSelector } from 'react-redux';
import { createOverlayLineFeature } from '@/components/Map/MapViewer/utils/config/overlaysLayer/createOverlayLineFeature';
import { getLineFeature } from './getLineFeature';
const getLinePoints = ({ start, end }: Pick<MarkerLine, 'start' | 'end'>): LinePoint => [
......@@ -29,21 +30,28 @@ export const useOlMapReactionsLayer = (): VectorLayer<VectorSource<Feature<Geome
const reactions = useSelector(allReactionsSelectorOfCurrentMap);
const markers = useSelector(markersLinesCurrentMapDataSelector);
const reactionsLines = getReactionsLines(reactions);
const markerLines = markers.map(getLinePoints);
const reactionsLinesFeatures = useMemo(
() => reactionsLines.map(linePoint => getLineFeature(linePoint, pointToProjection)),
[reactionsLines, pointToProjection],
);
const markerLinesFeatures = useMemo(
() =>
[...reactionsLines, ...markerLines].map(linePoint =>
getLineFeature(linePoint, pointToProjection),
markers.map(marker =>
createOverlayLineFeature([marker.start, marker.end] as LinePoint, {
color: marker.color,
pointToProjection,
}),
),
[reactionsLines, markerLines, pointToProjection],
[markers, pointToProjection],
);
const vectorSource = useMemo(() => {
return new VectorSource({
features: [...reactionsLinesFeatures],
features: [...reactionsLinesFeatures, ...markerLinesFeatures],
});
}, [reactionsLinesFeatures]);
}, [reactionsLinesFeatures, markerLinesFeatures]);
const reactionsLayer = useMemo(
() =>
......
......@@ -9,9 +9,9 @@ export type OverlayBioEntityRender = {
x1: number;
/** bottom left corner of whole element, Ymin */
y1: number;
/** top righ corner of whole element, xMax */
/** top right corner of whole element, xMax */
x2: number;
/** top righ corner of whole element, yMax */
/** top right corner of whole element, yMax */
y2: number;
width: number;
height: number;
......
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