natiny.view.get_pressed
Lua
natiny.view.get_pressed(view) -> pressed
Returns whether a view is held: the pointer went down on it or on one of its
pickable descendants and has not been released.
Parameters
| Name |
Type |
Description |
view |
number |
View handle |
Returns
| Type |
Description |
boolean |
true from the press until the release, wherever the pointer is in between |
Example
Lua
natiny.view.set_hook(button, natiny.view.HOOK_DRAW, function(self)
local x, y, w, h = natiny.view.get_rect(self)
if natiny.view.get_pressed(self) then y = y + 1 end
natiny.render.rectangle(x, y, w, h)
end)