mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-12 00:02:25 -04:00
[layouts] When dropping a picture to a layout, place the center of
the picture item at the cursor drop location instead of the top left We want the drop location to be the center of the placed item, because drag thumbnails are usually centered on the mouse cursor
This commit is contained in:
parent
6ef3746bfb
commit
d8be3f5a43
@ -50,7 +50,6 @@ bool QgsLayoutImageDropHandler::handleFileDrop( QgsLayoutDesignerInterface *ifac
|
||||
std::unique_ptr< QgsLayoutItemPicture > item = qgis::make_unique< QgsLayoutItemPicture >( iface->layout() );
|
||||
|
||||
QgsLayoutPoint layoutPoint = iface->layout()->convertFromLayoutUnits( point, iface->layout()->units() );
|
||||
item->attemptMove( layoutPoint );
|
||||
|
||||
item->setPicturePath( file );
|
||||
|
||||
@ -59,6 +58,13 @@ bool QgsLayoutImageDropHandler::handleFileDrop( QgsLayoutDesignerInterface *ifac
|
||||
// and then move back to standard freeform image sizing
|
||||
item->setResizeMode( QgsLayoutItemPicture::Zoom );
|
||||
|
||||
// we want the drop location to be the center of the placed item, because drag thumbnails are usually centered on the mouse cursor
|
||||
item->setReferencePoint( QgsLayoutItem::Middle );
|
||||
item->attemptMove( layoutPoint );
|
||||
|
||||
// reset to standard top-left reference point location
|
||||
item->setReferencePoint( QgsLayoutItem::UpperLeft );
|
||||
|
||||
// and auto select new item for convenience
|
||||
QList< QgsLayoutItem * > newSelection;
|
||||
newSelection << item.get();
|
||||
|
Loading…
x
Reference in New Issue
Block a user