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

Reciprocally related nodes don't flip their labels #165

Open
conartist6 opened this issue Apr 5, 2022 · 1 comment
Open

Reciprocally related nodes don't flip their labels #165

conartist6 opened this issue Apr 5, 2022 · 1 comment

Comments

@conartist6
Copy link

conartist6 commented Apr 5, 2022

Screen Shot 2022-04-05 at 9 50 40 AM

I found the code that's meant to handle this:

nomnoml/src/layouter.ts

Lines 145 to 157 in 6262d81

function adjustQuadrant(quadrant: Quadrant, point: Vec, opposite: Vec): Quadrant {
if (opposite.x == point.x || opposite.y == point.y) return quadrant
var flipHorizontally: Quadrant[] = [4, 3, 2, 1]
var flipVertically: Quadrant[] = [2, 1, 4, 3]
var oppositeQuadrant =
opposite.y < point.y ? (opposite.x < point.x ? 2 : 1) : opposite.x < point.x ? 3 : 4
// if an opposite relation end is in the same quadrant as a label, we need to flip the label
if (oppositeQuadrant === quadrant) {
if (config.direction === 'LR') return flipHorizontally[quadrant - 1]
if (config.direction === 'TB') return flipVertically[quadrant - 1]
}
return quadrant
}

I don't think I'm likely to make the fix though, because I can't use nomnoml. I am trying to find a library which would let me print a data structure like this, and nomnoml lacks a few features I would really need, such as specifying the direction of gravity for a particular association (e.g. down vs right) and also the ability to manage instances (currently all associations are keyed on class name)

@skanaar
Copy link
Owner

skanaar commented Apr 7, 2022

Thank you for the bug report.
Association/label placement is one of the least nice parts of nomnoml unfortunately.

Nomnoml's philosphy is to remove configuration options from the user and instead have a core layouting that looks pretty good (measured by some arbitrary metric).

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

No branches or pull requests

2 participants