constrainDelta method

Offset constrainDelta(
  1. Offset delta
)

Constrains an offset to the allowed direction.

Implementation

Offset constrainDelta(Offset delta) {
  switch (this) {
    case DragDirection.horizontal:
      return Offset(delta.dx, 0);
    case DragDirection.vertical:
      return Offset(0, delta.dy);
    case DragDirection.both:
      return delta;
  }
}