@osrd-project/ui-charts 0.0.72 → 0.0.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -2683,7 +2683,7 @@ const useManchetteWithSpaceTimeChart = ({ waypoints, manchetteWithSpaceTimeChart
2683
2683
  const { manchetteContents, manchetteHeight } = useMemo(() => {
2684
2684
  const spaceScaleTree = spaceScalesToBinaryTree(spaceOrigin, spaceScales);
2685
2685
  const getSpacePixel = getSpaceToPixel(0, spaceScaleTree);
2686
- const totalManchetteHeight = getSpacePixel(spaceScales.at(-1).to, true) + BASE_WAYPOINT_HEIGHT;
2686
+ const totalManchetteHeight = Math.max(getSpacePixel(spaceScales.at(-1).to, true) + BASE_WAYPOINT_HEIGHT, height - FOOTER_HEIGHT);
2687
2687
  if (!splitPoints)
2688
2688
  return {
2689
2689
  manchetteHeight: totalManchetteHeight,
@@ -2702,6 +2702,10 @@ const useManchetteWithSpaceTimeChart = ({ waypoints, manchetteWithSpaceTimeChart
2702
2702
  })));
2703
2703
  // Sort all contents by position:
2704
2704
  const allSortedContents = sortBy(allContents, 'position');
2705
+ // In practice, waypoint lines are 0.5px wide only when devicePixelRatio is at least 2 (as it's
2706
+ // implemented at the end of waypoint.css). But to get the proper alignment, we always consider
2707
+ // it to be 0.5px wide here, because they always have this thickness SpaceTimeChart side:
2708
+ const waypointLinesThickness = 0.5;
2705
2709
  // Iterate over all contents, to set each split section's style, and correct waypoints styles
2706
2710
  // accordingly:
2707
2711
  const finalContents = [];
@@ -2712,7 +2716,7 @@ const useManchetteWithSpaceTimeChart = ({ waypoints, manchetteWithSpaceTimeChart
2712
2716
  ...content.waypoint,
2713
2717
  styles: {
2714
2718
  position: 'absolute',
2715
- top: `${getSpacePixel(content.position)}px`,
2719
+ top: `${getCrispLineCoordinate(getSpacePixel(content.position), waypointLinesThickness)}px`,
2716
2720
  height: `${BASE_WAYPOINT_HEIGHT}px`,
2717
2721
  },
2718
2722
  });
@@ -2740,7 +2744,7 @@ const useManchetteWithSpaceTimeChart = ({ waypoints, manchetteWithSpaceTimeChart
2740
2744
  manchetteHeight: totalManchetteHeight,
2741
2745
  manchetteContents: finalContents,
2742
2746
  };
2743
- }, [spaceOrigin, spaceScales, splitPoints, waypointsWithoutSplitPoints]);
2747
+ }, [spaceOrigin, spaceScales, splitPoints, waypointsWithoutSplitPoints, height]);
2744
2748
  return useMemo(() => ({
2745
2749
  manchetteProps: {
2746
2750
  contents: manchetteContents,
@@ -5178,5 +5182,5 @@ React.createElement("div", { className: "track", key: track.id, style: { height:
5178
5182
  React.createElement("div", { className: "track-name" }, track.name),
5179
5183
  React.createElement("div", { className: "track-rail" }))))));
5180
5184
 
5181
- export { CanvasContext, ConflictLayer, ConflictTooltip, DEFAULT_LEVEL, DEFAULT_THEME, DEFAULT_ZOOM_MS_PER_PX, Manchette, ManchetteWithSpaceTimeChart, MouseContext, OccupancyBlockLayer, PathLayer, PatternRect, Quadrilateral, SpaceTimeChart, SpaceTimeChartContext, SpeedSpaceChart, TimeCaptions, Tooltip$1 as Tooltip, TrackOccupancyCanvas, TrackOccupancyManchette, WorkScheduleLayer, ZoomRect, getSpaceAtTime, isConflictPickingElement, isInteractiveWaypoint, isPathOnScreen, isPointPickingElement, isSegmentPickingElement, positionMmToKm, timeScaleToZoomValue, useDraw, useManchetteWithSpaceTimeChart, usePaths, usePicking };
5185
+ export { CanvasContext, ConflictLayer, ConflictTooltip, DEFAULT_LEVEL, DEFAULT_THEME, DEFAULT_ZOOM_MS_PER_PX, Manchette, ManchetteWithSpaceTimeChart, MouseContext, OccupancyBlockLayer, PathLayer, PatternRect, Quadrilateral, SpaceTimeChart, SpaceTimeChartContext, SpeedSpaceChart, TimeCaptions, Tooltip$1 as Tooltip, TrackOccupancyCanvas, TrackOccupancyManchette, WorkScheduleLayer, ZoomRect, getCrispLineCoordinate, getSpaceAtTime, isConflictPickingElement, isInteractiveWaypoint, isPathOnScreen, isPointPickingElement, isSegmentPickingElement, positionMmToKm, timeScaleToZoomValue, useDraw, useManchetteWithSpaceTimeChart, usePaths, usePicking };
5182
5186
  //# sourceMappingURL=index.esm.js.map