From bc7264191fa20c35f6da87e32ba2fbaaf57704fc Mon Sep 17 00:00:00 2001 From: Patrick Storz Date: Thu, 26 Sep 2019 20:00:13 +0200 Subject: Move imported files to position of mouse pointer when dropped We only considered the position of the mouse pointer *after* clicking through possible import dialogs, so we usually imported at the position of the "OK" button of the import dialog. --- src/file.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/file.cpp b/src/file.cpp index a8ff49cb6..57ad8b54c 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1040,6 +1040,9 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, { SPDesktop *desktop = SP_ACTIVE_DESKTOP; bool cancelled = false; + + // store mouse pointer location before opening any dialogs, so we can drop the item where initially intended + auto pointer_location = desktop->point(); //DEBUG_MESSAGE( fileImport, "file_import( in_doc:%p uri:[%s], key:%p", in_doc, uri, key ); SPDocument *doc; @@ -1150,7 +1153,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, desktop->getDocument()->ensureUpToDate(); Geom::OptRect sel_bbox = selection->visualBounds(); if (sel_bbox) { - Geom::Point m( desktop->point() - sel_bbox->midpoint() ); + Geom::Point m( pointer_location - sel_bbox->midpoint() ); selection->moveRelative(m, false); } } -- cgit v1.2.3