fix(crop): synchroniser les calculs avec le mode BoxFit.cover et activer la découpe physique

This commit is contained in:
qguillaume
2026-05-27 15:16:39 +02:00
parent 4d2ca2c94f
commit b7499f7097
6 changed files with 280 additions and 183 deletions

View File

@@ -162,8 +162,8 @@ class AnalysisProvider extends ChangeNotifier {
return;
}
// Detect target and impacts
final result = _detectionService.detectTarget(imagePath, targetType);
// CORRECTION PARALLÈLE : Changement de la méthode pour l'Isolate asynchrone
final result = await _detectionService.detectTargetAsync(imagePath, targetType);
if (!result.success) {
_state = AnalysisState.error;

View File

@@ -225,12 +225,12 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
return Transform(
transform: Matrix4.identity()
..setTranslationRaw(widget.cropOffset?.dx ?? 0.0, widget.cropOffset?.dy ?? 0.0, 0.0)
..scale(1.0, 1.0) // Zoom ignoré au plotting pour rester en vue globale
..rotateZ((provider.cropRotation) * (math.pi / 180)), // FIX : Utilisation du provider dynamique
..scale(1.0, 1.0)
..rotateZ((provider.cropRotation) * (math.pi / 180)),
alignment: Alignment.center,
child: Image.file(
File(provider.imagePath!),
fit: BoxFit.contain,
fit: BoxFit.cover, // CORRECTION : BoxFit.cover pour s'aligner sur le Crop !
),
);
}
@@ -497,7 +497,7 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
Image.file(
File(provider.imagePath!),
key: _imageKey,
fit: BoxFit.contain,
fit: BoxFit.cover,
),
TargetOverlay(
targetCenterX: provider.targetCenterX,