mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 10:02:18 +02:00
Solve #73 fix scroll drag on stretch/zoom nodes
This commit is contained in:
@@ -186,6 +186,8 @@ function Drag.init(self, node, on_drag_callback)
|
||||
self.on_drag_start = Event()
|
||||
self.on_drag = Event(on_drag_callback)
|
||||
self.on_drag_end = Event()
|
||||
|
||||
self:on_window_resized()
|
||||
end
|
||||
|
||||
|
||||
@@ -199,6 +201,13 @@ function Drag.on_late_init(self)
|
||||
end
|
||||
|
||||
|
||||
function Drag.on_window_resized(self)
|
||||
local x_koef, y_koef = helper.get_screen_aspect_koef()
|
||||
self._x_koef = x_koef
|
||||
self._y_koef = y_koef
|
||||
end
|
||||
|
||||
|
||||
function Drag.on_input_interrupt(self)
|
||||
if self.is_drag or self.is_touch then
|
||||
end_touch(self)
|
||||
@@ -258,8 +267,8 @@ function Drag.on_input(self, action_id, action)
|
||||
|
||||
local touch_modified = find_touch(action_id, action, self.touch_id)
|
||||
if touch_modified and self.is_drag then
|
||||
self.dx = touch_modified.x - self.x
|
||||
self.dy = touch_modified.y - self.y
|
||||
self.dx = (touch_modified.x - self.x) * self._x_koef
|
||||
self.dy = (touch_modified.y - self.y) * self._y_koef
|
||||
end
|
||||
|
||||
if touch_modified then
|
||||
|
Reference in New Issue
Block a user