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-333-allow-dimension-based-distances #342

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

timothypratley
Copy link

Convert dx*dx into a property function so that it can be overriden but users who would like to vary the descent distance by dimension. This is useful when laying out rectangles, because it allows one axis to be weighted more heavily than another axis.

Screen Shot 2022-12-27 at 3 06 10 PM

Convert dx*dx into a property function so that it can be overriden but
users who would like to vary the descent distance by dimension.
This is useful when laying out rectangles, because it allows one axis to
be weighted more heavily than another axis.
@timothypratley
Copy link
Author

See issue #333

@timothypratley
Copy link
Author

Example usage:

             Descent.dimensionDistance = (x, i, u, v) => {
               var dx = x[i][u] - x[i][v];
               var dedge = i==0 ? (this._nodes[u].width + this._nodes[v].width)/2
                                : (this._nodes[u].height + this._nodes[v].height)/2;
               if (dx > dedge) {
                 dx -= dedge;
               } else if (dx < -dedge) {
                 dx += dedge;
               } else if (dx != 0) {
                 dx /= 10;
               }
               return dx;
             }

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.

1 participant