@@ -48,14 +48,16 @@ class _PolylinePainter<R extends Object> extends CustomPainter
4848 points: projectedPolyline.points,
4949 shift: shift,
5050 );
51- if (! areOffsetsVisible (offsets)) return WorldWorkControl .invisible;
5251
5352 final strokeWidth = polyline.useStrokeWidthInMeter
5453 ? metersToScreenPixels (
55- projectedPolyline.polyline.points.first,
56- polyline.strokeWidth,
57- )
54+ projectedPolyline.polyline.points.first,
55+ polyline.strokeWidth,
56+ )
5857 : polyline.strokeWidth;
58+
59+ if (! areOffsetsVisible (offsets, strokeWidth)) return WorldWorkControl .invisible;
60+
5961 final hittableDistance = math.max (
6062 strokeWidth / 2 + polyline.borderStrokeWidth / 2 ,
6163 minimumHitbox,
@@ -133,18 +135,6 @@ class _PolylinePainter<R extends Object> extends CustomPainter
133135 points: projectedPolyline.points,
134136 shift: shift,
135137 );
136- if (! areOffsetsVisible (offsets)) return WorldWorkControl .invisible;
137-
138- final hash = polyline.renderHashCode;
139- if (needsLayerSaving || (lastHash != null && lastHash != hash)) {
140- drawPaths ();
141- }
142- lastHash = hash;
143- needsLayerSaving = polyline.color.a < 1 ||
144- (polyline.gradientColors? .any ((c) => c.a < 1 ) ?? false );
145-
146- // strokeWidth, or strokeWidth + borderWidth if relevant.
147- late double largestStrokeWidth;
148138
149139 late final double strokeWidth;
150140 if (polyline.useStrokeWidthInMeter) {
@@ -155,7 +145,19 @@ class _PolylinePainter<R extends Object> extends CustomPainter
155145 } else {
156146 strokeWidth = polyline.strokeWidth;
157147 }
158- largestStrokeWidth = strokeWidth;
148+
149+ if (! areOffsetsVisible (offsets, strokeWidth)) return WorldWorkControl .invisible;
150+
151+ final hash = polyline.renderHashCode;
152+ if (needsLayerSaving || (lastHash != null && lastHash != hash)) {
153+ drawPaths ();
154+ }
155+ lastHash = hash;
156+ needsLayerSaving = polyline.color.a < 1 ||
157+ (polyline.gradientColors? .any ((c) => c.a < 1 ) ?? false );
158+
159+ // strokeWidth, or strokeWidth + borderWidth if relevant.
160+ double largestStrokeWidth = strokeWidth;
159161
160162 final isSolid = polyline.pattern == const StrokePattern .solid ();
161163 final isDashed = polyline.pattern.segments != null ;
0 commit comments