warfactoryracine/docs/02-systems/HYBRID_SIZE_SYSTEM.md
StillHammer f6c3b3430d Add comprehensive IDataTree configuration system
- Create modular IDataNode interface with tree navigation, pattern matching, and typed access
- Implement IDataTree container with manual hot-reload capabilities
- Add DataTreeFactory for flexible data source management
- Support hierarchical data with per-node blobs and children
- Enable pattern matching search (*wildcards) across entire subtrees
- Provide type-safe property access (getString, getInt, getBool, getDouble)
- Include hash system for validation and synchronization (getDataHash, getTreeHash)
- Add property-based queries with lambda predicates for gameplay data filtering
- Fix window positioning system to eliminate UI overlaps
- Enforce explicit type declarations (ban auto keyword) in CLAUDE.md coding standards

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-27 10:42:35 +08:00

1.7 KiB

🎯 Hybrid Sizing System - Revolutionary UI Layout

Overview

The Hybrid Sizing System is a breakthrough UI layout approach that combines responsive percentage targets with absolute pixel constraints to achieve both flexible responsive design and guaranteed usability.

💡 Core Concept

Traditional UI systems force you to choose:

  • Percentages: Responsive but can become unusable (too small/large)
  • Pixels: Fixed size but not responsive

Hybrid System: Target percentages, respect absolute constraints.

📐 Mathematical Formula

float final_size = clamp(percentage_target, absolute_min, absolute_max);

Where:

  • percentage_target = (percentage / 100.0f) * parent_size
  • absolute_min = minimum usable size in pixels
  • absolute_max = maximum reasonable size in pixels

🎯 Example in Action

Configuration

{
  "size": {"width": "20%"},           // Target 20% of parent
  "min_size": {"width": 250},         // Never smaller than 250px
  "max_size": {"width": 400}          // Never larger than 400px
}

Results Across Screen Sizes

Screen Width 20% Target Constraints Final Size Status
1000px 200px 250-400px 250px ⚖️ Clamped to minimum
1400px 280px 250-400px 280px Percentage achieved
1800px 360px 250-400px 360px Percentage achieved
2500px 500px 250-400px 400px ⚖️ Clamped to maximum

This hybrid system represents a fundamental advancement in UI layout technology.