Skip to content

Commit a2e0a92

Browse files
Tuned LocalStrokeContinuityStage (#237)
- increased stroke distance back to 250.0 pixels
1 parent 8143d9f commit a2e0a92

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/DrawTogether.Actors/Local/StrokeContinuityStage.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public class StrokeContinuityStage : GraphStage<
2525
private readonly TimeSpan _userInactivityTimeout;
2626
private const string UserInactivityTimeout = "user-inactivity-timeout";
2727
private readonly TimeSpan _strokeDisconnectTimeout = TimeSpan.FromMilliseconds(200);
28+
private const double StrokeDisconnectDistance = 250.0; // pixels
2829

2930
// Shape definition for this stage
3031
public override FlowShape<ImmutableList<LocalPaintProtocol.IPaintSessionMessage>, IEnumerable<ConnectedStroke>>
@@ -161,7 +162,7 @@ private IEnumerable<ConnectedStroke> ProcessBatch(ImmutableList<LocalPaintProtoc
161162
// something unusual happened (e.g., user clicked somewhere else) - no need for continuity
162163
var distance = CalculateDistance(activeInfo.LastPoint, pointsToAdd[0]);
163164

164-
if (distance <= 50.0) // Threshold for what we consider "continuous"
165+
if (distance <= StrokeDisconnectDistance) // Threshold for what we consider "continuous"
165166
{
166167
// For perfect continuity, replace the first point with the last point from previous stroke
167168
// This ensures there's not even a sub-pixel gap between strokes

0 commit comments

Comments
 (0)