Table of Contents

Class DragAutoScroll

Namespace
SharpConsoleUI.Helpers
Assembly
SharpConsoleUI.dll

Pure step computation for drag-select autoscroll. Given the cursor's control-relative Y, the viewport height in rows, and the frame's elapsed time, returns the signed number of rows to scroll this frame. Distance-accelerated and time-normalized, with a fractional carry so speed stays smooth at any frame rate. No clock, no threads — fully unit-testable.

public static class DragAutoScroll
Inheritance
DragAutoScroll
Inherited Members

Methods

ComputeStep(int, int, double, ref double)

Computes the rows to scroll this frame (signed; negative = up, positive = down, 0 = none).

public static int ComputeStep(int dragRelativeY, int viewportHeightRows, double elapsedMs, ref double carry)

Parameters

dragRelativeY int

Last drag Y in control-relative rows (may be <0 or ≥ viewport height).

viewportHeightRows int

The control's visible viewport height, in rows.

elapsedMs double

Milliseconds elapsed since the previous frame.

carry double

Sub-row remainder carried across frames. Reset to 0 when in-bounds.

Returns

int