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

Fix Out of Order Veritcal Transitions #396

Conversation

ducku
Copy link
Collaborator

@ducku ducku commented Feb 26, 2024

An offset designated for each node is used when generating vertical components of tracks. This leads to vertical transitions being determined by the order of the input tracks.

function generateForwardToReverse(
x,
yStart,
yEnd,
trackWidth,
trackColor,
trackID,
order,
type,
trackName
) {
x += 10 * extraRight[order];

extraRight[order] += 1;

Tracks are now sorted based on how their horizontal components are ordered before generating vertical rectangles, allowing the offsets to work in a more predictable manner.

Correct_Veritcal_Transition

Closes #395

Comment on lines +981 to +995
while (AIndex < pathA.length && BIndex < pathB.length) {
let trackAOrder = pathA[AIndex].order;
let trackBOrder = pathB[BIndex].order;
if (trackAOrder === trackBOrder && pathA[AIndex].node && pathB[BIndex].node) {
return pathB[BIndex].y - pathA[AIndex].y;
} else if (trackAOrder < trackBOrder) {
AIndex += 1;
} else if (trackAOrder > trackBOrder) {
BIndex += 1;
} else {
// Orders are equal but are traversing out of nodes
AIndex += 1;
BIndex += 1;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

This looks like it might get slow for a lot of long tracks needing to be compared, but I can't think of a better way to do it that's simple.

@adamnovak adamnovak merged commit 7b31d04 into vgteam:master Feb 26, 2024
1 check passed
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.

Reads Vertical Transitions Out Of Order
2 participants