Skip to content

Layout Algorithm

A component-based model for panel layout with rounded regions.

Visual Model

╭─────────────────────────────────────╮  ← Box: outer separator + fillets
│  ╭─────────────────────────────╮    │
│  │        Controls             │    │  ← peach region
│  ╰─────────────────────────────╯    │
│  ════════════════════════════════   │  ← interior separator + fillets
│  ╭──────────╮  ╭───────────────╮    │
│  │          │  │               │    │
│  │ Details  ║  │    Graph      │    │  ← interior separator + fillets
│  │          │  │               │    │
│  ╰──────────╯  ╰───────────────╯    │
╰─────────────────────────────────────╯  ← Box: outer separator + fillets

Component Hierarchy

ComponentMade ofVisual Effect
Box4 separators + 4 corner filletsRounded frame around entire app
Interior SeparatorBar + 2 end filletsDivides regions, rounds their corners
RegionContent areaPeach fill, corners rounded by adjacent fillets
FilletQuarter-circle arcCurves into region at separator intersection

Key Insight

Every rounded corner on a region is created by a fillet belonging to an adjacent separator (either Box edge or interior separator). Regions themselves have no corner logic — their apparent rounded corners emerge from the fillets around them.

Component Relationships

Box
├── Separator (top)
├── Separator (bottom)
├── Separator (left) + Fillets
├── Separator (right) + Fillets
└── Content
    ├── Region (controls)
    ├── Separator (horizontal) + Fillets
    └── Row
        ├── Region (details)
        ├── Separator (vertical) + Fillets
        └── Region (graph)

Separator Anatomy

A separator consists of:

  1. Bar — colored rectangle (w_separator_color)
  2. Fillets — quarter-circle arcs at ends (0, 1, or 2)
Single fillet:     Double fillet:
    ╭                  ╭
    ║                  ║
    ║                  ║
    ║                  ╯

Fillet Placement Rule

Fillets curve into the regions they touch, away from the separator they belong to.

Separator extends right → Fillet curves left (into region)

    Region A  ║  Region B

    ══════════╯

         Fillet curves into Region A

Overlap Rule

Separators extend thickness/2 beyond their logical endpoints so fillets align with the centers of intersecting separators.

                    ┃ ← intersecting separator (thickness = 5)

    ════════════════╮ ← fillet center aligns with separator center

Implementation:

  • Length: logicalLength + thickness
  • Offset: -thickness/2

Layout Algorithm (Draft)

  1. Define regions — rectangles with position and size
  2. Identify gaps — spaces between adjacent regions become separators
  3. Place separators — fill gaps, extend by thickness/2 at ends
  4. Add fillets — at separator ends where they meet other separators
  5. Render order — regions first (peach), then separators (rust), fillets inherit from separator

Constants

ConstantValueUsage
k.thickness.separator.main5Separator/fillet thickness
k.radius.fillets.thick14Fillet arc radius

Open Questions

  • [ ] How to specify which separators get fillets (Box edges vs interior)?
  • [ ] How to handle T-junctions (3-way intersections)?
  • [ ] Should regions know about their corner radii for hit testing?