Update with container examples

This commit is contained in:
Insality
2025-04-25 01:13:04 +03:00
parent 8155d649ab
commit 749666a4a5
12 changed files with 1111 additions and 56 deletions

View File

@@ -38,13 +38,13 @@ end
function M:on_input(action_id, action)
if action_id == nil and gui.pick_node(self.root, action.x, action.y) then
local root_screen_pos = gui.get_screen_position(self.root)
local gui_scale = helper.get_gui_scale()
local koef_x, koef_y = helper.get_screen_aspect_koef()
local dx = (action.screen_x - root_screen_pos.x) / gui_scale -- -root_size.x / 2 .. root_size.x / 2
local dx = (action.screen_x - root_screen_pos.x) * koef_x -- -root_size.x / 2 .. root_size.x / 2
local animation_progress_x = (dx + self.root_size.x / 2) / self.root_size.x -- 0 .. 1
panthera.set_time(self.animation_horizontal, "horizontal", animation_progress_x)
local dy = (action.screen_y - root_screen_pos.y) / gui_scale -- -root_size.y / 2 .. root_size.y / 2
local dy = (action.screen_y - root_screen_pos.y) * koef_y -- -root_size.y / 2 .. root_size.y / 2
local animation_progress_y = (dy + self.root_size.y / 2) / self.root_size.y -- 0 .. 1
panthera.set_time(self.animation_vertical, "vertical", animation_progress_y)
end