Class: Fusuma::Plugin::Detectors::PinchDetector::Direction

Inherits:
Object
  • Object
show all
Defined in:
lib/fusuma/plugin/detectors/pinch_detector.rb

Overview

direction of gesture

Constant Summary collapse

IN =
"in"
OUT =
"out"

Instance Method Summary collapse

Constructor Details

#initialize(target:, base:) ⇒ Direction

Returns a new instance of Direction.



153
154
155
156
# File 'lib/fusuma/plugin/detectors/pinch_detector.rb', line 153

def initialize(target:, base:)
  @target = target.to_f
  @base = base.to_f
end

Instance Method Details

#calcObject



162
163
164
165
166
167
168
# File 'lib/fusuma/plugin/detectors/pinch_detector.rb', line 162

def calc
  if @target > @base
    OUT
  else
    IN
  end
end

#to_sObject



158
159
160
# File 'lib/fusuma/plugin/detectors/pinch_detector.rb', line 158

def to_s
  calc
end