Skip to content

Commit 58f0111

Browse files
committed
ui-speedspacechart: fix-detailsbox-display
- add showReticleLayer state in SpeedSpaceChart.tsx - display or not ReticleLayer while onMouseDown or onMouseLeave SettingsPanel
1 parent 538cf25 commit 58f0111

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

ui-speedspacechart/src/components/SpeedSpaceChart.tsx

+12-8
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ const SpeedSpaceChart = ({
9090
const dynamicHeightOffset = getAdaptiveHeight(HEIGHT_OFFSET, store.layersDisplay);
9191

9292
const [showDetailsBox, setShowDetailsBox] = useState(false);
93+
const [showReticleLayer, setShowReticleLayer] = useState(true);
9394

9495
const reset = () => {
9596
setStore((prev) => ({
@@ -145,6 +146,7 @@ const SpeedSpaceChart = ({
145146
color={backgroundColor}
146147
store={store}
147148
setStore={setStore}
149+
setShowReticleLayer={setShowReticleLayer}
148150
translations={translations}
149151
/>
150152
</div>
@@ -180,14 +182,16 @@ const SpeedSpaceChart = ({
180182
/>
181183
)}
182184
<TickLayerX width={width} height={dynamicHeight} store={store} />
183-
<ReticleLayer
184-
width={width}
185-
height={dynamicHeight}
186-
heightOffset={dynamicHeightOffset}
187-
store={store}
188-
showDetailsBox={showDetailsBox}
189-
setShowDetailsBox={setShowDetailsBox}
190-
/>
185+
{showReticleLayer && (
186+
<ReticleLayer
187+
width={width}
188+
height={dynamicHeight}
189+
heightOffset={dynamicHeightOffset}
190+
store={store}
191+
showDetailsBox={showDetailsBox}
192+
setShowDetailsBox={setShowDetailsBox}
193+
/>
194+
)}
191195
<FrontInteractivityLayer
192196
width={WIDTH_OFFSET}
193197
height={dynamicHeightOffset}

ui-speedspacechart/src/components/common/SettingsPanel.tsx

+11-1
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,19 @@ type SettingsPanelProps = {
1010
color: string;
1111
store: Store;
1212
setStore: React.Dispatch<React.SetStateAction<Store>>;
13+
setShowReticleLayer: React.Dispatch<React.SetStateAction<boolean>>;
1314
translations?: SpeedSpaceChartProps['translations'];
1415
};
1516

16-
const SettingsPanel = ({ color, store, setStore, translations }: SettingsPanelProps) => {
17+
const SettingsPanel = ({
18+
color,
19+
store,
20+
setStore,
21+
setShowReticleLayer,
22+
translations,
23+
}: SettingsPanelProps) => {
1724
const closeSettingsPanel = () => {
25+
setShowReticleLayer(true);
1826
setStore((prev) => ({
1927
...prev,
2028
isSettingsPanelOpened: false,
@@ -26,6 +34,8 @@ const SettingsPanel = ({ color, store, setStore, translations }: SettingsPanelPr
2634
id="settings-panel"
2735
style={{ background: `rgba(${color.substring(4, color.length - 1)}, 0.4)` }}
2836
className="font-sans"
37+
onMouseMove={() => setShowReticleLayer(false)}
38+
onMouseLeave={() => setShowReticleLayer(true)}
2939
>
3040
<div className="settings-panel-section">
3141
<div className="settings-panel-section-title">

0 commit comments

Comments
 (0)