Skip to content

Commit

Permalink
ui-manchette-with-spacetimechart: fix spacetimechart scales
Browse files Browse the repository at this point in the history
In linear mode, the space time chart didn't shrink when there was some
waypoints hidden in the middle of the path

Signed-off-by: SharglutDev <p.filimon75@gmail.com>
  • Loading branch information
SharglutDev committed Oct 9, 2024
1 parent fb3b3bd commit b820fcd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ui-manchette-with-spacetimechart/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,19 @@ export const getScales = (
{ height, isProportional, yZoom }: OperationalPointsOptions
) => {
if (ops.length < 2) return [];

if (!isProportional) {
return ops.slice(0, -1).map((from, index) => {
const to = ops[index + 1];

return {
from: from.position,
to: to.position,
size: BASE_OP_HEIGHT * yZoom,
};
});
}

const from = ops.at(0)!.position;
const to = ops.at(-1)!.position;

Expand Down

0 comments on commit b820fcd

Please sign in to comment.