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
style |
Component style params. |
-
init(self, node, on_drag_callback)
-
Drag component constructor
Parameters:
- self
Drag
- node
node
GUI node to detect dragging
- on_drag_callback
function
Callback for on_drag_event(self, dx, dy)
-
set_click_zone(self, node)
-
Strict drag click area. Useful for
restrict events outside stencil node
Parameters:
- self
Drag
- node
node
Gui node
-
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)
-
on_touch_start
-
Event on touch start callback(self)
- on_touch_start
druid_event
-
on_touch_end
-
Event on touch end callback(self)
-
on_drag_start
-
Event on drag start callback(self)
- on_drag_start
druid_event
-
on_drag
-
on drag progress callback(self, dx, dy)
- on_drag
druid_event
Event
-
on_drag_end
-
Event on drag end callback(self)
-
is_touch
-
Is component now touching
-
is_drag
-
Is component now dragging
-
can_x
-
Is drag component process vertical dragging. Default - true
-
can_y
-
Is drag component process horizontal. Default - true
-
x
-
Current touch x position
-
y
-
Current touch y position
-
touch_start_pos
-
Touch start position