core/rootview: fix dnd multiple folders into dock
This commit is contained in:
@@ -24,7 +24,7 @@ function RootView:new()
|
|||||||
base_color = style.drag_overlay_tab,
|
base_color = style.drag_overlay_tab,
|
||||||
color = { table.unpack(style.drag_overlay_tab) } }
|
color = { table.unpack(style.drag_overlay_tab) } }
|
||||||
self.drag_overlay_tab.to = { x = 0, y = 0, w = 0, h = 0 }
|
self.drag_overlay_tab.to = { x = 0, y = 0, w = 0, h = 0 }
|
||||||
self.first_update_done = false
|
self.first_dnd_processed = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -324,7 +324,7 @@ function RootView:on_file_dropped(filename, x, y)
|
|||||||
if result then return result end
|
if result then return result end
|
||||||
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
|
||||||
if self.first_update_done then
|
if self.first_dnd_processed then
|
||||||
-- first update done, open in new window
|
-- first update done, open in new window
|
||||||
system.exec(string.format("%q %q", EXEFILE, filename))
|
system.exec(string.format("%q %q", EXEFILE, filename))
|
||||||
else
|
else
|
||||||
@@ -332,6 +332,7 @@ function RootView:on_file_dropped(filename, x, y)
|
|||||||
core.confirm_close_docs(core.docs, function(dirpath)
|
core.confirm_close_docs(core.docs, function(dirpath)
|
||||||
core.open_folder_project(dirpath)
|
core.open_folder_project(dirpath)
|
||||||
end, system.absolute_path(filename))
|
end, system.absolute_path(filename))
|
||||||
|
self.first_dnd_processed = true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local ok, doc = core.try(core.open_doc, filename)
|
local ok, doc = core.try(core.open_doc, filename)
|
||||||
@@ -385,7 +386,9 @@ function RootView:update()
|
|||||||
self:update_drag_overlay()
|
self:update_drag_overlay()
|
||||||
self:interpolate_drag_overlay(self.drag_overlay)
|
self:interpolate_drag_overlay(self.drag_overlay)
|
||||||
self:interpolate_drag_overlay(self.drag_overlay_tab)
|
self:interpolate_drag_overlay(self.drag_overlay_tab)
|
||||||
self.first_update_done = true
|
-- set this to true because at this point there are no dnd requests
|
||||||
|
-- that are caused by the initial dnd into dock user action
|
||||||
|
self.first_dnd_processed = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user