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

More link shape properties #62

Merged
merged 173 commits into from
Mar 21, 2023
Merged

More link shape properties #62

merged 173 commits into from
Mar 21, 2023

Conversation

sanbales
Copy link
Contributor

@sanbales sanbales commented Mar 11, 2023

References

Resolves #60 by adding curvature and line dashes to LinkShape.

Code changes

  • add curvature to LinkShape
  • add line_dash to LinkShape
    • disable this behavior in 3D (it is not supported)
  • add coercion to array for line_dash data
  • update notebooks
    • fixed a small issue with node selection in Behaviors.ipynb
  • update docs
  • add tests
    • str inputs
    • int inputs
    • float inputs
    • Column inputs
    • Nunjucks inputs
    • LinkShape.color
    • LinkShape.curvature
    • LinkShape.line_dash
    • LinkShape.width
  • Interaction with selection
    • need to make sure LinkSelection is included before LinkShape to show selection styling
    • LinkSelection works but it is not tested in conjunction with LinkShape
    • future work would be to figure out a way to make default_curvature=None to leave the link with its non-selected curvature

User-facing changes

  • Two new properties on LinkShape:
    • LinkShape.curvature:
      • 0.0 produces a straight link (default)
      • 1.0 circular link (i.e., radius of curvature = 0.5 * link length)
      • negative numbers mirror the link
    • LinkShape.line_dashes:
      • Define the line dashes using an array of numbers, reference

image

Backwards-incompatible changes

No backwards incompatible changes (knock on wood)

Santiago Balestrini and others added 30 commits February 21, 2023 15:03
…es, and added a general DynamicWidgetTrait
@sanbales sanbales linked an issue Mar 16, 2023 that may be closed by this pull request
@sanbales sanbales added the enhancement New feature or request label Mar 16, 2023
@sanbales sanbales self-assigned this Mar 16, 2023
@nrbgt nrbgt changed the base branch from main to dev March 17, 2023 15:14
@sanbales sanbales marked this pull request as ready for review March 20, 2023 23:21
@sanbales
Copy link
Contributor Author

3D has rotation for links (spin around the axis between source and target), not sure it is worth it to bring that in or not, but it could make sense as dash_line only works on 2D.

js/utils.ts Outdated Show resolved Hide resolved
@nrbgt
Copy link
Contributor

nrbgt commented Mar 21, 2023

but it could make sense as dash_line only works on 2D.

Again, not blocking, but should probably filter that out of the 3d demo.

@sanbales
Copy link
Contributor Author

but it could make sense as dash_line only works on 2D.

Again, not blocking, but should probably filter that out of the 3d demo.

Good call, fixed in da96020

@sanbales sanbales merged commit e14bc49 into dev Mar 21, 2023
@nrbgt nrbgt deleted the 60-more-link-shape-properties branch March 22, 2023 15:11
nrbgt pushed a commit to nrbgt/ipyforcegraph that referenced this pull request May 11, 2023
Resolves jupyrdf#60 by adding `curvature` and `line dashes` to `LinkShape`.

- [x] add `curvature` to `LinkShape`
- [x] add `line_dash` to `LinkShape`
  - [x] disable this behavior in 3D (it is not supported)
- [x] add coercion to `array` for `line_dash` data
- [x] update notebooks
  - [x] fixed a small issue with `node` selection in `Behaviors.ipynb`
- [x] update docs
- [x] add tests
  - [x] `str` inputs
  - [x] `int` inputs
  - [x] `float` inputs
  - [x] `Column` inputs
  - [x] `Nunjucks` inputs
  - [x] `LinkShape.color`
  - [x] `LinkShape.curvature`
  - [x] `LinkShape.line_dash`
  - [x] `LinkShape.width`
- [x] Interaction with selection
  - [x] need to make sure `LinkSelection` is included before `LinkShape` to show selection styling
  - [x] `LinkSelection` works but it is not tested in conjunction with `LinkShape`
  - [x] future work would be to figure out a way to make `default_curvature=None` to leave the link with its non-selected `curvature`

* Two new properties on `LinkShape`:
  * `LinkShape.curvature`:
    * 0.0 produces a straight link (default)
    * 1.0 circular link (i.e., `radius of curvature` = `0.5 * link length`)
    * negative numbers mirror the link
  * `LinkShape.line_dashes`:
    * Define the line dashes using an array of numbers, [reference](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash)

> No backwards incompatible changes (**knock on wood**)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add Additional Link Shape Properties
2 participants