getLastOffsetBefore<T> method

double getLastOffsetBefore<T>(
  1. double offset
)

Finds the last snapping offset less than or equal to the given offset.

  • offset: The current offset of the sheet.
  • Returns: The closest snapping offset below or equal to the given offset.

Implementation

double getLastOffsetBefore<T>(double offset) =>
    snappingPixelOffsets.lastWhere(
      (snapOffset) => snapOffset.roundDecimal() <= offset.roundDecimal(),
      orElse: () => snappingPixelOffsets.firstOrNull ?? 0.0,
    );