Class: Hokusai::Automation::DriverCommands::TriggerMouseDrag
- Includes:
- MouseMethods
- Defined in:
- ui/src/hokusai/automation/driver_commands/trigger_mouse.rb
Instance Attribute Summary collapse
-
#button ⇒ Object
Returns the value of attribute button.
-
#cursory_y ⇒ Object
Returns the value of attribute cursory_y.
-
#dragging ⇒ Object
Returns the value of attribute dragging.
Attributes inherited from Base
#last_parent, #request_id, #state, #status
Instance Method Summary collapse
- #execute(blocks, canvas, input) ⇒ Object
-
#initialize(hash) ⇒ TriggerMouseDrag
constructor
A new instance of TriggerMouseDrag.
- #location ⇒ Object
- #on_complete ⇒ Object
- #x ⇒ Object
- #y ⇒ Object
Methods included from MouseMethods
Methods inherited from Base
#matches_block, #matches_blocks, #mouse_center, #mouse_move
Constructor Details
#initialize(hash) ⇒ TriggerMouseDrag
Returns a new instance of TriggerMouseDrag.
138 139 140 141 142 143 144 |
# File 'ui/src/hokusai/automation/driver_commands/trigger_mouse.rb', line 138 def initialize(hash) @dragging = false @cursory_y = 0.0 @button = 0 super end |
Instance Attribute Details
#button ⇒ Object
Returns the value of attribute button.
136 137 138 |
# File 'ui/src/hokusai/automation/driver_commands/trigger_mouse.rb', line 136 def @button end |
#cursory_y ⇒ Object
Returns the value of attribute cursory_y.
136 137 138 |
# File 'ui/src/hokusai/automation/driver_commands/trigger_mouse.rb', line 136 def cursory_y @cursory_y end |
#dragging ⇒ Object
Returns the value of attribute dragging.
136 137 138 |
# File 'ui/src/hokusai/automation/driver_commands/trigger_mouse.rb', line 136 def dragging @dragging end |
Instance Method Details
#execute(blocks, canvas, input) ⇒ Object
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'ui/src/hokusai/automation/driver_commands/trigger_mouse.rb', line 164 def execute(blocks, canvas, input) if matches_block(blocks[0]) local_x = x || canvas.x + (canvas.width / 2.0) local_y = y || canvas.y + (canvas.height / 2.0) if cursor_y < local_y && dragging trigger_mouse(input, down: true) mouse_move(local_x, cursor_y, input) self.cursor_y += 2.0 elsif !dragging trigger_mouse(input, clicked: true) self.dragging = true else self.dragging = false done! end end end |
#location ⇒ Object
146 147 148 |
# File 'ui/src/hokusai/automation/driver_commands/trigger_mouse.rb', line 146 def location state[:uuid] end |
#on_complete ⇒ Object
158 159 160 161 162 |
# File 'ui/src/hokusai/automation/driver_commands/trigger_mouse.rb', line 158 def on_complete return false if dragging true end |
#x ⇒ Object
150 151 152 |
# File 'ui/src/hokusai/automation/driver_commands/trigger_mouse.rb', line 150 def x state[:x] end |
#y ⇒ Object
154 155 156 |
# File 'ui/src/hokusai/automation/driver_commands/trigger_mouse.rb', line 154 def y state[:y] end |