Owning one-dimensional logical position with floor quantization to integral rows. Integral and fractional parts are stored separately, preserving every uint64 index even above 2^53. Fractions use double precision; no epsilon snapping is performed. Saturation discards overscroll. No allocation, callbacks, tree invalidation or I/O occurs. The owner serializes access; views use UI only.
More...
#include <scroll.hpp>
|
| std::uint64_t | rasterOffset () const noexcept |
| double | fraction () const noexcept |
| std::expected< void, TreeError > | setOffset (std::uint64_t row, double fraction=0) noexcept |
| | Replace the unbounded intended position; call clamp when row count is known.
|
| std::expected< bool, TreeError > | moveBy (double rows, std::uint64_t count) noexcept |
| | Accumulate signed fractional wheel movement, saturating at the first/last row.
|
| void | clamp (std::uint64_t count) noexcept |
| | Bound position to the last logical row; an empty model resets both parts.
|
| std::expected< bool, TreeError > | ensureVisible (std::uint64_t row, std::uint64_t visibleRows, std::uint64_t count) noexcept |
| | Reveal an index with minimal integral movement, without changing an already visible position.
|
Owning one-dimensional logical position with floor quantization to integral rows. Integral and fractional parts are stored separately, preserving every uint64 index even above 2^53. Fractions use double precision; no epsilon snapping is performed. Saturation discards overscroll. No allocation, callbacks, tree invalidation or I/O occurs. The owner serializes access; views use UI only.
◆ clamp()
| void portals::ScrollState::clamp |
( |
std::uint64_t | count | ) |
|
|
noexcept |
Bound position to the last logical row; an empty model resets both parts.
- Parameters
-
| count | Logical row count, independent of materialized storage. |
◆ ensureVisible()
| std::expected< bool, TreeError > portals::ScrollState::ensureVisible |
( |
std::uint64_t | row, |
|
|
std::uint64_t | visibleRows, |
|
|
std::uint64_t | count ) |
|
noexcept |
Reveal an index with minimal integral movement, without changing an already visible position.
- Parameters
-
| row | Target logical index, less than count. |
| visibleRows | Number of fully visible rows; zero means no movement is possible. |
| count | Logical model row count. |
- Returns
- Whether raster position changed, or INVALID_ARGUMENT for an out-of-bounds target.
◆ fraction()
| double portals::ScrollState::fraction |
( |
| ) |
const |
|
noexcept |
- Returns
- Fractional logical remainder in [0,1), in logical rows.
◆ moveBy()
| std::expected< bool, TreeError > portals::ScrollState::moveBy |
( |
double | rows, |
|
|
std::uint64_t | count ) |
|
noexcept |
Accumulate signed fractional wheel movement, saturating at the first/last row.
- Parameters
-
| rows | Finite signed movement in logical rows; positive moves toward the end. |
| count | Logical model row count; zero resets the position. |
- Returns
- Whether the raster position changed, or INVALID_ARGUMENT without mutation for nonfinite input.
◆ rasterOffset()
| std::uint64_t portals::ScrollState::rasterOffset |
( |
| ) |
const |
|
noexcept |
- Returns
- Integral raster position, in logical rows; text is placed on whole cell rows.
◆ setOffset()
| std::expected< void, TreeError > portals::ScrollState::setOffset |
( |
std::uint64_t | row, |
|
|
double | fraction = 0 ) |
|
noexcept |
Replace the unbounded intended position; call clamp when row count is known.
- Parameters
-
| row | Exact integral logical row index. |
| fraction | Fractional row remainder in [0,1); finite values only. |
- Returns
- Success, or INVALID_ARGUMENT without changing state.
The documentation for this class was generated from the following file: