-
Notifications
You must be signed in to change notification settings - Fork 377
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
Three #173
Three #173
Conversation
…ed by alpha) fixes #81
…ed by alpha) fixes #81
Currently, the radial force... d3.forceRadial(radius[, x][, y]) ... allows only numbers to the `x` and `y` positions: > If x is specified, sets the x-coordinate of the circle center to the specified number and returns this force. This proposed change allows passing functions to `radial.x()` and `radial.y()`, using the same pattern of other forces. Here is the working demo: https://bl.ocks.org/anonymous/0685343afe4675a022403be8728bc7c4/7dda06727201c128b9ff820b24c2c955e655436d
If we’re willing to break backwards-compatibility then I think having explicit start is better than implicit start on the first event listener. |
Co-authored-by: Mike Bostock <[email protected]>
I've just pushed that change (with simulation.restart aliased as simulation.start). The code is admittedly cleaner, but it feels a bit awkward. (Maybe I just need a moment to get used to it.) |
Concerning forceCenter() there is probably a case to be made for when you want an immediate centering (in particular to recenter an initial phyllotaxis arrangement). Should we remove the dependency on alpha and just leave an optional strength() function? Then the default strength(1) would be immediate, and strength(0.05) or so would be the go-to choice for gentle interactive recentering. |
and change x,y not vx, vy. - this makes #81 non-breaking - strength=1 recenters "at once" for non-interactive graphs (or, for example, the initial phyllotaxis layout) - strength=0.05 recenters gently for interactive situations such as https://observablehq.com/d/674136693ce67301
and change x,y not vx, vy. - this makes #81 non-breaking - strength=1 recenters "at once" for non-interactive graphs (or, for example, the initial phyllotaxis layout) - strength=0.05 recenters gently for interactive situations such as https://observablehq.com/d/674136693ce67301
TL;DR: Drop #45 ; merge #167, #81 and #17. After more consideration and tests:
|
closing in favor of #174 |
Because of the breaking changes in
#81 (which impacts #17),#167 (and partly #45) this branch is "maximalist", and should be published asd3-force@3
.I would prefer to do this "maximalist" approach now to integrate into d3v6, but the alternative option is to have a minimalist d3-force@2 (#172) and wait for d3@7 to include these changes.