Skip to content

fix-333-allow-dimension-based-distances#342

Open
timothypratley wants to merge 4 commits intotgdwyer:masterfrom
timothypratley:fix-333-dimension-distance-squared-property
Open

fix-333-allow-dimension-based-distances#342
timothypratley wants to merge 4 commits intotgdwyer:masterfrom
timothypratley:fix-333-dimension-distance-squared-property

Conversation

@timothypratley
Copy link
Copy Markdown

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
Copy Markdown
Author

See issue #333

@timothypratley
Copy link
Copy Markdown
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