Update drag screen koef value

This commit is contained in:
Insality 2022-07-17 18:41:02 +03:00
parent 46bcbb596d
commit 3e5a90920e
5 changed files with 12 additions and 10 deletions

View File

@ -278,7 +278,11 @@ function Drag.on_input(self, action_id, action)
end
if self.is_drag then
self.on_drag:trigger(self:get_context(), self.dx, self.dy, self.x - self.touch_start_pos.x, self.y - self.touch_start_pos.y)
self.on_drag:trigger(self:get_context(),
self.dx * self._x_koef,
self.dy * self._y_koef,
(self.x - self.touch_start_pos.x) * self._x_koef,
(self.y - self.touch_start_pos.y) * self._y_koef)
end
return self.is_drag

View File

@ -743,7 +743,6 @@ function Scroll._process_scroll_wheel(self, action_id, action)
return false
end
local koef = (action_id == const.ACTION_SCROLL_UP) and 1 or -1
if self.style.WHEEL_SCROLL_INVERTED then
koef = -koef

View File

@ -49,13 +49,7 @@ function Layout:on_window_resized()
return
end
local window_x, window_y = window.get_size()
local stretch_x = window_x / self.gui_size.x
local stretch_y = window_y / self.gui_size.y
local x_koef = self.fit_size.x / self.origin_size.x * stretch_x / math.min(stretch_x, stretch_y)
local y_koef = self.fit_size.y / self.origin_size.y * stretch_y / math.min(stretch_x, stretch_y)
local x_koef, y_koef = helper.get_screen_aspect_koef()
local new_size = vmath.vector3(self.origin_size)
if self.mode == const.LAYOUT_MODE.STRETCH_X or self.mode == const.LAYOUT_MODE.STRETCH then

View File

@ -147,4 +147,9 @@ M["text"] = {
}
M["hotkey"] = {
MODIFICATORS = {}, -- Add key ids to mark it as modificator keys
}
return M

View File

@ -274,7 +274,7 @@ nodes {
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_N
adjust_mode: ADJUST_MODE_STRETCH
adjust_mode: ADJUST_MODE_FIT
parent: "lobby_view"
layer: ""
inherit_alpha: true