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

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



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

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

Instance Method Details

#calcObject

: () -> Float



194
195
196
197
198
199
200
# File 'lib/fusuma/plugin/detectors/pinch_detector.rb', line 194

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

#to_fObject

: () -> Float



189
190
191
# File 'lib/fusuma/plugin/detectors/pinch_detector.rb', line 189

def to_f
  calc.to_f
end