diff --git a/lib/dev_config.dart b/lib/dev_config.dart index 3c91cd5..f0ebb81 100644 --- a/lib/dev_config.dart +++ b/lib/dev_config.dart @@ -16,7 +16,8 @@ const double kDirectionConeHalfAngle = 35.0; // degrees const double kDirectionConeBaseLength = 5; // multiplier const Color kDirectionConeColor = Color(0xD0767474); // FOV cone color const double kDirectionConeOpacity = 0.6; // Fill opacity for FOV cones -const double kDirectionConeBorderWidth = 1.6 * MediaQuery.of(context).devicePixelRatio; // Border stroke width for FOV cones +// Base values for thickness - use helper functions below for pixel-ratio scaling +const double _kDirectionConeBorderWidthBase = 1.6; // Bottom button bar positioning const double kBottomButtonBarOffset = 4.0; // Distance from screen bottom (above safe area) @@ -89,7 +90,7 @@ const int kAbsoluteMaxZoom = 23; // Node icon configuration const double kNodeIconDiameter = 18.0; -const double kNodeRingThickness = 2.5 * MediaQuery.of(context).devicePixelRatio; +const double _kNodeRingThicknessBase = 2.5; const double kNodeDotOpacity = 0.3; // Opacity for the grey dot interior const Color kNodeRingColorReal = Color(0xFF3036F0); // Real nodes from OSM - blue const Color kNodeRingColorMock = Color(0xD0FFFFFF); // Add node mock point - white @@ -97,3 +98,12 @@ const Color kNodeRingColorPending = Color(0xD09C27B0); // Submitted/pending node const Color kNodeRingColorEditing = Color(0xD0FF9800); // Node being edited - orange const Color kNodeRingColorPendingEdit = Color(0xD0757575); // Original node with pending edit - grey const Color kNodeRingColorPendingDeletion = Color(0xC0F44336); // Node pending deletion - red, slightly transparent + +// Helper functions for pixel-ratio scaling +double getDirectionConeBorderWidth(BuildContext context) { + return _kDirectionConeBorderWidthBase * MediaQuery.of(context).devicePixelRatio; +} + +double getNodeRingThickness(BuildContext context) { + return _kNodeRingThicknessBase * MediaQuery.of(context).devicePixelRatio; +} diff --git a/lib/widgets/camera_icon.dart b/lib/widgets/camera_icon.dart index 46e2578..4fa015a 100644 --- a/lib/widgets/camera_icon.dart +++ b/lib/widgets/camera_icon.dart @@ -43,7 +43,7 @@ class CameraIcon extends StatelessWidget { color: _ringColor.withOpacity(kNodeDotOpacity), border: Border.all( color: _ringColor, - width: kNodeRingThickness, + width: getNodeRingThickness(context), ), ), ); diff --git a/lib/widgets/map/direction_cones.dart b/lib/widgets/map/direction_cones.dart index c715847..2c58424 100644 --- a/lib/widgets/map/direction_cones.dart +++ b/lib/widgets/map/direction_cones.dart @@ -14,6 +14,7 @@ class DirectionConesBuilder { required double zoom, AddNodeSession? session, EditNodeSession? editSession, + required BuildContext context, }) { final overlays = []; @@ -23,6 +24,7 @@ class DirectionConesBuilder { session.target!, session.directionDegrees, zoom, + context: context, isSession: true, )); } @@ -33,6 +35,7 @@ class DirectionConesBuilder { editSession.target, editSession.directionDegrees, zoom, + context: context, isSession: true, )); } @@ -46,6 +49,7 @@ class DirectionConesBuilder { n.coord, n.directionDeg!, zoom, + context: context, )) ); @@ -69,6 +73,7 @@ class DirectionConesBuilder { LatLng origin, double bearingDeg, double zoom, { + required BuildContext context, bool isPending = false, bool isSession = false, }) { @@ -76,7 +81,7 @@ class DirectionConesBuilder { // Calculate pixel-based radii final outerRadiusPx = kNodeIconDiameter + (kNodeIconDiameter * kDirectionConeBaseLength); - final innerRadiusPx = kNodeIconDiameter + (2 * kNodeRingThickness); + final innerRadiusPx = kNodeIconDiameter + (2 * getNodeRingThickness(context)); // Convert pixels to coordinate distances with zoom scaling final pixelToCoordinate = 0.00001 * math.pow(2, 15 - zoom); @@ -113,7 +118,7 @@ class DirectionConesBuilder { points: points, color: kDirectionConeColor.withOpacity(kDirectionConeOpacity), borderColor: kDirectionConeColor, - borderStrokeWidth: kDirectionConeBorderWidth, + borderStrokeWidth: getDirectionConeBorderWidth(context), ); } } \ No newline at end of file diff --git a/lib/widgets/map_view.dart b/lib/widgets/map_view.dart index 6cf737f..3aad009 100644 --- a/lib/widgets/map_view.dart +++ b/lib/widgets/map_view.dart @@ -409,6 +409,7 @@ class MapViewState extends State { zoom: currentZoom, session: session, editSession: editSession, + context: context, ); // Add suspected location bounds if one is selected