Behaviour for edge path calculations.
Path modules calculate SVG path strings for rendering edges between nodes. Each path type (bezier, straight, step, smoothstep) implements this behaviour.
Path Result
The calculate/2 function returns a map with:
:path- SVG path string (e.g., "M0,0 C50,0 50,100 100,100"):label_x- X coordinate for edge label:label_y- Y coordinate for edge label
Implementing a Custom Path
defmodule MyApp.CustomPath do
@behaviour LiveFlow.Paths.Path
@impl true
def calculate(source, target, opts) do
# Custom path calculation
%{
path: "M ...",
label_x: ...,
label_y: ...
}
end
end
Summary
Callbacks
Calculates the SVG path between source and target points.
Types
Source/target point with position information.
:x- X coordinate:y- Y coordinate:position- Handle position (:top, :bottom, :left, :right)
Path calculation result.