Skip to content

DRY: unify edge Bezier control-point calculation #76

Description

@lowhung

Summary

Refactor edge curve control point math into a shared helper and reuse it in both runtime drawing and SVG export.

Why

src/ui/drawing.rs and src/ui/export.rs independently compute the same quadratic Bezier control point geometry for edges. This duplication risks drift and subtle visual mismatch.

Affected files

  • src/ui/drawing.rs
  • src/ui/export.rs

Extraction plan

  • Add edge_control_point(p0: Pos2, p2: Pos2, curve_cap: f32) -> Pos2 in src/ui/drawing.rs.
  • Replace inline control-point math in drawing path with the helper.
  • Import and reuse the helper in src/ui/export.rs (with export-specific curve_cap).
  • Add/adjust focused unit tests for helper behavior.

Risk

Low. Pure geometry extraction with no behavioral intent change.

Acceptance criteria

  • Single helper computes edge control points for both drawing and export paths.
  • Existing edge rendering behavior remains visually consistent.
  • Tests pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions