Class: Fusuma::GestureAction
- Inherits:
-
Object
- Object
- Fusuma::GestureAction
- Defined in:
- lib/fusuma/gesture_action.rb
Overview
pinch or swipe action
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#finger ⇒ Object
readonly
Returns the value of attribute finger.
-
#move_x ⇒ Object
readonly
Returns the value of attribute move_x.
-
#move_y ⇒ Object
readonly
Returns the value of attribute move_y.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#zoom ⇒ Object
readonly
Returns the value of attribute zoom.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(time, action, finger, directions) ⇒ GestureAction
constructor
A new instance of GestureAction.
Constructor Details
#initialize(time, action, finger, directions) ⇒ GestureAction
Returns a new instance of GestureAction.
4 5 6 7 8 9 10 11 |
# File 'lib/fusuma/gesture_action.rb', line 4 def initialize(time, action, finger, directions) @time = time.to_f @action = action @finger = finger @move_x = directions[:move][:x].to_f @move_y = directions[:move][:y].to_f @zoom = directions[:zoom].to_f end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
12 13 14 |
# File 'lib/fusuma/gesture_action.rb', line 12 def action @action end |
#finger ⇒ Object (readonly)
Returns the value of attribute finger.
12 13 14 |
# File 'lib/fusuma/gesture_action.rb', line 12 def finger @finger end |
#move_x ⇒ Object (readonly)
Returns the value of attribute move_x.
12 13 14 |
# File 'lib/fusuma/gesture_action.rb', line 12 def move_x @move_x end |
#move_y ⇒ Object (readonly)
Returns the value of attribute move_y.
12 13 14 |
# File 'lib/fusuma/gesture_action.rb', line 12 def move_y @move_y end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
12 13 14 |
# File 'lib/fusuma/gesture_action.rb', line 12 def time @time end |
#zoom ⇒ Object (readonly)
Returns the value of attribute zoom.
12 13 14 |
# File 'lib/fusuma/gesture_action.rb', line 12 def zoom @zoom end |
Class Method Details
.initialize_by(line, device_names) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/fusuma/gesture_action.rb', line 16 def initialize_by(line, device_names) return if device_names.none? do |device_name| line.to_s =~ /^\s?#{device_name}/ end return if line.to_s =~ /_BEGIN/ return unless line.to_s =~ /GESTURE_SWIPE|GESTURE_PINCH/ time, action, finger, directions = gesture_action_arguments(line) MultiLogger.debug(time: time, action: action, finger: finger, directions: directions) GestureAction.new(time, action, finger, directions) end |