Skip to content

Commit

Permalink
Replace tangent with encasing for mathematical clarity in gradient le…
Browse files Browse the repository at this point in the history
…ngth finder
  • Loading branch information
enourbakhsh committed Nov 15, 2024
1 parent 2fa93b8 commit 8a721ff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/mermaid/src/rendering-util/createGradient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ function isValidColor(color: string): boolean {
}

/**
* Calculates the distance L between two parallel tangent lines at a given angle for a specified SVG shape.
* Calculates the distance L between two parallel encasing lines at a given angle for a specified SVG shape.
* Replicates the behavior of CSS linear gradients based on https://www.w3.org/TR/css-images-4/#linear-gradients
* @see {@link https://www.w3.org/TR/css-images-4/#linear-gradients|CSS linear-gradient() notation} for the formal syntax.
*
* @param shapeElement - The D3 selection of the SVG shape.
* @param angleDeg - The clockwise angle in degrees between the upward vertical axis and the gradient line.
* @param numSamplePoints - The number of points to sample along the shape's path for path elements (default: 150).
* @returns - The distance between the two parallel tangent lines to the shape at the given angle.
* @returns - The distance between the two parallel encasing lines to the shape at the given angle.
*/
export function getGradientLineLength(
shapeElement: Selection<SVGGraphicsElement, unknown, HTMLElement, any>,
Expand Down

0 comments on commit 8a721ff

Please sign in to comment.