mirror of
https://github.com/Insality/druid
synced 2025-06-27 10:27:48 +02:00
Add multitouch for scroll correct scrolling with several fingers
This commit is contained in:
parent
05425fb76c
commit
f77fa8e8a8
@ -61,7 +61,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
local function find_touch(action_id, action, touch_id)
|
local function find_touch(action_id, action, touch_id)
|
||||||
local act = const.ACTION_TOUCH
|
local act = helper.is_mobile() and const.ACTION_MULTITOUCH or const.ACTION_TOUCH
|
||||||
|
|
||||||
if action_id ~= act then
|
if action_id ~= act then
|
||||||
return
|
return
|
||||||
@ -135,7 +135,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function M.on_input(self, action_id, action)
|
function M.on_input(self, action_id, action)
|
||||||
if action_id ~= const.ACTION_TOUCH then
|
if action_id ~= const.ACTION_TOUCH and action_id ~= const.ACTION_MULTITOUCH then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ function M.on_input(self, action_id, action)
|
|||||||
if touch.released and self.is_touch then
|
if touch.released and self.is_touch then
|
||||||
if action.touch then
|
if action.touch then
|
||||||
-- Mobile
|
-- Mobile
|
||||||
on_touch_release(action_id, action, self)
|
on_touch_release(self, action_id, action)
|
||||||
else
|
else
|
||||||
-- PC
|
-- PC
|
||||||
end_touch(self)
|
end_touch(self)
|
||||||
@ -189,9 +189,9 @@ function M.on_input(self, action_id, action)
|
|||||||
self.dy = touch_modified.screen_y - self.screen_y
|
self.dy = touch_modified.screen_y - self.screen_y
|
||||||
end
|
end
|
||||||
|
|
||||||
if touch then
|
if touch_modified then
|
||||||
self.screen_x = touch.screen_x
|
self.screen_x = touch_modified.screen_x
|
||||||
self.screen_y = touch.screen_y
|
self.screen_y = touch_modified.screen_y
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.is_drag then
|
if self.is_drag then
|
||||||
|
@ -235,7 +235,6 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function M.set_size(self, size)
|
function M.set_size(self, size)
|
||||||
pprint(size)
|
|
||||||
gui.set_size(self.content_node, size)
|
gui.set_size(self.content_node, size)
|
||||||
update_size(self)
|
update_size(self)
|
||||||
end
|
end
|
||||||
|
@ -14,6 +14,7 @@ M.ACTION_ESC = hash("key_esc")
|
|||||||
|
|
||||||
M.ACTION_TOUCH = hash("touch")
|
M.ACTION_TOUCH = hash("touch")
|
||||||
M.ACTION_SCROLL_UP = hash("scroll_up")
|
M.ACTION_SCROLL_UP = hash("scroll_up")
|
||||||
|
M.ACTION_MULTITOUCH = hash("multitouch")
|
||||||
M.ACTION_SCROLL_DOWN = hash("scroll_down")
|
M.ACTION_SCROLL_DOWN = hash("scroll_down")
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,7 +60,6 @@ M["scroll"] = {
|
|||||||
|
|
||||||
BACK_SPEED = 0.2, -- lerp speed
|
BACK_SPEED = 0.2, -- lerp speed
|
||||||
LERP_SPEED = 1,
|
LERP_SPEED = 1,
|
||||||
BORDER_LERP_SPEED = 0.3,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,10 +18,6 @@ key_trigger {
|
|||||||
input: KEY_ESC
|
input: KEY_ESC
|
||||||
action: "key_esc"
|
action: "key_esc"
|
||||||
}
|
}
|
||||||
mouse_trigger {
|
|
||||||
input: MOUSE_BUTTON_1
|
|
||||||
action: "touch"
|
|
||||||
}
|
|
||||||
mouse_trigger {
|
mouse_trigger {
|
||||||
input: MOUSE_WHEEL_UP
|
input: MOUSE_WHEEL_UP
|
||||||
action: "scroll_up"
|
action: "scroll_up"
|
||||||
@ -30,6 +26,14 @@ mouse_trigger {
|
|||||||
input: MOUSE_WHEEL_DOWN
|
input: MOUSE_WHEEL_DOWN
|
||||||
action: "scroll_down"
|
action: "scroll_down"
|
||||||
}
|
}
|
||||||
|
mouse_trigger {
|
||||||
|
input: MOUSE_BUTTON_1
|
||||||
|
action: "touch"
|
||||||
|
}
|
||||||
|
touch_trigger {
|
||||||
|
input: TOUCH_MULTI
|
||||||
|
action: "multitouch"
|
||||||
|
}
|
||||||
text_trigger {
|
text_trigger {
|
||||||
input: TEXT
|
input: TEXT
|
||||||
action: "text"
|
action: "text"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user