From 6c94826e4ee29432443684bc288c9c1480490a8a Mon Sep 17 00:00:00 2001 From: Ulrich Huber Date: Thu, 14 Feb 2019 13:38:45 +0100 Subject: [PATCH] Force pasted element to be at least south east of upper left corner. --- src/control/Control.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/control/Control.cpp b/src/control/Control.cpp index 449d6fcc..3e1612df 100644 --- a/src/control/Control.cpp +++ b/src/control/Control.cpp @@ -2746,8 +2746,11 @@ void Control::clipboardPaste(Element* e) double width = e->getElementWidth(); double height = e->getElementHeight(); - e->setX(x - width / 2); - e->setY(y - height / 2); + x = MAX(0, x - width / 2); + y = MAX(0, y - height / 2); + + e->setX(x); + e->setY(y); layer->addElement(e); this->doc->unlock();