lib/fusuma/plugin/detectors/tap_detector.rb in fusuma-plugin-tap-0.1.0 vs lib/fusuma/plugin/detectors/tap_detector.rb in fusuma-plugin-tap-0.1.1

- old
+ new

@@ -36,13 +36,13 @@ buffer.clear index = create_index(finger: finger, direction: direction) - return create_event(record: Events::Records::IndexRecord.new(index: index)) if enough?(index: index, direction: direction) + return unless enough?(index: index, direction: direction) - nil + create_event(record: Events::Records::IndexRecord.new(index: index)) end # @return [Config::Index] def create_index(finger:, direction:) Config::Index.new( @@ -54,10 +54,12 @@ end def hold?(buffer, holding_time) return false if holding_time < 1 - true if buffer.finger == 4 || buffer.events.any? { |e| e.record.status == 'hold' } + return true if buffer.finger == 4 + + true if buffer.events.any? { |e| e.record.status == 'hold' } end def tap?(buffer, holding_time) return false if holding_time > 0.15