Skip to content

[#109.3] Define and document precedence rules for component sizing systems #128

Description

@thomasnemer

Parent Issue

Part of #109 - Window resize behavior conflicts with component sizing

Problem

The new resize system interacts with multiple existing sizing mechanisms without clear precedence rules:

  • FlexLayout's grow and shrink factors
  • Component's withSize() initial dimensions
  • Layout manager's setBounds() calls
  • Parent/child resize propagation
  • AxisResizeBehavior settings

These systems were not designed to work together and have unclear precedence rules, leading to conflicts.

Tasks

  1. Document the intended precedence in CLAUDE.md:

    • When does FlexLayout override component size?
    • When does AxisResizeBehavior take precedence?
    • How do grow/shrink factors interact with FIXED behavior?
    • What happens when layout says one size but resize behavior says another?
  2. Implement the precedence rules consistently:

    • Modify Component::setBounds() to respect precedence
    • Modify FlexLayout::layout() to respect precedence
    • Ensure onParentResize() follows the rules
  3. Add tests that validate precedence:

    • FlexLayout with FIXED components
    • FlexLayout with FILL components and grow factors
    • Conflicting size specifications

Possible Approaches

  1. Layout managers always win: setBounds() from layout overrides everything, resize behavior only applies to parent window resizes
  2. Resize behavior as constraints: Layout managers work within constraints set by resize behavior
  3. Two-pass system: Calculate layout first, then apply resize behaviors as modifications
  4. Explicit priority flags: Add priority parameter to resolve conflicts

Success Criteria

  • Precedence rules clearly documented in CLAUDE.md
  • Implementation consistently follows documented rules
  • No conflicts between FlexLayout and AxisResizeBehavior
  • Unit tests cover precedence edge cases
  • Demo app behavior matches documented expectations

Related Code

  • include/bombfork/prong/core/component.h
  • include/bombfork/prong/layout/flex_layout.h
  • CLAUDE.md - Resize Behavior section

Dependencies

Should be worked on after #109.1 and #109.2 are resolved, as it builds on understanding gained from fixing those issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions