Skip to content

Commit c83c824

Browse files
committed
fixup! ui-speedspacechart: add declivities layer in gev v2
1 parent e8f69a4 commit c83c824

File tree

6 files changed

+17
-12
lines changed

6 files changed

+17
-12
lines changed

ui-speedspacechart/src/components/SpeedSpaceChart.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ const SpeedSpaceChart = ({
199199
store={store}
200200
/>
201201
)}
202-
<TickLayerX width={width} height={dynamicHeight} store={store} />
202+
<TickLayerX width={adjustedWidthRightAxis} height={dynamicHeight} store={store} />
203203

204204
{store.layersDisplay.declivities && (
205205
<TickLayerYRight width={width} height={height} store={store} />

ui-speedspacechart/src/components/helpers/drawElements/declivity.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const drawDeclivity = (
1313
) => {
1414
const { slopes, ratioX, leftOffset } = store;
1515

16-
const { maxGradient, slopesRange } = slopesValues(store);
16+
const { maxGradient } = slopesValues(store);
1717
const { maxPosition } = maxPositionValues(store);
1818

1919
if (!slopes || slopes.length === 0) {

ui-speedspacechart/src/components/helpers/drawElements/tickYRight.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const drawTickYRight = (
2727
const tickWidth = 6;
2828

2929
ctx.font = 'normal 12px IBM Plex Sans';
30+
ctx.lineWidth = 0.5;
3031

3132
// Calculate gradient step to avoid decimals
3233
const maxAbsGradient = Math.max(maxGradient, minGradient);
@@ -41,7 +42,6 @@ export const drawTickYRight = (
4142
ctx.moveTo(width - MARGIN_LEFT - tickWidth, tickY);
4243
ctx.lineTo(width - MARGIN_LEFT, tickY);
4344
ctx.strokeStyle = 'rgb(121, 118, 113)';
44-
ctx.stroke();
4545

4646
ctx.textAlign = 'left';
4747
const text = tickValue.toString();
@@ -55,6 +55,8 @@ export const drawTickYRight = (
5555
ctx.fillText('‰', width - MARGIN_LEFT, height / 12); // 12 ticks intervals
5656
console.log({ maxTickY, tickSpacing, height }, 'for ticks');
5757
}
58+
ctx.stroke();
59+
5860
// prevent overlapping with margin top
5961
ctx.clearRect(0, 0, width, MARGIN_TOP);
6062
ctx.clearRect(width - MARGIN_LEFT, height - MARGIN_BOTTOM, width, MARGIN_BOTTOM);

ui-speedspacechart/src/components/layers/CurveLayer.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import type { Store } from '../../types/chartTypes';
33
import { drawCurve } from '../helpers/drawElements/curve';
44
import { useCanvas } from '../hooks';
5+
import cx from 'classnames';
56

67
type CurveLayerProps = {
78
width: number;
@@ -13,7 +14,13 @@ const CurveLayer = ({ width, height, store }: CurveLayerProps) => {
1314
const canvas = useCanvas(drawCurve, width, height, store);
1415

1516
return (
16-
<canvas id="curve-layer" className="absolute" ref={canvas} width={width} height={height} />
17+
<canvas
18+
id="curve-layer"
19+
className={cx('absolute rounded-t-xl', { 'bg-white-25': !store.layersDisplay.declivities })}
20+
ref={canvas}
21+
width={width}
22+
height={height}
23+
/>
1724
);
1825
};
1926

ui-speedspacechart/src/components/layers/DeclivityLayer.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import type { Store } from '../../types/chartTypes';
33
import { drawDeclivity } from '../helpers/drawElements/declivity';
44
import { useCanvas } from '../hooks';
5+
import cx from 'classnames';
56

67
type DeclivityLayerProps = {
78
width: number;
@@ -15,7 +16,7 @@ const DeclivityLayer = ({ width, height, store }: DeclivityLayerProps) => {
1516
return (
1617
<canvas
1718
id="declivity-layer"
18-
className="absolute rounded-t-xl"
19+
className={cx('absolute rounded-t-xl', { 'bg-white-25': store.layersDisplay.declivities })}
1920
ref={canvas}
2021
width={width}
2122
height={height}

ui-speedspacechart/src/styles/main.css

+2-7
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,13 @@
1818

1919
#curve-layer,
2020
#step-layer,
21-
#declivity-layer {
21+
#declivity-layer,
22+
#front-interactivity-layer {
2223
margin-left: 3rem;
2324
margin-top: 1.6875rem;
24-
box-shadow:
25-
0 0.0625rem 0,
26-
125rem 0 rgba(0, 0, 0, 0.19);
27-
box-shadow: 0 0.25rem 0.5625rem 0 rgba(0, 0, 0, 0.06);
2825
}
2926

3027
#front-interactivity-layer {
31-
margin-left: 3rem;
32-
margin-top: 1.6875rem;
3328
box-shadow:
3429
0 0.0625rem 0,
3530
125rem 0 rgba(0, 0, 0, 0.19);

0 commit comments

Comments
 (0)