Class: Fusuma::ActionStack

Inherits:
Array
  • Object
show all
Defined in:
lib/fusuma/action_stack.rb

Overview

manage actions

Constant Summary collapse

ELAPSED_TIME =
0.01

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ ActionStack

Returns a new instance of ActionStack.



6
7
8
# File 'lib/fusuma/action_stack.rb', line 6

def initialize(*args)
  super(*args)
end

Instance Method Details

#generate_event_triggerObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/fusuma/action_stack.rb', line 10

def generate_event_trigger
  return unless enough_actions?
  action_type = detect_action_type
  direction = detect_direction(action_type)
  return if direction.nil?
  @last_triggered_time = last.time
  finger = detect_finger
  clear
  EventTrigger.new(finger, direction, action_type)
end

#push(gesture_action) ⇒ Object Also known as: <<



21
22
23
24
# File 'lib/fusuma/action_stack.rb', line 21

def push(gesture_action)
  super(gesture_action)
  clear if action_end?
end