mirror of
https://github.com/Insality/druid.git
synced 2025-06-27 10:27:47 +02:00
Solve #195 Add set_enabled to Drag component
This commit is contained in:
parent
0107c015a1
commit
43f75cd820
@ -176,6 +176,7 @@ function Drag.init(self, node, on_drag_callback)
|
||||
self.is_touch = false
|
||||
self.is_drag = false
|
||||
self.touch_start_pos = vmath.vector3(0)
|
||||
self._is_disabled = false
|
||||
|
||||
self.can_x = true
|
||||
self.can_y = true
|
||||
@ -220,7 +221,7 @@ function Drag.on_input(self, action_id, action)
|
||||
return false
|
||||
end
|
||||
|
||||
if not helper.is_enabled(self.node) then
|
||||
if not helper.is_enabled(self.node) or self._is_disabled then
|
||||
return false
|
||||
end
|
||||
|
||||
@ -293,4 +294,21 @@ function Drag.set_click_zone(self, node)
|
||||
end
|
||||
|
||||
|
||||
--- Set Drag input enabled or disabled
|
||||
-- @tparam Drag self @{Drag}
|
||||
-- @tparam bool is enabled
|
||||
function Drag.set_enabled(self, is_enabled)
|
||||
self._is_disabled = not is_enabled
|
||||
end
|
||||
|
||||
|
||||
--- Check if Drag component is enabled
|
||||
-- @tparam Drag self @{Drag}
|
||||
-- @treturn bool
|
||||
function Drag.is_enabled(self)
|
||||
return self._is_disabled
|
||||
end
|
||||
|
||||
|
||||
|
||||
return Drag
|
||||
|
Loading…
x
Reference in New Issue
Block a user