@@ -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
@@ -149,10 +160,13 @@ const SpeedSpaceChart = ({
149
160
/>
150
161
</ div >
151
162
) }
163
+ { store . layersDisplay . declivities && (
164
+ < DeclivityLayer width = { WIDTH_OFFSET } height = { HEIGHT_OFFSET } store = { store } />
165
+ ) }
152
166
< 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 } />
167
+ < AxisLayerY width = { adjustedWidthRightAxis } height = { height } store = { store } />
168
+ < MajorGridY width = { adjustedWidthRightAxis } height = { height } store = { store } />
169
+ < AxisLayerX width = { adjustedWidthRightAxis } height = { height } store = { store } />
156
170
{ store . layersDisplay . steps && (
157
171
< >
158
172
< StepLayer width = { WIDTH_OFFSET } height = { HEIGHT_OFFSET } store = { store } />
@@ -180,14 +194,19 @@ const SpeedSpaceChart = ({
180
194
/>
181
195
) }
182
196
< TickLayerX width = { width } height = { dynamicHeight } store = { store } />
197
+
198
+ { store . layersDisplay . declivities && (
199
+ < TickLayerYRight width = { width } height = { height } store = { store } />
200
+ ) }
183
201
< ReticleLayer
184
- width = { width }
202
+ width = { adjustedWidthRightAxis }
185
203
height = { dynamicHeight }
186
204
heightOffset = { dynamicHeightOffset }
187
205
store = { store }
188
206
showDetailsBox = { showDetailsBox }
189
207
setShowDetailsBox = { setShowDetailsBox }
190
208
/>
209
+
191
210
< FrontInteractivityLayer
192
211
width = { WIDTH_OFFSET }
193
212
height = { dynamicHeightOffset }
0 commit comments