mirror of
https://github.com/Insality/druid
synced 2025-09-27 18:12:21 +02:00
Update with container examples
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user