class Fusuma::Plugin::Detectors::SwipeDetector::Direction

direction of gesture

Constants

DOWN
LEFT
UP

Public Class Methods

new(move_x:, move_y:) click to toggle source
# File lib/fusuma/plugin/detectors/swipe_detector.rb, line 138
def initialize(move_x:, move_y:)
  @move_x = move_x.to_f
  @move_y = move_y.to_f
end

Public Instance Methods

calc() click to toggle source
# File lib/fusuma/plugin/detectors/swipe_detector.rb, line 147
def calc
  if @move_x.abs > @move_y.abs
    @move_x.positive? ? RIGHT : LEFT
  elsif @move_y.positive?
    DOWN
  else
    UP
  end
end
to_s() click to toggle source
# File lib/fusuma/plugin/detectors/swipe_detector.rb, line 143
def to_s
  calc
end