@@ -18,6 +18,9 @@ import PowerRestrictionsLayer from './layers/PowerRestrictionsLayer';
18
18
import SettingsPanel from './common/SettingsPanel' ;
19
19
import InteractionButtons from './common/InteractionButtons' ;
20
20
import { LINEAR_LAYERS_HEIGHTS } from './const' ;
21
+ import TickLayerYRight from './layers/TickLayerYRight' ;
22
+ import DeclivityLayer from './layers/DeclivityLayer' ;
23
+ import { MARGINS } from './const' ;
21
24
22
25
export type SpeedSpaceChartProps = {
23
26
width : number ;
@@ -85,9 +88,17 @@ const SpeedSpaceChart = ({
85
88
isSettingsPanelOpened : false ,
86
89
} ) ;
87
90
88
- const { WIDTH_OFFSET , HEIGHT_OFFSET } = getGraphOffsets ( width , height ) ;
91
+ const { WIDTH_OFFSET , HEIGHT_OFFSET } = getGraphOffsets (
92
+ width ,
93
+ height ,
94
+ store . layersDisplay . declivities
95
+ ) ;
89
96
const dynamicHeight = getAdaptiveHeight ( height , store . layersDisplay ) ;
90
97
const dynamicHeightOffset = getAdaptiveHeight ( HEIGHT_OFFSET , store . layersDisplay ) ;
98
+ const { OFFSET_RIGHT_AXIS } = MARGINS ;
99
+ const adjustedWidthRightAxis = store . layersDisplay . declivities
100
+ ? width - OFFSET_RIGHT_AXIS
101
+ : width ;
91
102
92
103
const [ showDetailsBox , setShowDetailsBox ] = useState ( false ) ;
93
104
@@ -136,11 +147,17 @@ const SpeedSpaceChart = ({
136
147
} }
137
148
tabIndex = { 0 }
138
149
>
139
- < div className = "flex justify-end absolute base-margin-top" style = { { width : width } } >
150
+ < div
151
+ className = "flex justify-end absolute base-margin-top"
152
+ style = { { width : adjustedWidthRightAxis } }
153
+ >
140
154
< InteractionButtons reset = { reset } openSettingsPanel = { openSettingsPanel } store = { store } />
141
155
</ div >
142
156
{ store . isSettingsPanelOpened && (
143
- < div className = "flex justify-end absolute ml-2 base-margin-top" style = { { width : width } } >
157
+ < div
158
+ className = "flex justify-end absolute ml-2 base-margin-top"
159
+ style = { { width : adjustedWidthRightAxis } }
160
+ >
144
161
< SettingsPanel
145
162
color = { backgroundColor }
146
163
store = { store }
@@ -149,10 +166,13 @@ const SpeedSpaceChart = ({
149
166
/>
150
167
</ div >
151
168
) }
169
+ { store . layersDisplay . declivities && (
170
+ < DeclivityLayer width = { WIDTH_OFFSET } height = { HEIGHT_OFFSET } store = { store } />
171
+ ) }
152
172
< CurveLayer width = { WIDTH_OFFSET } height = { HEIGHT_OFFSET } store = { store } />
153
- < AxisLayerY width = { width } height = { height } store = { store } />
154
- < MajorGridY width = { width } height = { height } store = { store } />
155
- < AxisLayerX width = { width } height = { height } store = { store } />
173
+ < AxisLayerY width = { adjustedWidthRightAxis } height = { height } store = { store } />
174
+ < MajorGridY width = { adjustedWidthRightAxis } height = { height } store = { store } />
175
+ < AxisLayerX width = { adjustedWidthRightAxis } height = { height } store = { store } />
156
176
{ store . layersDisplay . steps && (
157
177
< >
158
178
< StepLayer width = { WIDTH_OFFSET } height = { HEIGHT_OFFSET } store = { store } />
@@ -180,14 +200,19 @@ const SpeedSpaceChart = ({
180
200
/>
181
201
) }
182
202
< TickLayerX width = { width } height = { dynamicHeight } store = { store } />
203
+
204
+ { store . layersDisplay . declivities && (
205
+ < TickLayerYRight width = { width } height = { height } store = { store } />
206
+ ) }
183
207
< ReticleLayer
184
- width = { width }
208
+ width = { adjustedWidthRightAxis }
185
209
height = { dynamicHeight }
186
210
heightOffset = { dynamicHeightOffset }
187
211
store = { store }
188
212
showDetailsBox = { showDetailsBox }
189
213
setShowDetailsBox = { setShowDetailsBox }
190
214
/>
215
+
191
216
< FrontInteractivityLayer
192
217
width = { WIDTH_OFFSET }
193
218
height = { dynamicHeightOffset }
0 commit comments