svg_path/inspect
Human-readable structural inspection for path values.
This module is for debugging and tests, not for producing valid SVG path
data. Use svg_path/serialize when you need a d attribute string.
Types
Left-side number padding for structural inspection output.
pub type LeftPadding {
NoLeftPadding
AutoLeftPadding
LeftPadding(Int)
}
Constructors
-
NoLeftPaddingDo not pad numbers on the left.
-
AutoLeftPaddingPre-scan the inspected value and choose the smallest shared left width that aligns its numbers.
-
LeftPadding(Int)Pad numbers to the given left width.
The width includes a leading minus sign for negative numbers.
Options for structural inspection output.
pub type Options {
Options(
decimal_places: option.Option(Int),
fixed_decimals: Bool,
left_padding: LeftPadding,
)
}
Constructors
-
Options( decimal_places: option.Option(Int), fixed_decimals: Bool, left_padding: LeftPadding, )Arguments
- decimal_places
-
Decimal places used when formatting numbers.
- fixed_decimals
-
Whether formatted numbers should keep trailing zeroes.
- left_padding
-
Whether numbers should be padded on the left for visual alignment.
Values
pub fn decimal_options(decimal_places: Int) -> Options
Create options that round numbers to the given number of decimal places.
Trailing zeroes are stripped. Negative decimal places are clamped to zero.
pub fn default_options() -> Options
Default inspection options.
Defaults to raw float formatting with trailing decimal zeroes stripped.
pub fn fixed_decimal_options(decimal_places: Int) -> Options
Create options that round numbers and keep exactly the given number of decimal places.
Negative decimal places are clamped to zero.
pub fn path_code(path: svg_path.Path) -> String
Inspect a path as copy-pasteable Gleam code.
The generated code assumes the svg_path package is imported as
svg_path.
pub fn path_code_with_options(
path path: svg_path.Path,
options options: Options,
) -> String
Inspect a path as copy-pasteable Gleam code with custom options.
pub fn path_with_options(
path path: svg_path.Path,
options options: Options,
) -> String
Inspect a path as a multiline structural string with custom options.
pub fn point_code(point: vec2.Vec2(Float)) -> String
Inspect a point as copy-pasteable Gleam code.
The generated code assumes the svg_path package is imported as
svg_path.
pub fn point_code_with_options(
point point: vec2.Vec2(Float),
options options: Options,
) -> String
Inspect a point as copy-pasteable Gleam code with custom options.
pub fn point_with_options(
point point: vec2.Vec2(Float),
options options: Options,
) -> String
Inspect a point as x,y with custom options.
pub fn segment(segment: svg_path.Segment) -> String
Inspect a segment as a single-line structural string.
pub fn segment_code(segment: svg_path.Segment) -> String
Inspect a segment as copy-pasteable Gleam code.
The generated code assumes the svg_path package is imported as
svg_path.
pub fn segment_code_with_options(
segment segment: svg_path.Segment,
options options: Options,
) -> String
Inspect a segment as copy-pasteable Gleam code with custom options.
pub fn segment_with_options(
segment segment: svg_path.Segment,
options options: Options,
) -> String
Inspect a segment as a single-line structural string with custom options.
pub fn subpath(subpath: svg_path.Subpath) -> String
Inspect a subpath as a multiline structural string.
pub fn subpath_code(subpath: svg_path.Subpath) -> String
Inspect a subpath as copy-pasteable Gleam code.
The generated code assumes the svg_path package is imported as
svg_path.
pub fn subpath_code_with_options(
subpath subpath: svg_path.Subpath,
options options: Options,
) -> String
Inspect a subpath as copy-pasteable Gleam code with custom options.
pub fn subpath_with_options(
subpath subpath: svg_path.Subpath,
options options: Options,
) -> String
Inspect a subpath as a multiline structural string with custom options.
pub fn with_left_padding(
options options: Options,
left_padding left_padding: LeftPadding,
) -> Options
Set left-side number padding for inspection options.