# 📏 Size Constraints Guide ## Overview Le systĂšme IUI supporte maintenant les **contraintes de taille en pixels** pour tous les types de fenĂȘtres et docks. ## ⚙ Types de contraintes ### **min_size** - Taille minimum ```json { "min_size": {"width": 200, "height": 150} } ``` - EmpĂȘche l'utilisateur de rendre la fenĂȘtre trop petite - Garantit que le contenu reste utilisable - **Obligatoire** pour les fenĂȘtres critiques (console, alerts) ### **max_size** - Taille maximum ```json { "max_size": {"width": 800, "height": 600} } ``` - EmpĂȘche les fenĂȘtres de dominer l'Ă©cran - Maintient la cohĂ©rence de l'interface - Utile pour les popups et dialogs ### **size** - Taille initiale ```json { "size": {"width": 400, "height": 300} } ``` - Taille au moment de la crĂ©ation - Sera **clampĂ©e** entre min_size et max_size - Si hors limites, ajustĂ©e automatiquement ## đŸ—ïž Usage par type de fenĂȘtre ### **Docks** ```cpp ui->createDock("sidebar", DockType::TABBED, DockPosition::LEFT, { {"size", {{"width", 300}}}, {"min_size", {{"width", 200}, {"height", 300}}}, {"max_size", {{"width", 500}, {"height", 1000}}}, {"resizable", true} }); ``` ### **Splits** ```cpp ui->createSplit("main_split", Orientation::HORIZONTAL, { {"min_panel_size", 80}, // Chaque panel min 80px {"min_size", {{"width", 600}, {"height", 400}}}, // Split total min 600x400 {"split_ratio", 0.6} // 60% / 40% }); ``` ### **Content Windows** ```cpp ui->showData(DataType::ECONOMY, { {"content", {...}}, {"window", { {"id", "economy_dash"}, {"size", {{"width", 350}, {"height", 250}}}, {"min_size", {{"width", 300}, {"height", 200}}}, // LisibilitĂ© {"max_size", {{"width", 600}, {"height", 400}}}, // Pas trop invasif {"resizable", true} }} }); ``` ### **Floating Windows** ```cpp ui->showData(DataType::ALERTS, { {"content", {...}}, {"window", { {"floating", true}, {"size", {{"width", 400}, {"height", 200}}}, {"min_size", {{"width", 320}, {"height", 150}}}, // Alert lisible {"max_size", {{"width", 600}, {"height", 300}}}, // Pas trop grosse {"closeable", true} }} }); ``` ## 📋 Recommandations par usage ### **Console/Log windows** - **min_size**: `{"width": 400, "height": 100}` (au moins 3-4 lignes) - **max_size**: `{"width": 2000, "height": 300}` (pas trop haute) ### **Economy/Data tables** - **min_size**: `{"width": 250, "height": 200}` (colonnes lisibles) - **max_size**: `{"width": 500, "height": 600}` (pas trop large) ### **Maps/Graphics** - **min_size**: `{"width": 300, "height": 300}` (dĂ©tails visibles) - **max_size**: `{"width": 1200, "height": 1200}` (performance) ### **Inventory grids** - **min_size**: `{"width": 200, "height": 150}` (grid 2x2 minimum) - **max_size**: `{"width": 400, "height": 500}` (pas trop de scroll) ### **Settings/Dialogs** - **min_size**: `{"width": 320, "height": 240}` (tous contrĂŽles visibles) - **max_size**: `{"width": 500, "height": 400}` (taille raisonnable) ### **Alert popups** - **min_size**: `{"width": 300, "height": 120}` (texte lisible) - **max_size**: `{"width": 500, "height": 250}` (pas invasif) ## 🔄 Comportement automatique ### **Clamping** Si `size` est hors des limites : ```cpp // Taille demandĂ©e : 100x50 // min_size : 200x150 // max_size : 800x600 // → RĂ©sultat : 200x150 (clampĂ©e au minimum) ``` ### **Resize interactif** - L'utilisateur ne peut **jamais** redimensionner en dessous de `min_size` - L'utilisateur ne peut **jamais** redimensionner au-dessus de `max_size` - Les **cursors de resize** changent quand les limites sont atteintes ### **Split constraints** ```cpp { "min_panel_size": 80, // Chaque panel minimum 80px "split_ratio": 0.7 // Mais peut ĂȘtre ajustĂ© si ça viole min_panel_size } ``` ## ⚡ Performance - **Enums** pour types communs = comparaisons int rapides - **JSON** pour config flexible = parse une fois Ă  la crĂ©ation - **Pixel constraints** appliquĂ©es cĂŽtĂ© implĂ©mentation (ImGui, HTML, etc.) - **Zero overhead** si pas de contraintes spĂ©cifiĂ©es ## 🎯 Exemple complet ```cpp // CrĂ©er layout avec contraintes ui->createDock("main_sidebar", DockType::TABBED, DockPosition::LEFT, { {"min_size", {{"width", 250}, {"height", 400}}}, {"max_size", {{"width", 500}, {"height", 1000}}} }); // Ajouter contenu avec contraintes ui->showData(DataType::ECONOMY, { {"content", {{"prices", {...}}}}, {"window", { {"parent", "main_sidebar"}, {"dock", "tab"}, {"min_size", {{"width", 240}, {"height", 200}}}, {"max_size", {{"width", 450}, {"height", 600}}} }} }); ``` **RĂ©sultat** : Interface qui reste **utilisable** Ă  toutes les tailles ! 🚀