fixOffset method

void fixOffset()

Fixes the scroll offset position.

This method adjusts or fixes the scroll offset of the ruler based on certain conditions. It may be used when the ruler's position needs to be locked or adjusted to a specific point, for example, when a value or scale is selected.

Implementation

void fixOffset() {
  int tempFixedOffset = (scrollController.offset + 0.5) ~/ 1;

  double fixedOffset = (tempFixedOffset + _ruleScaleInterval / 2) ~/
      _ruleScaleInterval.toInt() *
      _ruleScaleInterval;
  Future.delayed(Duration.zero, () {
    scrollController.animateTo(fixedOffset,
        duration: const Duration(milliseconds: 50),
        curve: Curves.bounceInOut);
  });
}