Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes OpenRailAssociation/osrd#10960
y scale requirements
the scale min zoom metre/px value depends on the length of the path (which is not the case with the time axis, which are constants)
map yZoom -> mm/px scale
Previously,
yZoom
was used as a multiplier.yScale
was just changed by increments of0.5
(using the + or - buttons) and the height in pixel was just multiplied byyScale
. This approach is not enough as we need to be able to navigate arbitrary zoom levels and to know how much the size of a rectangle means in term of yZoom.To do that we need functions to map back and forth between the
yZoom
level and the value of the scale in mm/px.this is what
zoomValueToSpaceScale
spaceScaleToZoomValue
do.seeing that with the min zoom level we need to display the entire path, min Zoom scale value also depends on the length of the path. min and max scale values are given by
getExtremaScales
in non proportional mode (linear, every stop has the same height on the manchette), we’re not using a mm/px scale. We directly convert rectangle px height (extended to the full chart height) means in term of stop height.
scale example:
in our story with path of 168 km and manchette height = 528 px, we get min zoom scale of 318287 m/px.
https://www.desmos.com/calculator/o1cq38zueu?lang=fr