#124 Add set_click_zone to scroll component

This commit is contained in:
Insality 2021-04-01 20:32:29 +03:00
parent fe3ac2e985
commit 7c79985be6
3 changed files with 13 additions and 3 deletions

View File

@ -139,3 +139,4 @@ Desc
- Input component: rename field _selected_ to _is_selected_ (according to the docs)
- Add EmmyLua annotations. See how to use it FAQ
- Lang text now can be initialized without default locale id
- **#124** Add _set_click_zone_ functon to Scroll component (just link to Drag:set_click_zone inside scroll component)

View File

@ -263,9 +263,9 @@ end
--- Strict drag click area. Useful for
-- restrict events outside stencil node
-- @tparam Drag self
-- @tparam node zone Gui node
function Drag.set_click_zone(self, zone)
self.click_zone = self:get_node(zone)
-- @tparam node node Gui node
function Drag.set_click_zone(self, node)
self.click_zone = self:get_node(node)
end

View File

@ -379,6 +379,15 @@ function Scroll.bind_grid(self, grid)
end
--- Strict drag scroll area. Useful for
-- restrict events outside stencil node
-- @tparam Drag self
-- @tparam node node Gui node
function Scroll.set_click_zone(self, node)
self.drag:set_click_zone(node)
end
function Scroll._on_scroll_drag(self, dx, dy)
local t = self.target_position
local b = self.available_pos