Shumoku Docs

ドキュメントを検索

共通文書と現行公開版

検索を読み込み中…

English

@shumoku/core · 0.4.0 · function

bezierOffsetPath

ソース

APIの説明は英語のcanonical sourceを表示しています。

`bezierEdgePath` translated as a whole by `offset` SVG units along the chord-perpendicular direction. Used to draw parallel "in" / "out" lanes for weathermap-style flow overlays. This is a *parallel translate*, NOT a true cubic offset curve (which cannot in general be represented exactly as another cubic). All four control points shift by the same vector, so: • lane spacing is exactly `2 * |offset|` everywhere along the curve, • the offset curve never crosses the base curve or the opposite lane regardless of port-side configuration (incl. same-side U-turns and adjacent-side L-turns), • tangents are preserved at every point — but the lane endpoint is shifted off the port by `(nx, ny)`. Lanes are decorative; they are not meant to "connect to" the port. The shift direction is the chord normal (perpendicular to b-a). Sign convention: in screen coordinates (y-down), `+offset` shifts to the right-hand side of the chord A→B, `-offset` to the left. Pass `+offset` and `-offset` for the two lanes; which one ends up labelled "in" is a data-source semantic, not enforced here. Computed analytically — no DOM measurement, so callers don't need a mounted SVGPathElement.

bezierOffsetPath(from: { absolutePosition: { x: number; y: number }; side?: PortSide }, to: { absolutePosition: { x: number; y: number }; side?: PortSide }, offset: number): string

パラメーター

名前 説明 既定値
from { absolutePosition: { x: number; y: number }; side?: PortSide } 追加説明はありません。
to { absolutePosition: { x: number; y: number }; side?: PortSide } 追加説明はありません。
offset number 追加説明はありません。

戻り値

string

libs/@shumoku/core/src/layout/bezier-path.ts:124