mouse_drag event

From ComputerCraft
(Redirected from Event mouse drag)
Jump to navigation Jump to search
  • button : number The mouse button that was pressed
  • x : number The X position of the mouse in the term
  • y : number The Y position of the mouse in the term

Source CC:Tweaked

Occurs every time the mouse moves to a different position while a mouse button is held down (e.g. left click dragging). It will always be called after a mouse_click event.

Note Note: This event is only called on advanced terms, such as an Advanced Computer, Advanced Pocket Computer or Neural Interface.

ExampleExamplePrint coordinates
Prints the mouse coordinates every time the mouse is dragged on the screen.
while true do
  local event, button, x, y = os.pullEvent("mouse_drag")
  print("Dragged to:", x, y)