Merge pull request #845 from Guldoman/file_drop_override
Add `View:on_file_dropped`
This commit is contained in:
commit
05e1968b0b
|
@ -1478,6 +1478,7 @@ function core.on_event(type, ...)
|
||||||
elseif type == "minimized" or type == "maximized" or type == "restored" then
|
elseif type == "minimized" or type == "maximized" or type == "restored" then
|
||||||
core.window_mode = type == "restored" and "normal" or type
|
core.window_mode = type == "restored" and "normal" or type
|
||||||
elseif type == "filedropped" then
|
elseif type == "filedropped" then
|
||||||
|
if not core.root_view:on_file_dropped(...) then
|
||||||
local filename, mx, my = ...
|
local filename, mx, my = ...
|
||||||
local info = system.get_file_info(filename)
|
local info = system.get_file_info(filename)
|
||||||
if info and info.type == "dir" then
|
if info and info.type == "dir" then
|
||||||
|
@ -1490,6 +1491,7 @@ function core.on_event(type, ...)
|
||||||
core.root_view:open_doc(doc)
|
core.root_view:open_doc(doc)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
elseif type == "focuslost" then
|
elseif type == "focuslost" then
|
||||||
core.root_view:on_focus_lost(...)
|
core.root_view:on_focus_lost(...)
|
||||||
elseif type == "dirchange" then
|
elseif type == "dirchange" then
|
||||||
|
|
|
@ -272,6 +272,12 @@ function RootView:on_mouse_moved(x, y, dx, dy)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function RootView:on_file_dropped(filename, x, y)
|
||||||
|
local node = self.root_node:get_child_overlapping_point(x, y)
|
||||||
|
return node and node.active_view:on_file_dropped(filename, x, y)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function RootView:on_mouse_wheel(...)
|
function RootView:on_mouse_wheel(...)
|
||||||
local x, y = self.mouse.x, self.mouse.y
|
local x, y = self.mouse.x, self.mouse.y
|
||||||
local node = self.root_node:get_child_overlapping_point(x, y)
|
local node = self.root_node:get_child_overlapping_point(x, y)
|
||||||
|
|
|
@ -98,6 +98,11 @@ function View:on_mouse_moved(x, y, dx, dy)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function View:on_file_dropped(filename, x, y)
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function View:on_text_input(text)
|
function View:on_text_input(text)
|
||||||
-- no-op
|
-- no-op
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue