# Defold Druid UI Library

# Module `druid.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(node, on_drag_callback) | Drag component constructor
set_click_zone(zone) | Strict drag click area.

## Tables

Events | Component events
Fields | Components fields
Style | Component style params.

## Functions

init(node, on_drag_callback)
  Drag component constructor

  ### Parameters:

  - node node GUI node to detect dragging
  - on_drag_callback function Callback for ondragevent(self, dx, dy)
set_click_zone(zone)
  Strict drag click area. Useful for restrict events outside stencil node

  ### Parameters:

  - zone node Gui node

## Tables

Events
  Component events

  ### Fields:

  - on_touch_start druid_event (self) Event on touch start
  - on_touch_end druid_event (self) Event on touch end
  - on_drag_start druid_event (self) Event on drag start
  - on_drag druid_event (self, dx, dy) Event on drag progress
  - on_drag_end druid_event (self) Event on drag end
Fields
  Components fields

  ### Fields:

  - is_touch bool Is component now touching
  - is_drag bool Is component now dragging
  - can_x bool Is drag component process vertical dragging. Default - true
  - can_y bool Is drag component process horizontal. Default - true
  - x number Current touch x position
  - y number Current touch y position
  - touch_start_pos vector3 Touch start position
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)

generated by LDoc 1.4.6 Last updated 2020-06-14 20:13:02