Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui-chart: spacetimechart: bordered path layer #962

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Math-R
Copy link
Contributor

@Math-R Math-R commented Mar 6, 2025

This PR allow the user to add a border around a PathLayer.
it closes #11056

@Math-R Math-R requested a review from a team as a code owner March 6, 2025 17:52
@Math-R Math-R force-pushed the mrd/spacetimechart/bordered-layer branch 2 times, most recently from 4da5206 to 1e55ad0 Compare March 6, 2025 17:53
@Math-R Math-R requested review from jacomyal and Yohh March 6, 2025 17:53
@Math-R Math-R force-pushed the mrd/spacetimechart/bordered-layer branch from 1e55ad0 to 720dca2 Compare March 6, 2025 18:03
@Math-R Math-R changed the title ui-chart: spacetimecart: borderer path layer ui-chart: spacetimecart: bordered path layer Mar 6, 2025
@Math-R Math-R changed the title ui-chart: spacetimecart: bordered path layer ui-chart: spacetimechart: bordered path layer Mar 6, 2025
@Math-R Math-R force-pushed the mrd/spacetimechart/bordered-layer branch from 720dca2 to fd1bfd7 Compare March 6, 2025 18:11
@Yohh Yohh self-assigned this Mar 6, 2025
Co-authored-by: Uriel-Sautron <[email protected]>
Signed-off-by: Math_R_ <[email protected]>
@Uriel-Sautron Uriel-Sautron force-pushed the mrd/spacetimechart/bordered-layer branch from fd1bfd7 to b833579 Compare March 7, 2025 11:03
@Math-R Math-R requested a review from emersion March 7, 2025 11:04
@@ -66,6 +67,13 @@ export type PathLayerProps = {
color: string;
pickingTolerance?: number;
level?: PathLevel;
border?: {
offset: number;
level: PathLevel;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this is unused

const drawAll = useCallback<DrawingFunction>(
(ctx, stcContext) => {
if (border !== undefined) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: no need for an if here, since we already have one inside the function.

drawSegments(totalPathWidth + borderWidth * 2);

if (border.backgroundColor) {
drawSegments(totalPathWidth, border.backgroundColor);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit confusing: when there is no background color, I would've expected a thin width-sized border offset away from the path. However a thick path is painted instead:

out

if (i === 0) {
ctx.moveTo(x, y);
} else if (i === segments.length - 1) {
ctx.lineTo(x - border.offset / 2, y);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the - border.offset / 2 here? It seems like the spacing on the right is smaller than offset with this adjustment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mathieu - update osrd-ui to support train service space time chart style :
4 participants