Skip to content

Commit

Permalink
ui-speedspacechart: fix reticle display when no hover
Browse files Browse the repository at this point in the history
Signed-off-by: romainvalls <[email protected]>
  • Loading branch information
RomainValls committed Feb 6, 2025
1 parent 4110fda commit 4bffa7b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ui-speedspacechart/src/components/layers/ReticleLayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { useEffect, useRef, useState } from 'react';
import type { TrainDetails, Store } from '../../types/chartTypes';
import DetailsBox from '../common/DetailsBox';
import { drawCursor } from '../helpers/drawElements/reticle';
import { getAdaptiveHeight } from '../utils';
import { clearCanvas, getAdaptiveHeight } from '../utils';

type ReticleLayerProps = {
width: number;
Expand All @@ -24,6 +24,9 @@ const ReticleLayer = ({ width, height, heightOffset, store }: ReticleLayerProps)
if (store.cursor.y && store.cursor.y < maxCursorHeight) {
const detailsBox = drawCursor({ ctx, width, height, store });
setTrainDetails(detailsBox || null);
} else {
clearCanvas(ctx, width, height);
setTrainDetails(null);
}
}, [width, height, store, maxCursorHeight]);

Expand Down

0 comments on commit 4bffa7b

Please sign in to comment.