summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Storz <eduard.braun2@gmx.de>2019-09-26 18:00:13 +0000
committerPatrick Storz <eduard.braun2@gmx.de>2019-10-07 20:00:51 +0000
commitbc7264191fa20c35f6da87e32ba2fbaaf57704fc (patch)
treea4694929949fe914763bf02eab92427fd899d198
parentFix remaining # (diff)
downloadinkscape-bc7264191fa20c35f6da87e32ba2fbaaf57704fc.tar.gz
inkscape-bc7264191fa20c35f6da87e32ba2fbaaf57704fc.zip
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.
-rw-r--r--src/file.cpp5
1 files changed, 4 insertions, 1 deletions
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);
}
}