mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-12 08:50:30 +00:00
feat: Implement auto-zoom functionality for preselected contacts and SAR markers in DetailedCompassDialog
This commit is contained in:
@@ -299,11 +299,11 @@ class _LargeCompassPainter extends CustomPainter {
|
|||||||
..style = PaintingStyle.fill;
|
..style = PaintingStyle.fill;
|
||||||
canvas.drawCircle(Offset(dotX, dotY), dotSize, dotPaint);
|
canvas.drawCircle(Offset(dotX, dotY), dotSize, dotPaint);
|
||||||
|
|
||||||
// Draw white border
|
// Draw darker shade border (same color family)
|
||||||
final borderPaint = Paint()
|
final borderPaint = Paint()
|
||||||
..color = Colors.white
|
..color = Colors.blue.shade800
|
||||||
..style = PaintingStyle.stroke
|
..style = PaintingStyle.stroke
|
||||||
..strokeWidth = 2;
|
..strokeWidth = 2.5;
|
||||||
canvas.drawCircle(Offset(dotX, dotY), dotSize, borderPaint);
|
canvas.drawCircle(Offset(dotX, dotY), dotSize, borderPaint);
|
||||||
|
|
||||||
// Draw distance label near the contact (only if not too crowded)
|
// Draw distance label near the contact (only if not too crowded)
|
||||||
@@ -388,21 +388,27 @@ class _LargeCompassPainter extends CustomPainter {
|
|||||||
|
|
||||||
// Determine color based on SAR marker type
|
// Determine color based on SAR marker type
|
||||||
Color markerColor;
|
Color markerColor;
|
||||||
|
Color borderColor;
|
||||||
switch (marker.type) {
|
switch (marker.type) {
|
||||||
case SarMarkerType.foundPerson:
|
case SarMarkerType.foundPerson:
|
||||||
markerColor = Colors.green;
|
markerColor = Colors.green;
|
||||||
|
borderColor = Colors.green.shade900;
|
||||||
break;
|
break;
|
||||||
case SarMarkerType.fire:
|
case SarMarkerType.fire:
|
||||||
markerColor = Colors.red;
|
markerColor = Colors.red;
|
||||||
|
borderColor = Colors.red.shade900;
|
||||||
break;
|
break;
|
||||||
case SarMarkerType.stagingArea:
|
case SarMarkerType.stagingArea:
|
||||||
markerColor = Colors.orange;
|
markerColor = Colors.orange;
|
||||||
|
borderColor = Colors.orange.shade900;
|
||||||
break;
|
break;
|
||||||
case SarMarkerType.object:
|
case SarMarkerType.object:
|
||||||
markerColor = Colors.purple;
|
markerColor = Colors.purple;
|
||||||
|
borderColor = Colors.purple.shade900;
|
||||||
break;
|
break;
|
||||||
case SarMarkerType.unknown:
|
case SarMarkerType.unknown:
|
||||||
markerColor = Colors.grey;
|
markerColor = Colors.grey;
|
||||||
|
borderColor = Colors.grey.shade900;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -424,9 +430,9 @@ class _LargeCompassPainter extends CustomPainter {
|
|||||||
..style = PaintingStyle.fill;
|
..style = PaintingStyle.fill;
|
||||||
canvas.drawCircle(Offset(dotX, dotY), dotSize, dotPaint);
|
canvas.drawCircle(Offset(dotX, dotY), dotSize, dotPaint);
|
||||||
|
|
||||||
// Draw white border
|
// Draw darker shade border (same color family)
|
||||||
final borderPaint = Paint()
|
final borderPaint = Paint()
|
||||||
..color = Colors.white
|
..color = borderColor
|
||||||
..style = PaintingStyle.stroke
|
..style = PaintingStyle.stroke
|
||||||
..strokeWidth = 2.5;
|
..strokeWidth = 2.5;
|
||||||
canvas.drawCircle(Offset(dotX, dotY), dotSize, borderPaint);
|
canvas.drawCircle(Offset(dotX, dotY), dotSize, borderPaint);
|
||||||
|
|||||||
@@ -63,6 +63,14 @@ class _DetailedCompassDialogState extends State<DetailedCompassDialog> {
|
|||||||
_selectedContact = widget.preSelectedContact;
|
_selectedContact = widget.preSelectedContact;
|
||||||
_selectedSarMarker = widget.preSelectedSarMarker;
|
_selectedSarMarker = widget.preSelectedSarMarker;
|
||||||
|
|
||||||
|
// Auto-zoom if item is preselected
|
||||||
|
if (_selectedContact != null || _selectedSarMarker != null) {
|
||||||
|
// Use post-frame callback to ensure position is set
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
_autoZoomForSelection();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Subscribe to compass updates
|
// Subscribe to compass updates
|
||||||
final compassStream = FlutterCompass.events;
|
final compassStream = FlutterCompass.events;
|
||||||
if (compassStream != null) {
|
if (compassStream != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user