refactor: cible du plotting cliquable et fixe, retrait bouton modifier impacts
This commit is contained in:
@@ -25,7 +25,6 @@ import 'widgets/target_overlay.dart';
|
|||||||
import 'widgets/target_calibration.dart';
|
import 'widgets/target_calibration.dart';
|
||||||
import 'widgets/score_card.dart';
|
import 'widgets/score_card.dart';
|
||||||
import 'widgets/grouping_stats.dart';
|
import 'widgets/grouping_stats.dart';
|
||||||
import 'widgets/shot_details_sheet.dart';
|
|
||||||
|
|
||||||
class AnalysisScreen extends StatelessWidget {
|
class AnalysisScreen extends StatelessWidget {
|
||||||
final String imagePath;
|
final String imagePath;
|
||||||
@@ -111,15 +110,11 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
bool _isAtBottom = false;
|
bool _isAtBottom = false;
|
||||||
|
|
||||||
final ScrollController _scrollController = ScrollController();
|
final ScrollController _scrollController = ScrollController();
|
||||||
final TransformationController _transformationController =
|
|
||||||
TransformationController();
|
|
||||||
final GlobalKey _imageKey = GlobalKey();
|
final GlobalKey _imageKey = GlobalKey();
|
||||||
double _currentZoomScale = 1.0;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_transformationController.addListener(_onTransformChanged);
|
|
||||||
_scrollController.addListener(_onScroll);
|
_scrollController.addListener(_onScroll);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,31 +132,16 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_transformationController.removeListener(_onTransformChanged);
|
|
||||||
_transformationController.dispose();
|
|
||||||
_scrollController.removeListener(_onScroll);
|
_scrollController.removeListener(_onScroll);
|
||||||
_scrollController.dispose();
|
_scrollController.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onTransformChanged() {
|
/// Repasse en mode calibration.
|
||||||
final scale = _transformationController.value.getMaxScaleOnAxis();
|
|
||||||
if (scale != _currentZoomScale) {
|
|
||||||
setState(() {
|
|
||||||
_currentZoomScale = scale;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Repasse en mode calibration en réinitialisant le zoom de l'InteractiveViewer.
|
|
||||||
///
|
///
|
||||||
/// Sans cette remise à zéro, le facteur de zoom accumulé en mode Plotting
|
/// La cible du mode Plotting est désormais un élément fixe (aucun zoom à
|
||||||
/// persiste dans le TransformationController et se réapplique au retour,
|
/// réinitialiser) : on se contente donc de rebasculer l'état.
|
||||||
/// ce qui faisait "zoomer" légèrement la photo. On repart donc toujours
|
|
||||||
/// d'une transformation identité (zoom 1.0).
|
|
||||||
void _enterCalibration() {
|
void _enterCalibration() {
|
||||||
_transformationController.value = Matrix4.identity();
|
|
||||||
_currentZoomScale = 1.0;
|
|
||||||
setState(() => _isCalibrating = true);
|
setState(() => _isCalibrating = true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,27 +396,6 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
padding: const EdgeInsets.all(AppConstants.defaultPadding),
|
padding: const EdgeInsets.all(AppConstants.defaultPadding),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Card(
|
|
||||||
color: AppTheme.primaryColor.withValues(alpha: 0.18),
|
|
||||||
child: ListTile(
|
|
||||||
leading: const Icon(
|
|
||||||
Icons.edit_location_alt,
|
|
||||||
color: AppTheme.primaryColor,
|
|
||||||
),
|
|
||||||
title: const Text('Modifier les impacts'),
|
|
||||||
subtitle: const Text(
|
|
||||||
'Ajouter, déplacer ou supprimer des impacts (plein écran)',
|
|
||||||
),
|
|
||||||
trailing: const Icon(
|
|
||||||
Icons.open_in_full,
|
|
||||||
size: 16,
|
|
||||||
),
|
|
||||||
// Rouvre l'éditeur plein écran en partageant le provider.
|
|
||||||
onTap: () =>
|
|
||||||
_openImpactEditor(context.read<AnalysisProvider>()),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
Card(
|
Card(
|
||||||
color: AppTheme.primaryColor.withValues(alpha: 0.1),
|
color: AppTheme.primaryColor.withValues(alpha: 0.1),
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
@@ -606,20 +565,19 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
|
|
||||||
/// Affichage du plotting en LECTURE SEULE.
|
/// Affichage du plotting en LECTURE SEULE.
|
||||||
///
|
///
|
||||||
/// L'édition (ajout / déplacement / suppression) se fait désormais
|
/// La cible est un élément d'écran FIXE : elle ne se déplace pas et ne se
|
||||||
/// exclusivement dans l'éditeur plein écran (ImpactEditorScreen). Ici on se
|
/// zoome pas (plus d'InteractiveViewer). Un tap n'importe où sur la cible
|
||||||
/// contente d'afficher l'image + l'overlay, avec un zoom de consultation.
|
/// ouvre directement l'éditeur d'impacts plein écran (ImpactEditorScreen),
|
||||||
/// Le tap sur un impact ouvre simplement ses détails.
|
/// exactement comme le faisait l'ancien bouton « Modifier les impacts ».
|
||||||
|
/// C'est là que se fait toute l'édition (ajout / déplacement / suppression),
|
||||||
|
/// avec un zoom fiable.
|
||||||
Widget _buildReadOnlyPlotImage(
|
Widget _buildReadOnlyPlotImage(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
AnalysisProvider provider,
|
AnalysisProvider provider,
|
||||||
) {
|
) {
|
||||||
return InteractiveViewer(
|
return GestureDetector(
|
||||||
transformationController: _transformationController,
|
behavior: HitTestBehavior.opaque,
|
||||||
minScale: 1.0,
|
onTap: () => _openImpactEditor(context.read<AnalysisProvider>()),
|
||||||
maxScale: 10.0,
|
|
||||||
boundaryMargin: const EdgeInsets.all(80),
|
|
||||||
panEnabled: true,
|
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Image.file(
|
Image.file(
|
||||||
@@ -635,10 +593,7 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
targetType: provider.targetType!,
|
targetType: provider.targetType!,
|
||||||
shots: provider.shots,
|
shots: provider.shots,
|
||||||
showRings: true,
|
showRings: true,
|
||||||
zoomScale: _currentZoomScale,
|
zoomScale: 1.0,
|
||||||
// Lecture seule : tap sur impact -> détails (consultation).
|
|
||||||
onShotTapped: (shot) =>
|
|
||||||
showShotDetailsSheet(context, provider, shot),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user