# Module `Drag`

Component to handle drag action on node.

Drag have correct handling for multitouch and swap touched while dragging. Drag will be processed even the cursor is outside of node, if drag is already started

Example Link

## Functions

init(self, node, on_drag_callback) | The Drag constructor
is_enabled(self) | Check if Drag component is enabled
set_click_zone(self, node) | Strict drag click area.
set_enabled(self, is_enabled) | Set Drag input enabled or disabled

## Tables

style | Component style params.

## Fields

can_x | Is drag component process vertical dragging.
can_y | Is drag component process horizontal.
is_drag | Is component now dragging
is_touch | Is component now touching
node | Drag node
on_drag | on drag progress callback(self, dx, dy, total_x, total_y, touch)
on_drag_end | Event on drag end callback(self, total_x, total_y, touch)
on_drag_start | Event on drag start callback(self, touch)
on_touch_end | Event on touch end callback(self)
on_touch_start | Event on touch start callback(self)
screen_x | Current touch x screen position
screen_y | Current touch y screen position
touch_start_pos | Touch start position
x | Current touch x position
y | Current touch y position

## Functions

init(self, node, on_drag_callback)
  The Drag constructor

  ### Parameters:

  - self Drag Drag
  - node node GUI node to detect dragging
  - on_drag_callback function Callback for on_drag_event(self, dx, dy)
is_enabled(self)
  Check if Drag component is enabled

  ### Parameters:

  - self Drag Drag

  ### Returns:

  boolean
set_click_zone(self, node)
  Strict drag click area. Useful for restrict events outside stencil node

  ### Parameters:

  - self Drag Drag
  - node node, string or nil Gui node
set_enabled(self, is_enabled)
  Set Drag input enabled or disabled

  ### Parameters:

  - self Drag Drag
  - is_enabled boolean or nil

## Tables

style
  Component style params. You can override this component styles params in druid styles table or create your own style

  ### Fields:

  - DRAG_DEADZONE number or nil Distance in pixels to start dragging. Default: 10
  - NO_USE_SCREEN_KOEF boolean or nil If screen aspect ratio affects on drag values. Default: false

## Fields

can_x
  Is drag component process vertical dragging. Default - true
  - can_x boolean
can_y
  Is drag component process horizontal. Default - true
  - can_y boolean
is_drag
  Is component now dragging
  - is_drag boolean
is_touch
  Is component now touching
  - is_touch boolean
node
  Drag node
  - node node
on_drag
  on drag progress callback(self, dx, dy, total_x, total_y, touch)
  - on_drag DruidEvent Event DruidEvent
on_drag_end
  Event on drag end callback(self, total_x, total_y, touch)
  - on_drag_end DruidEvent DruidEvent
on_drag_start
  Event on drag start callback(self, touch)
  - on_drag_start DruidEvent DruidEvent
on_touch_end
  Event on touch end callback(self)
  - on_touch_end DruidEvent DruidEvent
on_touch_start
  Event on touch start callback(self)
  - on_touch_start DruidEvent DruidEvent
screen_x
  Current touch x screen position
  - screen_x number
screen_y
  Current touch y screen position
  - screen_y number
touch_start_pos
  Touch start position
  - touch_start_pos vector3
x
  Current touch x position
  - x number
y
  Current touch y position
  - y number

generated by LDoc TESTING Last updated 2015-01-01 12:00:00