Skip to content

Commit b382f62

Browse files
committed
Make edit layer stay always on top
Previously the edit layer could be under the drawn route
1 parent 6045089 commit b382f62

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

ui/src/components/map/routes/RouteGeometryLayer.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { FC } from 'react';
2+
import { useMap } from 'react-map-gl/maplibre';
23
import { theme } from '../../../generated/theme';
34
import { ArrowLayout, ArrowPaint, ArrowRenderLayer } from './ArrowRenderLayer';
5+
import { ACTIVE_LINE_STROKE_ID } from './editorStyles';
46
import { LinePaint, LineRenderLayer } from './LineRenderLayer';
57
import {
68
NEW_ROUTE_ARROWS_ID,
@@ -25,7 +27,12 @@ export const RouteGeometryLayer: FC<RouteGeometryLayerProps> = ({
2527
defaultColor = colors.routes.bus,
2628
isHighlighted,
2729
}) => {
28-
const beforeId = isHighlighted ? undefined : 'route_base';
30+
const { current: map } = useMap();
31+
const hasActiveLineStrokeLayer = !!map?.getLayer(ACTIVE_LINE_STROKE_ID);
32+
const beforeId =
33+
isHighlighted && hasActiveLineStrokeLayer
34+
? ACTIVE_LINE_STROKE_ID
35+
: 'route_base';
2936

3037
const color = isHighlighted ? colors.selectedMapItem : defaultColor;
3138

0 commit comments

Comments
 (0)