Module: MINT
- Included in:
- AUIControl, CUIControl
- Defined in:
- lib/MINT-core/model/task.rb,
lib/MINT-core/agent/agent.rb,
lib/MINT-core/model/ir/ir.rb,
lib/MINT-core/model/aui/AIO.rb,
lib/MINT-core/model/aui/AIIN.rb,
lib/MINT-core/model/ir/mouse.rb,
lib/MINT-core/model/ir/wheel.rb,
lib/MINT-core/mapping/mapping.rb,
lib/MINT-core/model/aui/AIOUT.rb,
lib/MINT-core/model/ir/button.rb,
lib/MINT-core/model/ir/irmode.rb,
lib/MINT-core/model/ir/joypad.rb,
lib/MINT-core/model/ir/screen.rb,
lib/MINT-core/model/interactor.rb,
lib/MINT-core/model/ir/irmedia.rb,
lib/MINT-core/model/ir/pointer.rb,
lib/MINT-core/model/cui/gfx/CIC.rb,
lib/MINT-core/model/cui/gfx/CIO.rb,
lib/MINT-core/mapping/sequential.rb,
lib/MINT-core/model/ir/body/body.rb,
lib/MINT-core/model/ir/body/hand.rb,
lib/MINT-core/model/ir/body/head.rb,
lib/MINT-core/model/ir/body/pose.rb,
lib/MINT-core/model/aui/AICommand.rb,
lib/MINT-core/model/aui/AIContext.rb,
lib/MINT-core/model/cui/gfx/model.rb,
lib/MINT-core/model/cui/gfx/button.rb,
lib/MINT-core/model/aui/AIContainer.rb,
lib/MINT-core/model/aui/AIReference.rb,
lib/MINT-core/manager/mapping_parser.rb,
lib/MINT-core/model/aui/AIINDiscrete.rb,
lib/MINT-core/model/ir/browserscreen.rb,
lib/MINT-core/model/aui/AIMultiChoice.rb,
lib/MINT-core/model/ir/body/fingertip.rb,
lib/MINT-core/model/aui/AIINContinuous.rb,
lib/MINT-core/model/aui/AISingleChoice.rb,
lib/MINT-core/model/interactor_helpers.rb,
lib/MINT-core/model/aui/AIChoiceElement.rb,
lib/MINT-core/model/aui/AIOUTContinuous.rb,
lib/MINT-core/model/cui/gfx/RadioButton.rb,
lib/MINT-core/mapping/sequential_mapping.rb,
lib/MINT-core/model/aui/AISinglePresence.rb,
lib/MINT-core/model/cui/gfx/caroufredsel.rb,
lib/MINT-core/model/ir/body/gesture_button.rb,
lib/MINT-core/mapping/complementary_mapping.rb,
lib/MINT-core/model/aui/AIMultiChoiceElement.rb,
lib/MINT-core/model/cui/gfx/RadioButtonGroup.rb,
lib/MINT-core/model/aui/AISingleChoiceElement.rb,
lib/MINT-core/model/cui/gfx/MarkableRadioButton.rb,
lib/MINT-core/model/ir/body/OneHandPoseNavigation.rb
Defined Under Namespace
Modules: InteractorHelpers
Classes: AIChoiceElement, AICommand, AIContainer, AIContext, AIIN, AIINContinuous, AIINDiscrete, AIMultiChoice, AIMultiChoiceElement, AIO, AIOUT, AIOUTContinuous, AIReference, AISingleChoice, AISingleChoiceElement, AISinglePresence, ARContainer, ARFrame, Agent, ApplicationTask, BasicText, Body, BrowserScreen, Button, CIC, CIO, CarouFredSel, CarouFredSelImage, CheckBoxGroup, ComplementaryMapping, Fingertip, GestureButton, HTMLHead, HWButton, Hand, Head, IR, IRMedia, IRMode, Image, InputInteractionTask, InteractionTask, Interactor, Joypad, Label, Mapping, MappingParser, MarkableRadioButton, MinimalOutputSlider, MinimalVerticalOutputSlider, Mouse, OneHandPoseNavigation, OutputInteractionTask, PTS, Pointer, Pointer3D, Pose, ProgressBar, RadioButton, RadioButtonGroup, Screen, Sequential, SequentialMapping, SingleHighlight, Slider, Task, Wheel
Instance Method Summary
collapse
Instance Method Details
#cache_coordinates(x, y) ⇒ Object
20
21
22
23
|
# File 'lib/MINT-core/model/ir/body/fingertip.rb', line 20
def cache_coordinates(x,y)
@cached_x = x
@cached_y = y
end
|
#cache_touched(touch) ⇒ Object
60
61
62
|
# File 'lib/MINT-core/model/ir/body/fingertip.rb', line 60
def cache_touched(touch)
attribute_set(:touched, touch)
end
|
#consume(id) ⇒ Object
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
# File 'lib/MINT-core/model/ir/body/fingertip.rb', line 74
def consume(id)
return if @subscribed
redis = RedisConnector.redis
redis.pubsub.subscribe("ss:event") { |message|
data = MultiJson.decode message
if data["e"].eql? "touches"
touches = data["p"][0]
touched_value,x,y = touches[0].map &:to_i
x,y = filter x,y
touched_value= (touched_value==0)?false:true
if has_moved? x,y
cache_coordinates x,y
process_event("move") if not is_in? :moving
restart_timeout
else
if is_in? :stopped
if touch_changed? touched_value
if touched_value
process_event :press
else
process_event :release
end
cache_touched touched_value
end
end
end
end
}
@subscribed = true
end
|
#filter(x, y) ⇒ Object
64
65
66
|
# File 'lib/MINT-core/model/ir/body/fingertip.rb', line 64
def filter(x,y)
[(attribute_get(:screen_width) - x),y]
end
|
#has_moved?(x, y) ⇒ Boolean
68
69
70
71
72
|
# File 'lib/MINT-core/model/ir/body/fingertip.rb', line 68
def has_moved?(x,y)
return true if @cached_x.nil? or @cached_y.nil?
return true if ((x-@cached_x).abs > threshold_x) or ((y-@cached_y).abs > threshold_y)
false
end
|
#restart_timeout ⇒ Object
50
51
52
53
|
# File 'lib/MINT-core/model/ir/body/fingertip.rb', line 50
def restart_timeout
stop_timeout
start_timeout
end
|
#start_one_time_tick(time, event) ⇒ Object
44
45
46
47
48
|
# File 'lib/MINT-core/model/ir/body/fingertip.rb', line 44
def start_one_time_tick(time,event)
EventMachine::Timer.new(time) {
process_event event
}
end
|
#start_timeout ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/MINT-core/model/ir/body/fingertip.rb', line 25
def start_timeout
if not @timer
@timer = EventMachine::Timer.new(0.3) do
attribute_set(:x, @cached_x)
attribute_set(:y, @cached_y)
process_event("stop")
end
else
puts "timer already started!!!"
end
end
|
#stop_timeout ⇒ Object
36
37
38
39
40
41
42
|
# File 'lib/MINT-core/model/ir/body/fingertip.rb', line 36
def stop_timeout
if @timer
@timer.cancel
@timer = nil
end
end
|
#touch_changed?(touch) ⇒ Boolean
55
56
57
58
|
# File 'lib/MINT-core/model/ir/body/fingertip.rb', line 55
def touch_changed?(touch)
return true if attribute_get(:touched) != touch
false
end
|