add optional angle radius parameter in curbeBezier `curveStep` curves

Abierto
#209 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
d3, javascript

Línea de trabajo

Start by reading the existing curveStep, curveStepBefore, and curveStepAfter implementations and their tests; the issue does not name file paths. Work out how an optional radius can keep the curve angle consistent across different segment lengths, including the short-distance case described in the edit. Done means the step curves support configurable smooth angles while preserving existing behavior when the radius is zero; add coverage for the illustrated curve variants and edge case.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Following #177, as suggested in https://github.com/d3/d3-shape/pull/177#issuecomment-809936541, it could be useful to have a curve similar to curveStep but with smooth angles:

image

An important note is that the curve angle should be identical whatever its length. This way we don't see curves duplication on nodes with many child of various link length:

image

Those curves could be named curbeBezierX and curbeBezierY as suggested in this example.

In fact, I think those curves could be included in curveStep, by adding an extra optional parameter allowing to define the angle radius, which is 0 by default.

This will also allow some customization. This is for instance large angle (ie curveStep(15)) and small angle (ie curveStep(5)) stepCurves, respectively:

image image

Some other visuals to get the idea:

curveStep(10)

image image

curveStepBefore(10)

image image

curveStepAfter(10)

image image

Edit: as pointed out by @Fil, the curve horizontal and vertical distance might be lower than twice the angle radius. In that case the radius remains the same, but angles stops before 90° in order to share the same tangential line. Example with several curves formed with curveStep(20), tangential line in red:

image

Lenguaje dominante
JavaScript
Estrellas
2.5k
Forks
307
Merge medio
4 h 16 min
PR fusionados (30 d)
1

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de d3/d3-shape

Todos los issues de d3/d3-shape

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.