Style: Optimisation des curseurs de calibration et bridage des limites
This commit is contained in:
@@ -51,7 +51,7 @@ class TargetCalibrationState extends State<TargetCalibration> {
|
||||
late int _ringCount;
|
||||
late List<double> _ringRadii;
|
||||
|
||||
// CORRECTION : Variable dédiée pour piloter la jauge orange sans conflit
|
||||
// Variable dédiée pour piloter la jauge orange sans conflit
|
||||
late double _currentEspacementRatio;
|
||||
|
||||
bool _isDraggingCenter = false;
|
||||
@@ -71,7 +71,7 @@ class TargetCalibrationState extends State<TargetCalibration> {
|
||||
_ringCount = widget.initialRingCount;
|
||||
|
||||
// Initialisation du ratio par défaut
|
||||
_currentEspacementRatio = (_radius > 0) ? (_innerRadius / _radius).clamp(0.01, 0.9) : 0.1;
|
||||
_currentEspacementRatio = (_radius > 0) ? (_innerRadius / _radius).clamp(0.01, 0.70) : 0.1;
|
||||
_initRingRadii();
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ class TargetCalibrationState extends State<TargetCalibration> {
|
||||
}
|
||||
if (widget.initialInnerRadius != oldWidget.initialInnerRadius && !_isDraggingInnerRadius) {
|
||||
_innerRadius = widget.initialInnerRadius;
|
||||
_currentEspacementRatio = (_radius > 0) ? (_innerRadius / _radius).clamp(0.01, 0.9) : 0.1;
|
||||
_currentEspacementRatio = (_radius > 0) ? (_innerRadius / _radius).clamp(0.01, 0.70) : 0.1;
|
||||
shouldReinit = true;
|
||||
}
|
||||
if (widget.initialRingRadii != oldWidget.initialRingRadii && widget.initialRingRadii != null) {
|
||||
@@ -197,6 +197,7 @@ class TargetCalibrationState extends State<TargetCalibration> {
|
||||
),
|
||||
),
|
||||
|
||||
// Slider pour la taille (toujours visible)
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
@@ -209,9 +210,10 @@ class TargetCalibrationState extends State<TargetCalibration> {
|
||||
const Icon(Icons.zoom_out, color: Colors.white, size: 16),
|
||||
Expanded(
|
||||
child: Slider(
|
||||
value: _radius.clamp(0.5, 1.1),
|
||||
// SÉCURITÉ : Valeur max bridée fermement à 0.82 pour éviter le débordement vertical
|
||||
value: _radius.clamp(0.5, 0.82),
|
||||
min: 0.5,
|
||||
max: 1.1,
|
||||
max: 0.82,
|
||||
activeColor: AppTheme.primaryColor,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
@@ -228,6 +230,7 @@ class TargetCalibrationState extends State<TargetCalibration> {
|
||||
),
|
||||
),
|
||||
|
||||
// Affichage conditionnel du slider d'espacement orange
|
||||
if (_showEspacement) ...[
|
||||
const SizedBox(height: 8),
|
||||
Container(
|
||||
@@ -247,7 +250,8 @@ class TargetCalibrationState extends State<TargetCalibration> {
|
||||
child: Slider(
|
||||
value: _currentEspacementRatio,
|
||||
min: 0.01,
|
||||
max: 0.9,
|
||||
// SÉCURITÉ : Écartement max bridé à 0.70 pour confiner le dernier cercle
|
||||
max: 0.70,
|
||||
activeColor: Colors.orange,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
@@ -263,13 +267,12 @@ class TargetCalibrationState extends State<TargetCalibration> {
|
||||
],
|
||||
),
|
||||
),
|
||||
// CORRECTION DU BOUTON RESET : Force visuellement le ratio par défaut
|
||||
// CORRECTION RADICALE : On force le ratio à 0.1 (10% standard) en dur
|
||||
// CORRECTION DU BOUTON RESET : Force le ratio d'usine (10%) en dur sans écrasement
|
||||
IconButton(
|
||||
icon: const Icon(Icons.refresh, color: Colors.white70, size: 20),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
// 1. On force la jauge orange à se remettre pile à 10% (la valeur d'usine)
|
||||
// 1. On force la jauge orange à se remettre à 10%
|
||||
_currentEspacementRatio = 0.1;
|
||||
|
||||
// 2. On réaligne l'innerRadius sur la taille actuelle
|
||||
@@ -278,8 +281,6 @@ class TargetCalibrationState extends State<TargetCalibration> {
|
||||
// 3. On force la reconstruction des cercles parfaits
|
||||
_initRingRadii(forceRecalculate: true);
|
||||
});
|
||||
|
||||
// 4. On balance tout ça au provider pour qu'il s'aligne
|
||||
_notifyChange();
|
||||
},
|
||||
tooltip: 'Réinitialiser l\'espacement',
|
||||
@@ -360,7 +361,7 @@ class TargetCalibrationState extends State<TargetCalibration> {
|
||||
void _onScaleUpdate(ScaleUpdateDetails details, Size size) {
|
||||
setState(() {
|
||||
if (details.pointerCount == 2) {
|
||||
_radius = (_baseRadiusBeforeScale * details.scale).clamp(0.5, 1.1);
|
||||
_radius = (_baseRadiusBeforeScale * details.scale).clamp(0.5, 0.82);
|
||||
_innerRadius = _radius * _currentEspacementRatio;
|
||||
_initRingRadii(forceRecalculate: true);
|
||||
} else if (_isDraggingCenter) {
|
||||
|
||||
Reference in New Issue
Block a user