# Defold Druid UI Library

# 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

## Functions

init(self, node, on_drag_callback) | Drag component 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
on_drag | on drag progress callback(self, dx, dy, total_x, total_y)
on_drag_end | Event on drag end callback(self, total_x, total_y)
on_drag_start | Event on drag start callback(self)
on_touch_end | Event on touch end callback(self)
on_touch_start | Event on touch start callback(self)
touch_start_pos | Touch start position
x | Current touch x position
y | Current touch y position

## Functions

init(self, node, on_drag_callback)
  Drag component 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:

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

  ### Parameters:

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

  ### Parameters:

  - self Drag Drag
  - is_enabled bool

## 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 Distance in pixels to start dragging (default 10)

## Fields

can_x
  Is drag component process vertical dragging. Default - true
  - can_x bool
can_y
  Is drag component process horizontal. Default - true
  - can_y bool
is_drag
  Is component now dragging
  - is_drag bool
is_touch
  Is component now touching
  - is_touch bool
on_drag
  on drag progress callback(self, dx, dy, total_x, total_y)
  - on_drag DruidEvent Event DruidEvent
on_drag_end
  Event on drag end callback(self, total_x, total_y)
  - on_drag_end DruidEvent DruidEvent
on_drag_start
  Event on drag start callback(self)
  - 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
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