From 113035fa93d5922fa164588f5929b046d982fead Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sat, 22 Sep 2018 19:20:12 -0500 Subject: [PATCH] Fix bug where selection top-left corner was not calculated correctly --- ui/selectablepixmapitem.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ui/selectablepixmapitem.cpp b/ui/selectablepixmapitem.cpp index c120c325..e144f657 100644 --- a/ui/selectablepixmapitem.cpp +++ b/ui/selectablepixmapitem.cpp @@ -8,8 +8,11 @@ QPoint SelectablePixmapItem::getSelectionDimensions() QPoint SelectablePixmapItem::getSelectionStart() { - return QPoint(this->selectionInitialX + this->selectionOffsetX, - this->selectionInitialY + this->selectionOffsetY); + int x = this->selectionInitialX; + int y = this->selectionInitialY; + if (this->selectionOffsetX < 0) x += this->selectionOffsetX; + if (this->selectionOffsetY < 0) y += this->selectionOffsetY; + return QPoint(x, y); } void SelectablePixmapItem::select(int x, int y, int width, int height)