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

: (target: Float, base: Integer | Float) -> void



160
161
162
163
# File 'lib/fusuma/plugin/detectors/pinch_detector.rb', line 160

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

Instance Method Details

#calcObject

: () -> String



171
172
173
174
175
176
177
# File 'lib/fusuma/plugin/detectors/pinch_detector.rb', line 171

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

#to_sObject

: () -> String



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

def to_s
  calc
end