Class: Fusuma::Plugin::Detectors::PinchDetector::Quantity

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

Overview

quantity of gesture

Instance Method Summary collapse

Constructor Details

#initialize(target:, base:) ⇒ Quantity

Returns a new instance of Quantity.



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

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

Instance Method Details

#calcObject



182
183
184
185
186
187
188
# File 'lib/fusuma/plugin/detectors/pinch_detector.rb', line 182

def calc
  if @target > @base
    @target / @base
  else
    @base / @target
  end
end

#to_fObject



178
179
180
# File 'lib/fusuma/plugin/detectors/pinch_detector.rb', line 178

def to_f
  calc.to_f
end